acecalisto3 commited on
Commit
6ad1bf2
1 Parent(s): 624b560

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import os
3
  import subprocess
4
  import streamlit as st
@@ -312,10 +311,12 @@ class AIAgent:
312
  Handles user input and executes the corresponding action.
313
  """
314
  if input_str:
315
- action, *args = input_str.split()
316
- else:
317
- # Handle empty input (e.g., display a message or do nothing)
318
- print("Please provide input.")
 
 
319
  "output": self.tools[action](" ".join(args))
320
  })
321
  else:
@@ -327,6 +328,9 @@ class AIAgent:
327
  print(f"Action: {action}\nInput: {' '.join(args)}\nOutput: {self.tools[action](' '.join(args))}")
328
  else:
329
  raise InvalidActionError("Invalid action. Please choose a valid action from the list of tools.")
 
 
 
330
  except (InvalidActionError, InvalidInputError, CodeGenerationError, CodeRefinementError,
331
  CodeTestingError, CodeIntegrationError, AppTestingError, WorkspaceExplorerError,
332
  PromptManagementError, SearchError) as e:
 
 
1
  import os
2
  import subprocess
3
  import streamlit as st
 
311
  Handles user input and executes the corresponding action.
312
  """
313
  if input_str:
314
+ action, *args = input_str.split()
315
+ if action in self.tools:
316
+ if args:
317
+ self.task_history.append({
318
+ "action": action,
319
+ "input": " ".join(args),
320
  "output": self.tools[action](" ".join(args))
321
  })
322
  else:
 
328
  print(f"Action: {action}\nInput: {' '.join(args)}\nOutput: {self.tools[action](' '.join(args))}")
329
  else:
330
  raise InvalidActionError("Invalid action. Please choose a valid action from the list of tools.")
331
+ else:
332
+ # Handle empty input (e.g., display a message or do nothing)
333
+ print("Please provide input.")
334
  except (InvalidActionError, InvalidInputError, CodeGenerationError, CodeRefinementError,
335
  CodeTestingError, CodeIntegrationError, AppTestingError, WorkspaceExplorerError,
336
  PromptManagementError, SearchError) as e: