mirror of
https://github.com/yuruotong1/autoMate.git
synced 2026-03-22 13:07:17 +08:00
更新agent逻辑
This commit is contained in:
@@ -101,17 +101,11 @@ def process_input(user_input, state, vision_agent_state):
|
||||
)
|
||||
yield state['messages']
|
||||
agent = vision_agent_state["agent"]
|
||||
for loop_msg in sampling_loop_sync(
|
||||
for _ in sampling_loop_sync(
|
||||
model=state["model"],
|
||||
messages=state["messages"],
|
||||
vision_agent = agent
|
||||
):
|
||||
if loop_msg is None or state.get("stop"):
|
||||
yield state['messages']
|
||||
print("End of task. Close the loop.")
|
||||
break
|
||||
|
||||
yield state['messages']
|
||||
): yield state['messages']
|
||||
|
||||
def stop_app(state):
|
||||
state["stop"] = True
|
||||
|
||||
@@ -32,19 +32,22 @@ def sampling_loop_sync(
|
||||
task_plan_agent = TaskPlanAgent()
|
||||
executor = AnthropicExecutor()
|
||||
plan_list = task_plan_agent(messages=messages)
|
||||
yield
|
||||
task_run_agent = TaskRunAgent()
|
||||
verification_agent = VerificationAgent()
|
||||
for plan in plan_list:
|
||||
yield execute_task_plan(plan, vision_agent, task_run_agent, executor, messages)
|
||||
execute_task_plan(plan, vision_agent, task_run_agent, executor, messages)
|
||||
yield
|
||||
sleep(2)
|
||||
yield verification_loop(vision_agent, plan, verification_agent, executor, task_run_agent, messages)
|
||||
verification_loop(vision_agent, plan, verification_agent, executor, task_run_agent, messages)
|
||||
yield
|
||||
|
||||
def verification_loop(vision_agent, plan, verification_agent, executor, task_run_agent, messages):
|
||||
"""verification agent will be called in the loop"""
|
||||
while True:
|
||||
# 验证结果
|
||||
verification_result = verification_agent(plan["expected_result"], messages)
|
||||
yield verification_result
|
||||
yield
|
||||
# 如果验证成功,返回结果
|
||||
if verification_result["verification_status"] == "success":
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user