Skip to content

Commit d56b9ab

Browse files
committed
refactor:重构更新步骤为失败的处理逻辑以提升代码可读性和维护性
1 parent f9d2511 commit d56b9ab

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • agents/matmaster_agent/core_agents/public_agents/job_agents/submit_core_agent

agents/matmaster_agent/core_agents/public_agents/job_agents/submit_core_agent/agent.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ async def _run_events(self, ctx: InvocationContext) -> AsyncGenerator[Event, Non
100100
yield tool_response_failed_event
101101

102102
# 更新 plan 为失败
103-
update_plan = copy.deepcopy(ctx.session.state['plan'])
104-
update_plan['steps'][ctx.session.state['plan_index']][
105-
'status'
106-
] = 'failed'
107-
yield update_state_event(ctx, state_delta={'plan': update_plan})
103+
post_execution_step = copy.deepcopy(get_current_step(ctx))
104+
post_execution_step[CURRENT_STEP_STATUS] = (
105+
PlanStepStatusEnum.FAILED
106+
)
107+
yield update_state_event(
108+
ctx, state_delta={CURRENT_STEP: post_execution_step}
109+
)
108110

109111
raise RuntimeError('Tool Execution Failed')
110112
dict_result = load_tool_response(first_part)

0 commit comments

Comments
 (0)