Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyaoww committed Apr 2, 2024
1 parent 2c4087f commit 4e4b99c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions agenthub/planner_agent/prompt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from typing import List, Tuple, Dict, Type

from opendevin.controller.agent_controller import print_with_indent
from opendevin.controller.agent_controller import print_with_color
from opendevin.plan import Plan
from opendevin.action import Action, action_from_dict
from opendevin.observation import Observation
Expand Down Expand Up @@ -178,7 +178,7 @@ def get_prompt(plan: Plan, history: List[Tuple[Action, Observation]]):
elif latest_action_id == "finish":
hint = ""

print_with_indent("HINT:\n" + hint)
print_with_color("HINT:\n" + hint, "INFO")
return prompt % {
'task': plan.main_goal,
'plan': plan_str,
Expand Down
10 changes: 5 additions & 5 deletions opendevin/controller/agent_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def print_with_color(text: Any, print_type: str = "INFO"):
"ACTION": "green",
"OBSERVATION": "yellow",
"INFO": "cyan",
"ERROR": "red"
"ERROR": "red",
"PLAN": "light_magenta",
}
color = TYPE_TO_COLOR.get(print_type.upper(), TYPE_TO_COLOR["INFO"])
print(
Expand Down Expand Up @@ -89,8 +90,7 @@ async def start_loop(self, task: str):
async def step(self, i: int):
print("\n\n==============", flush=True)
print("STEP", i, flush=True)
print_with_indent("\nPLAN:\n")
print_with_indent(self.state.plan.__str__())
print_with_color(self.state.plan.main_goal, "PLAN")

log_obs = self.command_manager.get_background_obs()
for obs in log_obs:
Expand Down Expand Up @@ -124,14 +124,14 @@ async def step(self, i: int):
self.state.plan.add_subtask(action.parent, action.goal, action.subtasks)
except Exception as e:
observation = AgentErrorObservation(str(e))
print_with_indent("\nADD TASK ERROR:\n%s" % observation)
print_with_color(observation, "ERROR")
traceback.print_exc()
elif isinstance(action, ModifyTaskAction):
try:
self.state.plan.set_subtask_state(action.id, action.state)
except Exception as e:
observation = AgentErrorObservation(str(e))
print_with_indent("\nMODIFY TASK ERROR:\n%s" % observation)
print_with_color(observation, "ERROR")
traceback.print_exc()

if action.executable:
Expand Down

0 comments on commit 4e4b99c

Please sign in to comment.