mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-26 04:39:53 +01:00
update:修复iot不更新的bug
This commit is contained in:
parent
4ee9a47d41
commit
231ae8dfa6
3 changed files with 6 additions and 2 deletions
|
|
@ -23,6 +23,10 @@ class FunctionHandler:
|
||||||
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 = []
|
||||||
for func in self.functions_desc:
|
for func in self.functions_desc:
|
||||||
|
|
|
||||||
|
|
@ -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定义
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue