mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
Merge pull request #1559 from xinnan-tech/py_fix_mcp-type
修复MCP工具调用参数类型错误问题;"logger中vad和asr动态变化"的补充
This commit is contained in:
@@ -425,10 +425,12 @@ class ConnectionHandler:
|
||||
init_asr = check_asr_update(self.common_config, private_config)
|
||||
|
||||
if init_vad:
|
||||
self.config["VAD"] = private_config["VAD"]
|
||||
self.config["selected_module"]["VAD"] = private_config["selected_module"][
|
||||
"VAD"
|
||||
]
|
||||
if init_asr:
|
||||
self.config["ASR"] = private_config["ASR"]
|
||||
self.config["selected_module"]["ASR"] = private_config["selected_module"][
|
||||
"ASR"
|
||||
]
|
||||
|
||||
@@ -84,9 +84,11 @@ async def process_intent_result(conn, intent_result, original_text):
|
||||
if not funcItem:
|
||||
conn.func_handler.function_registry.register_function("play_music")
|
||||
|
||||
function_args = None
|
||||
function_args = {}
|
||||
if "arguments" in intent_data["function_call"]:
|
||||
function_args = intent_data["function_call"]["arguments"]
|
||||
if function_args is None:
|
||||
function_args = {}
|
||||
# 确保参数是字符串格式的JSON
|
||||
if isinstance(function_args, dict):
|
||||
function_args = json.dumps(function_args)
|
||||
|
||||
@@ -76,6 +76,14 @@ class IntentProvider(IntentProviderBase):
|
||||
'返回: {"function_call": {"name": "get_battery_level", "arguments": {"response_success": "当前电池电量为{value}%", "response_failure": "无法获取Battery的当前电量百分比"}}}\n'
|
||||
"```\n"
|
||||
"```\n"
|
||||
"用户: 当前屏幕亮度是多少?\n"
|
||||
'返回: {"function_call": {"name": "self_screen_get_brightness"}}\n'
|
||||
"```\n"
|
||||
"```\n"
|
||||
"用户: 设置屏幕亮度为50%\n"
|
||||
'返回: {"function_call": {"name": "self_screen_set_brightness", "arguments": {"brightness": 50}}}\n'
|
||||
"```\n"
|
||||
"```\n"
|
||||
"用户: 我想结束对话\n"
|
||||
'返回: {"function_call": {"name": "handle_exit_intent", "arguments": {"say_goodbye": "goodbye"}}}\n'
|
||||
"```\n"
|
||||
|
||||
Reference in New Issue
Block a user