main
jackfood 1 year ago committed by GitHub
parent 5ba6b3aac4
commit 5819c774d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,23 +9,31 @@ while True:
if user_input.lower() == 'exit':
break # Exit the loop if the user types 'exit'
# Write the user input to a file called '~prompt.txt' as UTF-8, creating a new one or overwriting if it exists
with open('~prompt.txt', 'w', encoding='utf-8') as file:
# Get the current working directory
current_directory = os.getcwd()
# Construct the path to the '~prompt.txt' file in the current directory
prompt_file_path = os.path.join(current_directory, '~prompt.txt')
# Write the user input to the '~prompt.txt' file as UTF-8
with open(prompt_file_path, 'w', encoding='utf-8') as file:
file.write(user_input)
# Introduce a 0.2-second delay
time.sleep(0.2)
# Path to the batch script
batch_script_path = r'D:\Python\~CodeInterpereterwithGPTTest\Scripts\aiengine.bat'
batch_script_path = os.path.join(current_directory, 'aiengine.bat')
batch_script_path_extractpy = os.path.join(current_directory, '~extractpython.bat')
# Start the batch script and wait for it to complete
process = subprocess.Popen(batch_script_path, shell=True)
process.wait()
# Check if 'aianswer.txt' exists and read its contents
if os.path.exists('aianswer.txt'):
with open('aianswer.txt', 'r', encoding='utf-8') as file:
aianswer_file_path = os.path.join(current_directory, 'aianswer.txt')
if os.path.exists(aianswer_file_path):
with open(aianswer_file_path, 'r', encoding='utf-8') as file:
ai_response = file.read()
print("AI Response:")
print(ai_response)

Loading…
Cancel
Save