-- ============================================================ -- 智能工作台修复脚本(2026-11-17) -- -- 适用场景:已经初始化过 ai_orchestration*.sql 的环境。 -- 内容: -- 1) 完整移除「平台运行日报」能力(工具 / 技能 / 平台运维助手 / 日报表) -- 2) 修正内置 MCP 客户端 platform_system_info 的自连地址(8080 → 当前后端 8980) -- -- 幂等:可重复执行;执行前请确认 ai_daily_digest 中无需要保留的历史数据。 -- ============================================================ -- ------------------------------------------------------------ -- 1. 移除平台运行日报 -- ------------------------------------------------------------ -- 1.1 解除会话 / 场景包 / 智能体对日报工具、技能、专家的绑定 delete from ai_session_resource where (resource_type = 'tool' and resource_key in ('platform_daily_digest', 'platform_daily_drill', 'write_daily_digest')) or (resource_type = 'skill' and resource_key = 'platform_daily_digest'); delete from ai_scenario_pack_tool where tool_code in ('platform_daily_digest', 'platform_daily_drill', 'write_daily_digest'); delete from ai_scenario_pack_skill where skill_id in (select id from ai_skill where name = 'platform_daily_digest'); delete from ai_agent_tool where tool_code in ('platform_daily_digest', 'platform_daily_drill', 'write_daily_digest') or agent_id in (select id from ai_expert_agent where agent_code = 'platform_ops'); delete from ai_agent_skill where skill_id in (select id from ai_skill where name = 'platform_daily_digest') or agent_id in (select id from ai_expert_agent where agent_code = 'platform_ops'); -- 1.2 删除专家 / 技能 / 工具元数据 delete from ai_expert_agent where agent_code = 'platform_ops'; delete from ai_skill where name = 'platform_daily_digest'; delete from ai_tool where tool_code in ('platform_daily_digest', 'platform_daily_drill', 'write_daily_digest'); -- 1.3 删除日报落库表(如无需保留历史数据) drop table if exists ai_daily_digest cascade; -- ------------------------------------------------------------ -- 2. 修正内置 MCP 客户端地址 -- ------------------------------------------------------------ -- 仅修正仍指向旧端口 8080 的内置演示连接;自定义连接不在此列。 -- 请求头(Authorization)是 AES 密文,无法用 SQL 安全写入: -- 应用启动时 McpSelfBootstrap 会检测该内置连接,并按当前出口口令自动补齐请求头。 update ai_mcp_client set url = 'http://localhost:8980/js/a/mcp', update_time = now() where server_name = 'platform_system_info' and url like '%:8080/%';