fix : language_bash_attempt error

This commit is contained in:
martin legrand
2025-04-11 12:44:55 +02:00
parent 4198e932ca
commit 92f9b93353
5 changed files with 194 additions and 8 deletions
+3 -6
View File
@@ -80,9 +80,10 @@ class PlannerAgent(Agent):
"""
return prompt
def show_plan(self, json_plan: dict) -> None:
agents_tasks = self.parse_agent_tasks(json_plan)
def show_plan(self, answer: dict) -> None:
agents_tasks = self.parse_agent_tasks(answer)
if agents_tasks == (None, None):
pretty_print(answer, color="warning")
pretty_print("Failed to make a plan. This can happen with (too) small LLM. Clarify your request and insist on it making a plan.", color="failure")
return
pretty_print("\n▂▘ P L A N ▝▂", color="status")
@@ -97,10 +98,6 @@ class PlannerAgent(Agent):
animate_thinking("Thinking...", color="status")
self.memory.push('user', prompt)
answer, _ = self.llm_request()
for line in answer.split('\n'):
if "```json" in line:
break
pretty_print(line, color="output")
self.show_plan(answer)
ok_str = input("Is the plan ok? (y/n): ")
if ok_str == 'y':