mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
增加function call action的 Error code
This commit is contained in:
parent
d1442573b5
commit
4342f87515
2 changed files with 5 additions and 3 deletions
|
|
@ -450,7 +450,7 @@ class ConnectionHandler:
|
||||||
future = self.executor.submit(self.speak_and_play, text, text_index)
|
future = self.executor.submit(self.speak_and_play, text, text_index)
|
||||||
self.tts_queue.put(future)
|
self.tts_queue.put(future)
|
||||||
self.dialogue.put(Message(role="assistant", content=text))
|
self.dialogue.put(Message(role="assistant", content=text))
|
||||||
if result.action == Action.REQLLM: # 调用函数后再请求llm生成回复
|
elif result.action == Action.REQLLM: # 调用函数后再请求llm生成回复
|
||||||
|
|
||||||
text = result.result
|
text = result.result
|
||||||
if text is not None and len(text) > 0:
|
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.dialogue.put(Message(role="tool", tool_call_id=function_id, content=text))
|
||||||
self.chat_with_function_calling(text, tool_call=True)
|
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
|
text = result.response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _tts_priority_thread(self):
|
def _tts_priority_thread(self):
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class ToolType(Enum):
|
||||||
|
|
||||||
|
|
||||||
class Action(Enum):
|
class Action(Enum):
|
||||||
|
ERROR = (-1, "错误")
|
||||||
NOTFOUND = (0, "没有找到函数")
|
NOTFOUND = (0, "没有找到函数")
|
||||||
NONE = (1, "啥也不干")
|
NONE = (1, "啥也不干")
|
||||||
RESPONSE = (2, "直接回复")
|
RESPONSE = (2, "直接回复")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue