mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 00:23:53 +08:00
Merge branch 'py_test_end' into fix-end
This commit is contained in:
@@ -10,6 +10,7 @@ from core.providers.tts.dto.dto import ContentType
|
||||
from core.handle.helloHandle import checkWakeupWords
|
||||
from plugins_func.register import Action, ActionResponse
|
||||
from core.handle.sendAudioHandle import send_stt_message
|
||||
from core.handle.reportHandle import enqueue_tool_report
|
||||
from core.utils.util import remove_punctuation_and_length
|
||||
from core.providers.tts.dto.dto import TTSMessageDTO, SentenceType
|
||||
|
||||
@@ -146,6 +147,17 @@ async def process_intent_result(
|
||||
await send_stt_message(conn, original_text)
|
||||
conn.client_abort = False
|
||||
|
||||
# 准备工具调用参数
|
||||
tool_input = {}
|
||||
if function_args:
|
||||
if isinstance(function_args, str):
|
||||
tool_input = json.loads(function_args) if function_args else {}
|
||||
elif isinstance(function_args, dict):
|
||||
tool_input = function_args
|
||||
|
||||
# 上报工具调用
|
||||
enqueue_tool_report(conn, function_name, tool_input)
|
||||
|
||||
# 使用executor执行函数调用和结果处理
|
||||
def process_function_call():
|
||||
conn.dialogue.put(Message(role="user", content=original_text))
|
||||
@@ -166,7 +178,10 @@ async def process_intent_result(
|
||||
action=Action.ERROR, result="工具调用超时,请一会再试下哈", response="工具调用超时,请一会再试下哈"
|
||||
)
|
||||
|
||||
# 上报工具调用结果
|
||||
if result:
|
||||
enqueue_tool_report(conn, function_name, tool_input, str(result.result) if result.result else None, report_tool_call=False)
|
||||
|
||||
if result.action == Action.RESPONSE: # 直接回复前端
|
||||
text = result.response
|
||||
if text is not None:
|
||||
|
||||
Reference in New Issue
Block a user