Update app.py
Browse files
app.py
CHANGED
@@ -92,25 +92,18 @@ def save_function_to_file(generated_function, file_name):
|
|
92 |
file.write(generated_function)
|
93 |
print(f"Function saved to {file_name}")
|
94 |
|
|
|
95 |
def handle_post_success_actions(generated_function):
|
96 |
-
|
|
|
97 |
print("\nOptions:")
|
98 |
-
|
99 |
-
print("2. Save the function to a file")
|
100 |
-
print("3. Return to main menu")
|
101 |
option = input("Enter your choice (1-3): ")
|
102 |
-
if option
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
else:
|
108 |
-
print("Modification failed. Keeping the original function.")
|
109 |
-
elif option == "2":
|
110 |
-
file_name = input("Enter the file name to save the function (e.g., hello_world.py): ")
|
111 |
-
save_function_to_file(generated_function, file_name)
|
112 |
-
elif option == "3":
|
113 |
-
return generated_function
|
114 |
|
115 |
def main(initial_prompt, run_mode, num_runs, console_output, command_input):
|
116 |
console_output = "Enter the initial prompt for the development process: " + initial_prompt + "\n"
|
|
|
92 |
file.write(generated_function)
|
93 |
print(f"Function saved to {file_name}")
|
94 |
|
95 |
+
# Example adjustment for the option handling part
|
96 |
def handle_post_success_actions(generated_function):
|
97 |
+
valid_option = False
|
98 |
+
while not valid_option:
|
99 |
print("\nOptions:")
|
100 |
+
# Options list here
|
|
|
|
|
101 |
option = input("Enter your choice (1-3): ")
|
102 |
+
if option in ["1", "2", "3"]:
|
103 |
+
valid_option = True
|
104 |
+
# Handle each option here
|
105 |
+
else:
|
106 |
+
print("Invalid choice. Please try again.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
def main(initial_prompt, run_mode, num_runs, console_output, command_input):
|
109 |
console_output = "Enter the initial prompt for the development process: " + initial_prompt + "\n"
|