fix: 配置读取缺失

This commit is contained in:
Sakura-RanChen 2026-11-19 09:40:51 +08:00
parent 9100e7ecd2
commit 4ae96c6e02

View file

@ -916,6 +916,8 @@ class ConnectionHandler:
self.chat_history_conf = int(private_config["chat_history_conf"]) self.chat_history_conf = int(private_config["chat_history_conf"])
if private_config.get("mcp_endpoint", None) is not None: if private_config.get("mcp_endpoint", None) is not None:
self.config["mcp_endpoint"] = private_config["mcp_endpoint"] self.config["mcp_endpoint"] = private_config["mcp_endpoint"]
if private_config.get("mcp_forward_speaker", None) is not None:
self.config["mcp_forward_speaker"] = private_config["mcp_forward_speaker"]
if private_config.get("context_providers", None) is not None: if private_config.get("context_providers", None) is not None:
self.config["context_providers"] = private_config["context_providers"] self.config["context_providers"] = private_config["context_providers"]
@ -1132,7 +1134,7 @@ class ConnectionHandler:
try: try:
parsed = json.loads(q) parsed = json.loads(q)
if isinstance(parsed, dict): if isinstance(parsed, dict):
cs = (parsed.get("speaker") or "").strip() cs = str(parsed.get("speaker") or "").strip()
except (json.JSONDecodeError, TypeError, ValueError): except (json.JSONDecodeError, TypeError, ValueError):
pass pass
if cs and cs != UNKNOWN_SPEAKER_NAME and cs not in self.system_introduced_speakers: if cs and cs != UNKNOWN_SPEAKER_NAME and cs not in self.system_introduced_speakers: