This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user