mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 09:03:54 +08:00
update:修复iot不更新的bug
This commit is contained in:
@@ -22,6 +22,10 @@ class FunctionHandler:
|
|||||||
self.register_config_functions()
|
self.register_config_functions()
|
||||||
self.functions_desc = self.function_registry.get_all_function_desc()
|
self.functions_desc = self.function_registry.get_all_function_desc()
|
||||||
self.finish_init = True
|
self.finish_init = True
|
||||||
|
|
||||||
|
def upload_functions_desc(self):
|
||||||
|
self.functions_desc = self.function_registry.get_all_function_desc()
|
||||||
|
|
||||||
|
|
||||||
def current_support_functions(self):
|
def current_support_functions(self):
|
||||||
func_names = []
|
func_names = []
|
||||||
|
|||||||
@@ -338,8 +338,7 @@ async def handleIotDescriptors(conn, descriptors):
|
|||||||
|
|
||||||
# 如果注册了新函数,更新function描述列表
|
# 如果注册了新函数,更新function描述列表
|
||||||
if functions_changed and hasattr(conn, "func_handler"):
|
if functions_changed and hasattr(conn, "func_handler"):
|
||||||
|
conn.func_handler.upload_functions_desc()
|
||||||
conn.func_handler.functions_desc = conn.func_handler.function_registry.get_all_function_desc()
|
|
||||||
|
|
||||||
func_names = conn.func_handler.current_support_functions()
|
func_names = conn.func_handler.current_support_functions()
|
||||||
conn.logger.bind(tag=TAG).info(f"设备类型: {type_id}")
|
conn.logger.bind(tag=TAG).info(f"设备类型: {type_id}")
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class MCPManager:
|
|||||||
self.conn.logger.bind(tag=TAG).error(
|
self.conn.logger.bind(tag=TAG).error(
|
||||||
f"Failed to initialize MCP server {name}: {e}"
|
f"Failed to initialize MCP server {name}: {e}"
|
||||||
)
|
)
|
||||||
|
self.conn.func_handler.upload_functions_desc()
|
||||||
|
|
||||||
def get_all_tools(self) -> List[Dict[str, Any]]:
|
def get_all_tools(self) -> List[Dict[str, Any]]:
|
||||||
"""获取所有服务的工具function定义
|
"""获取所有服务的工具function定义
|
||||||
|
|||||||
Reference in New Issue
Block a user