增加function call action的 Error code

This commit is contained in:
玄凤科技 2025-03-17 17:32:49 +08:00
parent d1442573b5
commit 4342f87515
2 changed files with 5 additions and 3 deletions

View file

@ -450,7 +450,7 @@ class ConnectionHandler:
future = self.executor.submit(self.speak_and_play, text, text_index)
self.tts_queue.put(future)
self.dialogue.put(Message(role="assistant", content=text))
if result.action == Action.REQLLM: # 调用函数后再请求llm生成回复
elif result.action == Action.REQLLM: # 调用函数后再请求llm生成回复
text = result.result
if text is not None and len(text) > 0:
@ -465,9 +465,10 @@ class ConnectionHandler:
self.dialogue.put(Message(role="tool", tool_call_id=function_id, content=text))
self.chat_with_function_calling(text, tool_call=True)
if result.action == Action.NOTFOUND:
elif result.action == Action.NOTFOUND:
text = result.response
else:
text = result.response
def _tts_priority_thread(self):

View file

@ -19,6 +19,7 @@ class ToolType(Enum):
class Action(Enum):
ERROR = (-1, "错误")
NOTFOUND = (0, "没有找到函数")
NONE = (1, "啥也不干")
RESPONSE = (2, "直接回复")