ruv commited on
Commit
409b4f6
1 Parent(s): 264cabb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -16
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
- while True:
 
97
  print("\nOptions:")
98
- print("1. Modify the function further")
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 == "1":
103
- modification_prompt = input("Enter the modification prompt: ")
104
- success, error, modified_function = generate_and_test_function(modification_prompt, generated_function)
105
- if success:
106
- generated_function = modified_function
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"