feat: 完善子图,添加路由函数和审核节点
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m10s

This commit is contained in:
2026-04-25 20:46:30 +08:00
parent d05a57948c
commit e6337eb0fc
5 changed files with 139 additions and 6 deletions

View File

@@ -250,5 +250,28 @@ def format_result(state: DictionaryState) -> DictionaryState:
state.final_result = "\n".join(output_lines)
state.success = True
state.current_phase = "completed"
return state
def should_continue(state: DictionaryState) -> str:
"""
条件路由函数:根据 action 决定下一个节点
"""
action = state.action
if action == DictionaryAction.QUERY:
return "query_word"
elif action == DictionaryAction.TRANSLATE:
return "translate_text"
elif action == DictionaryAction.EXTRACT:
return "extract_terms"
elif action == DictionaryAction.DAILY_WORD:
return "get_daily_word"
elif action == DictionaryAction.LOOKUP_WORD_BOOK:
return "lookup_word_book"
elif action == DictionaryAction.ADD_TO_WORD_BOOK:
return "add_to_word_book"
else:
return "format_result"
return state