acecalisto3 commited on
Commit
fdc9747
·
verified ·
1 Parent(s): dd5e470

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -34
app.py CHANGED
@@ -223,45 +223,39 @@ class App:
223
  return None, f"Error: Failed to parse action from NLP response\n"
224
 
225
  def run(self):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  print("Welcome to the Python App Builder!")
227
  print("Type 'help' to see the available commands.")
 
228
  print("-" * 50)
229
- try:
230
- while True:
231
- try:
232
- input_text = input("Enter input: ")
233
- except EOFError:
234
- print("Error: Input reading interrupted. Please provide valid input.")
235
- continue
236
 
237
- output, system_message = self.process_input(input_text)
238
- if output:
239
- print(output)
240
- if system_message:
241
- print(system_message)
242
- except KeyboardInterrupt:
243
- print("\nApplication stopped by user.")
244
 
245
- def run(self):
246
- print("Welcome to the Python App Builder!")
247
- print("Type 'help' to see the available commands.")
248
- print("-" * 50)
249
- try:
250
- while True:
251
- try:
252
- input_text = input("Enter input: ")
253
- output, system_message = self.process_input(input_text)
254
- if output:
255
- print(output)
256
- if system_message:
257
- print(system_message)
258
- except EOFError:
259
- print("Error: Input reading interrupted. Please provide valid input.")
260
- except KeyboardInterrupt:
261
- print("\nApplication stopped by user.")
262
- break
263
- except Exception as e:
264
- print(f"An error occurred: {str(e)}")
265
 
266
  def main():
267
  try:
 
223
  return None, f"Error: Failed to parse action from NLP response\n"
224
 
225
  def run(self):
226
+ self._print_welcome_message()
227
+
228
+ while True:
229
+ try:
230
+ input_text = self._get_user_input()
231
+ if input_text.lower() == 'exit':
232
+ break
233
+
234
+ output, system_message = self.process_input(input_text)
235
+ self._display_output(output, system_message)
236
+
237
+ except EOFError:
238
+ print("Error: Input reading interrupted. Please provide valid input.")
239
+ except KeyboardInterrupt:
240
+ print("\nApplication stopped by user.")
241
+ break
242
+ except Exception as e:
243
+ print(f"An error occurred: {str(e)}")
244
+
245
+ def _print_welcome_message(self):
246
  print("Welcome to the Python App Builder!")
247
  print("Type 'help' to see the available commands.")
248
+ print("Type 'exit' to quit the application.")
249
  print("-" * 50)
 
 
 
 
 
 
 
250
 
251
+ def _get_user_input(self):
252
+ return input("Enter input: ").strip()
 
 
 
 
 
253
 
254
+ def _display_output(self, output, system_message):
255
+ if output:
256
+ print(output)
257
+ if system_message:
258
+ print(system_message)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
 
260
  def main():
261
  try: