feat(ai-tools): 新增最近SQL日志探针

- 新增 inspect_recent_sql_logs 内置工具用于回看最近 SQL 执行历史
- 接入本地工具执行链,支持按成功或失败状态筛选日志
- 更新 AI 设置内置工具目录、流程说明和工具状态文案
- 完成 vitest、生产构建与预览页内置工具目录验证
This commit is contained in:
Syngnat
2026-06-08 16:10:09 +08:00
parent 0312dfbb16
commit 8a1e65640e
7 changed files with 137 additions and 1 deletions

View File

@@ -309,6 +309,33 @@ export const BUILTIN_AI_TOOL_INFO: AIBuiltinToolInfo[] = [
},
},
},
{
name: "inspect_recent_sql_logs",
icon: "🧾",
desc: "查看最近 SQL 执行日志",
detail:
"传入可选 limit 和 status返回最近 SQL 执行记录,包括数据库、耗时、成功/失败、报错、受影响行数和 SQL 文本。适合追查刚执行失败的语句、定位慢查询,并让 AI 基于真实执行历史给出解释或优化建议。",
params: "limit?, status?(all|success|error)",
tool: {
type: "function",
function: {
name: "inspect_recent_sql_logs",
description:
"获取最近 SQL 执行日志摘要,可按成功/失败过滤。适用于回看刚执行过的 SQL、排查失败原因、定位慢查询以及让 AI 基于真实执行历史给出解释和优化建议。",
parameters: {
type: "object",
properties: {
limit: { type: "number", description: "可选,返回多少条日志,默认 20最大 100" },
status: {
type: "string",
description: "可选,按执行状态过滤,支持 all、success、error默认 all",
enum: ["all", "success", "error"],
},
},
},
},
},
},
{
name: "execute_sql",
icon: "▶️",