fix: enforce personalization tool disables in api flows

This commit is contained in:
JOJO 2026-01-25 13:44:52 +08:00
parent 51f61b04d2
commit f7034a3047
2 changed files with 11 additions and 0 deletions

View File

@ -249,6 +249,11 @@ def send_message_api(workspace_id: str):
"personalization_name": personalization_name, "personalization_name": personalization_name,
"workspace_id": ws.workspace_id, "workspace_id": ws.workspace_id,
}) })
# 立即应用个性化偏好(确保禁用工具分类生效)
try:
terminal.apply_personalization_preferences(terminal.context_manager.custom_personalization_config)
except Exception as exc:
debug_log(f"[api_v1] 应用个性化失败: {exc}")
except Exception as exc: except Exception as exc:
return jsonify({"success": False, "error": f"自定义参数错误: {exc}"}), 400 return jsonify({"success": False, "error": f"自定义参数错误: {exc}"}), 400

View File

@ -216,6 +216,12 @@ def apply_conversation_overrides(terminal: WebTerminal, workspace, conversation_
terminal.context_manager.custom_personalization_config = None terminal.context_manager.custom_personalization_config = None
else: else:
terminal.context_manager.custom_personalization_config = None terminal.context_manager.custom_personalization_config = None
# 应用个性化偏好(含禁用工具分类)到当前终端
try:
terminal.apply_personalization_preferences(terminal.context_manager.custom_personalization_config)
except Exception as exc:
debug_log(f"[apply_overrides] 应用个性化失败: {exc}")
except Exception as exc: except Exception as exc:
debug_log(f"[apply_overrides] 读取对话元数据失败: {exc}") debug_log(f"[apply_overrides] 读取对话元数据失败: {exc}")