ai_workbench_fix_20261117.sql 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. -- ============================================================
  2. -- 智能工作台修复脚本(2026-11-17)
  3. --
  4. -- 适用场景:已经初始化过 ai_orchestration*.sql 的环境。
  5. -- 内容:
  6. -- 1) 完整移除「平台运行日报」能力(工具 / 技能 / 平台运维助手 / 日报表)
  7. -- 2) 修正内置 MCP 客户端 platform_system_info 的自连地址(8080 → 当前后端 8980)
  8. --
  9. -- 幂等:可重复执行;执行前请确认 ai_daily_digest 中无需要保留的历史数据。
  10. -- ============================================================
  11. -- ------------------------------------------------------------
  12. -- 1. 移除平台运行日报
  13. -- ------------------------------------------------------------
  14. -- 1.1 解除会话 / 场景包 / 智能体对日报工具、技能、专家的绑定
  15. delete from ai_session_resource
  16. where (resource_type = 'tool' and resource_key in ('platform_daily_digest', 'platform_daily_drill', 'write_daily_digest'))
  17. or (resource_type = 'skill' and resource_key = 'platform_daily_digest');
  18. delete from ai_scenario_pack_tool
  19. where tool_code in ('platform_daily_digest', 'platform_daily_drill', 'write_daily_digest');
  20. delete from ai_scenario_pack_skill
  21. where skill_id in (select id from ai_skill where name = 'platform_daily_digest');
  22. delete from ai_agent_tool
  23. where tool_code in ('platform_daily_digest', 'platform_daily_drill', 'write_daily_digest')
  24. or agent_id in (select id from ai_expert_agent where agent_code = 'platform_ops');
  25. delete from ai_agent_skill
  26. where skill_id in (select id from ai_skill where name = 'platform_daily_digest')
  27. or agent_id in (select id from ai_expert_agent where agent_code = 'platform_ops');
  28. -- 1.2 删除专家 / 技能 / 工具元数据
  29. delete from ai_expert_agent where agent_code = 'platform_ops';
  30. delete from ai_skill where name = 'platform_daily_digest';
  31. delete from ai_tool where tool_code in ('platform_daily_digest', 'platform_daily_drill', 'write_daily_digest');
  32. -- 1.3 删除日报落库表(如无需保留历史数据)
  33. drop table if exists ai_daily_digest cascade;
  34. -- ------------------------------------------------------------
  35. -- 2. 修正内置 MCP 客户端地址
  36. -- ------------------------------------------------------------
  37. -- 仅修正仍指向旧端口 8080 的内置演示连接;自定义连接不在此列。
  38. update ai_mcp_client
  39. set url = 'http://localhost:8980/js/a/mcp',
  40. update_time = now()
  41. where server_name = 'platform_system_info'
  42. and url like '%:8080/%';