feat(ai): 阶段 2 Ask|Agent 共用 aitools Runtime 真查库

- 侧栏 Ask|Agent 分段;Ask 仍走 /api/ai/chat,Agent 走 /api/ai/agent
- RunAgent 多轮 tool call → 进程内 aitools(与 MCP 同源只读/白名单/审计)
- 回复下步骤时间线;openai-chat tools(DeepSeek);agent-accept 冒烟
This commit is contained in:
logan committed 2026-10-15 11:51:39 +08:00
1 parent b8134c4503
commit cd319ce7bd
14 files changed
+1270 -182

No files matched your search

+27
View File
@@ -525,6 +525,33 @@ export async function callAi(payload: {
return post<{ content: string; sql?: string }>("/api/ai/chat", payload);
}
/** 阶段 2:Agent 模式 — 服务端多轮调同一 aitools Runtime(Ask 仍用 callAi) */
export type AiAgentStep = {
tool: string;
args?: string;
ok: boolean;
summary: string;
error?: string;
ms: number;
};
export type AiAgentRes = {
content: string;
sql?: string;
steps: AiAgentStep[];
rounds: number;
};
export async function callAiAgent(payload: {
prompt: string;
connectionId?: string;
driver?: string;
database?: string;
model?: string;
}) {
return post<AiAgentRes>("/api/ai/agent", payload);
}
/** C4:AI 配置(key 脱敏,只回掩码与是否已配置);protocol/authStyle/allowInsecureHttp 见 aiPresets.ts */
export type AiConfig = {
provider: string;