-- ============================================================================ -- 移除平台内置无用工具:get_current_time / get_current_user / ai_usage_by_agent / get_current_workspace -- -- 背景: -- 1) 当前时间已由 CurrentTimeMiddleware 每轮注入 system prompt(分钟精度), -- 不再需要模型调用工具查时间; -- 2) 提问用户身份由平台运行期上下文提供,业务分析工具不依赖该工具; -- 3) 「按智能体用量」工具及其专属 IPlatformUsageService / PlatformUsageMapper 一并下线; -- 4) get_current_workspace(WorkspaceInfoTool)随工作空间信息工具整体下线。 -- -- 幂等:可重复执行。 -- ============================================================================ -- 一、清理引用(先清引用,再删注册行) delete from ai_scenario_pack_tool where tool_code in ('get_current_time', 'get_current_user', 'ai_usage_by_agent', 'get_current_workspace'); delete from ai_agent_tool where tool_code in ('get_current_time', 'get_current_user', 'ai_usage_by_agent', 'get_current_workspace'); delete from ai_agent_tool_trust where tool_code in ('get_current_time', 'get_current_user', 'ai_usage_by_agent', 'get_current_workspace'); delete from ai_session_resource where resource_type = 'tool' and resource_id in (select id from ai_tool where tool_code in ('get_current_time', 'get_current_user', 'ai_usage_by_agent', 'get_current_workspace')); delete from ai_tool_tag_rel where tool_id in (select id from ai_tool where tool_code in ('get_current_time', 'get_current_user', 'ai_usage_by_agent', 'get_current_workspace')); -- 二、删除工具注册行 delete from ai_tool where tool_code in ('get_current_time', 'get_current_user', 'ai_usage_by_agent', 'get_current_workspace'); -- 三、修正入口 / 专家提示词中「调用 get_current_time / get_current_user」的旧指引 -- (仅命中旧文案时替换;提示词已被人工改过则保持原样) update ai_entry_agent set sys_prompt = replace(sys_prompt, '5. 涉及今天、本周、距今多久等时间语义时,可调用 get_current_time 获取精确时间;需要判断当前是谁在问时,可用 get_current_user 或 get_current_dept。', '5. 涉及今天、本周、距今多久等时间语义时,直接使用 system prompt 末尾「当前时间」段落给出的时间,不要凭猜测判断,也不需要调用工具查询时间。') where sys_prompt like '%get_current_time%'; update ai_expert_agent set sys_prompt = replace(sys_prompt, '5. 涉及今天、本周、距今多久等时间语义时,可调用 get_current_time 获取精确时间;需要判断当前是谁在问时,可用 get_current_user 或 get_current_dept。', '5. 涉及今天、本周、距今多久等时间语义时,直接使用 system prompt 末尾「当前时间」段落给出的时间,不要凭猜测判断,也不需要调用工具查询时间。') where sys_prompt like '%get_current_time%';