fix(ai): 测试连接改为结构化结果,不再倾倒模型原始回复
CI / Backend (go vet + test) (push) Canceled after 0s
CI / Frontend (lint + build + test) (push) Canceled after 0s

返回 {model, latencyMs, tokensUsed, replyLength};前端提示「连接正常:模型 · 耗时 · tokens」。
模型原始回复不回传——测试要的是通没通/多快,不是看模型说了什么(ECHO 假模型下尤其明显)。
空回复时明确报错提示检查 baseURL 是否 OpenAI 兼容。
This commit is contained in:
opsx committed 2026-11-01 00:21:59 +08:00
1 parent f1d9480caf
commit 5d898e3592
6 files changed
+30 -11

No files matched your search

+1 -1
View File
@@ -83,7 +83,7 @@ export const aiApi = {
getConfig: () => http.get<AIConfigResponse>('/ai/config'),
saveConfig: (data: Partial<AIConfig>) => http.put<{ config: AIConfig }>('/ai/config', data),
testConfig: (data: { baseUrl?: string; model?: string; apiKey?: string }) =>
http.post<{ reply: string; model: string }>('/ai/config/test', data, { timeout: 45000 }),
http.post<{ model: string; latencyMs: number; tokensUsed: number; replyLength: number }>('/ai/config/test', data, { timeout: 45000 }),
analyze: (data: { sourceId: number; start: number; end: number; question?: string; app?: string }) =>
http.post<AIAnalyzeResponse>('/ai/analyze', data, { timeout: 180000 }),
runs: (page: number, pageSize: number) =>