mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 23:23:55 +08:00
fix(server): 加载插件改为初始化时同步执行 #559
This commit is contained in:
@@ -102,6 +102,19 @@ class ConnectionHandler:
|
|||||||
if self.config["selected_module"]["Intent"] == 'function_call':
|
if self.config["selected_module"]["Intent"] == 'function_call':
|
||||||
self.use_function_call_mode = True
|
self.use_function_call_mode = True
|
||||||
|
|
||||||
|
try:
|
||||||
|
# 加载插件
|
||||||
|
if self.use_function_call_mode:
|
||||||
|
self.func_handler = FunctionHandler(self)
|
||||||
|
self.logger.bind(tag=TAG).info("初始化FunctionHandler成功")
|
||||||
|
else:
|
||||||
|
self.func_handler = None
|
||||||
|
self.logger.bind(tag=TAG).info("未启用function_call模式,跳过FunctionHandler初始化")
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.bind(tag=TAG).error(f"初始化FunctionHandler失败: {str(e)}")
|
||||||
|
self.func_handler = None
|
||||||
|
self.use_function_call_mode = False
|
||||||
|
|
||||||
self.mcp_manager = MCPManager(self)
|
self.mcp_manager = MCPManager(self)
|
||||||
|
|
||||||
async def handle_connection(self, ws):
|
async def handle_connection(self, ws):
|
||||||
@@ -191,9 +204,6 @@ class ConnectionHandler:
|
|||||||
self.prompt = self.private_config.private_config.get("prompt", self.prompt)
|
self.prompt = self.private_config.private_config.get("prompt", self.prompt)
|
||||||
self.dialogue.put(Message(role="system", content=self.prompt))
|
self.dialogue.put(Message(role="system", content=self.prompt))
|
||||||
|
|
||||||
"""加载插件"""
|
|
||||||
self.func_handler = FunctionHandler(self)
|
|
||||||
|
|
||||||
"""加载记忆"""
|
"""加载记忆"""
|
||||||
device_id = self.headers.get("device-id", None)
|
device_id = self.headers.get("device-id", None)
|
||||||
self.memory.init_memory(device_id, self.llm)
|
self.memory.init_memory(device_id, self.llm)
|
||||||
|
|||||||
Reference in New Issue
Block a user