Skip to content

Commit 91f0caf

Browse files
committed
refactor:将步骤描述键改为StepKey枚举便于管理和维护
1 parent 2c8cc9d commit 91f0caf

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

agents/matmaster_agent/flow_agents/execution_agent/agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from agents.matmaster_agent.locales import i18n
3737
from agents.matmaster_agent.logger import PrefixFilter
3838
from agents.matmaster_agent.prompt import MatMasterCheckTransferPrompt
39-
from agents.matmaster_agent.state import PLAN, STEP_DESCRIPTION
39+
from agents.matmaster_agent.state import PLAN, STEP_DESCRIPTION, StepKey
4040
from agents.matmaster_agent.sub_agents.mapping import (
4141
MatMasterSubAgentsEnum,
4242
)
@@ -289,10 +289,10 @@ async def _prepare_retry_failed_result(
289289
)
290290
# 在重试时更新步骤描述,包含校验失败的原因
291291
original_description = ctx.session.state[PLAN]['steps'][index][
292-
'description'
292+
StepKey.STEP_DESCRIPTION
293293
]
294294
update_plan['steps'][index][
295-
'description'
295+
StepKey.STEP_DESCRIPTION
296296
] = f"{original_description}\n\n注意:上次执行因以下原因校验失败,请改进:{validation_reason}"
297297
else:
298298
logger.info(

agents/matmaster_agent/state.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@
1919

2020
class StateKey(StrEnum):
2121
pass
22+
23+
24+
class StepKey(StrEnum):
25+
STEP_DESCRIPTION = 'step_description'

0 commit comments

Comments
 (0)