Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(ai): surface safe companion failure diagnostics

tianma-if91f1887c332b
diff --git a/apps/api/src/companion-routes.ts b/apps/api/src/companion-routes.ts
index f2b79c5d..0b7f71b8 100644
--- a/apps/api/src/companion-routes.ts
+++ b/apps/api/src/companion-routes.ts
@@ -1,6 +1,6 @@
import { AiAttachmentSchema, CompanionDiscoveryCompleteSchema, CompanionDiscoverySettingsInputSchema, CompanionIdSchema, CompanionMemoryImportSchema, CompanionMemoryInputSchema, CompanionMemoryUpdateSchema,
CompanionToolExecuteSchema, CompanionTurnCheckpointSchema, CompanionTurnCompleteSchema,
- CompanionTurnInputSchema, CompanionTurnResumeSchema, sealCompanionProcess, type AiProvider, type CompanionEvent, type CompanionSource, type CompanionToolCall, type CompanionTurnInput } from "@edgeever/shared";
+ CompanionTurnInputSchema, CompanionTurnResumeSchema, companionFailureDiagnostics, sealCompanionProcess, type AiProvider, type CompanionEvent, type CompanionSource, type CompanionToolCall, type CompanionTurnInput } from "@edgeever/shared";
import { zValidator } from "@hono/zod-validator";
import { Hono } from "hono";
import { bodyLimit } from "hono/body-limit";
@@ -143,7 +143,7 @@ const streamCompanionTurn = (
}
const finished = await getCompanionTurn(db, scope, row.id);
if (status === "interrupted" && finished) send({ type: "done", turn: mapCompanionTurn(finished) });
- else send({ type: "error", ...companionGenerationFailure(error) });
+ else send({ type: "error", ...companionGenerationFailure(error), diagnostics: companionFailureDiagnostics(error) });
} finally {
stop.abort();
clearTimeout(timeout);
diff --git a/apps/api/src/companion-runtime.ts b/apps/api/src/companion-runtime.ts
index deb77035..e18ca220 100644
--- a/apps/api/src/companion-runtime.ts
+++ b/apps/api/src/companion-runtime.ts
@@ -1,4 +1,4 @@
-import { isStepCount, jsonSchema, tool, ToolLoopAgent, type LanguageModel, type ModelMessage } from "ai";
+import { isStepCount, jsonSchema, tool, streamText, type LanguageModel, type ModelMessage } from "ai";
import type {
AiProvider, CompanionAnswer, CompanionMemory, CompanionModelContentPart, CompanionPreparedMessage,
CompanionSource, CompanionTurnInput,
@@ -84,17 +84,19 @@ export const streamCompanion = async (args: {
]),
);
const receipts = args.input.allowNotes ? await companionExecutionReceipts(args.db, args.scope, args.input, args.revision, run.tools) : [];
- const agent = new ToolLoopAgent({
+ const generation = {
model: args.model,
instructions: companionAgentInstructions(args.input, args.memories, receipts, args.history, args.revision),
tools,
stopWhen: [isStepCount(COMPANION_MAX_STEPS), () => run.pause.ask],
maxOutputTokens: COMPANION_MAX_OUTPUT_TOKENS,
maxRetries: 0,
- });
+ onError: () => {},
+ };
const messages = await companionModelMessages({
db: args.db, scope: args.scope, input: args.input, history: args.history, revision: args.revision,
resume: args.resume, provider: args.provider ?? "openai-compatible", turnId: args.input.id,
});
- return agent.stream({ messages: toModelMessages(messages), abortSignal: args.signal });
+ // The route consumes fullStream errors and emits safe diagnostics.
+ return streamText({ ...generation, messages: toModelMessages(messages), abortSignal: args.signal });
};
diff --git a/apps/api/src/companion.test.mjs b/apps/api/src/companion.test.mjs
index abe6b529..3786c071 100644
--- a/apps/api/src/companion.test.mjs
+++ b/apps/api/src/companion.test.mjs
@@ -405,6 +405,7 @@ describe("companion HTTP contracts", () => {
})() }) });
const result = await (await request("turns", "POST", input())).text();
expect(result).not.toContain("sk-secret");
+ expect(parseEvents(result).find(event => event.type === "error").diagnostics).toEqual({ reason: "http", status: 400 });
expect(parseEvents(result).some(event => event.type === "error" && event.code === "ai_provider_request_rejected")).toBe(true);
});
test("concurrent memory change prevents final outdated output", async () => {
diff --git a/apps/web/src/components/ai-sidebar/AiSidebar.tsx b/apps/web/src/components/ai-sidebar/AiSidebar.tsx
index 47b8ab25..8f01e0fd 100644
--- a/apps/web/src/components/ai-sidebar/AiSidebar.tsx
+++ b/apps/web/src/components/ai-sidebar/AiSidebar.tsx
@@ -3,8 +3,8 @@ import { AnimatePresence } from "motion/react";
import * as m from "motion/react-m";
import { useTranslation } from "react-i18next";
import { ArrowUp, Check, ChevronDown, Download, FileText, Loader2, PanelRightClose, Plus, Search, Sparkles, X } from "lucide-react";
-import type { CompanionAction, CompanionAnswer, CompanionEvent, CompanionTurn, CompanionTurnInput } from "@edgeever/shared";
-import { buildRevisionDiffRows, createMemoLinkHref } from "@edgeever/shared";
+import type { CompanionAction, CompanionAnswer, CompanionEvent, CompanionFailureDiagnostics, CompanionTurn, CompanionTurnInput } from "@edgeever/shared";
+import { buildRevisionDiffRows, companionFailureDiagnostics, createMemoLinkHref } from "@edgeever/shared";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
@@ -791,6 +791,7 @@ function AiSidebarSession({
const [acting, setActing] = useState(false);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
+ const [turnFailures, setTurnFailures] = useState<Record<string, string>>({});
const [useMemory, setUseMemory] = useState(false);
const [includeCurrentNote, setIncludeCurrentNote] = useState(false);
const [composerFocusToken, setComposerFocusToken] = useState(0);
@@ -816,6 +817,12 @@ function AiSidebarSession({
setIncludeCurrentNote(false);
}, [memoId]);
+ const explainDiagnostics = useCallback((diagnostics?: CompanionFailureDiagnostics) => {
+ if (!diagnostics) return "";
+ const detail = t(`companion.failureDetails.${diagnostics.reason}`);
+ return diagnostics.status ? `${detail} (HTTP ${diagnostics.status})` : detail;
+ }, [t]);
+
const explainError = useCallback((cause: unknown) => {
const code = cause instanceof ApiRequestError ? cause.code : "";
if (code === "companion_attachment_unsupported") return t("aiAssistant.sidebar.attachmentUnsupported");
@@ -831,8 +838,8 @@ function AiSidebarSession({
if (code === "companion_action_unsynced") return t("companion.actions.unsynced");
if (code === "companion_busy") return t("companion.recovered");
if (cause instanceof ApiRequestError && cause.status === 403) return t("aiAssistant.sidebar.unavailable");
- return t("companion.failed");
- }, [t]);
+ return explainDiagnostics(companionFailureDiagnostics(cause)) || t("companion.failed");
+ }, [t, explainDiagnostics]);
const restoreAttachments = useCallback((snapshot: PendingAttachment[]) => {
setAttachments((current) => current.length > 0 ? current : snapshot);
@@ -1078,10 +1085,14 @@ function AiSidebarSession({
}
if (event.type === "done") setTurns((previous) => previous.map((turn) => turn.id === id ? event.turn : turn));
if (event.type === "error") {
- setError(explainError(new ApiRequestError(event.code, 500, event.code)));
+ const detail = explainDiagnostics(event.diagnostics);
+ const explanation = explainError(new ApiRequestError(event.code, 0, event.code));
+ const message = event.code === "companion_generation_failed" ? detail || explanation : [explanation, detail].filter(Boolean).join(" ");
+ setError(message);
+ setTurnFailures((previous) => ({ ...previous, [id]: message }));
if (attachmentServerCode(event.code)) restoreAttachments(attachmentSnapshot.current);
}
- }, [explainError, restoreAttachments]);
+ }, [explainError, explainDiagnostics, restoreAttachments]);
const recoverTurn = useCallback(async (id: string) => {
try {
@@ -1279,7 +1290,11 @@ function AiSidebarSession({
if (attachmentServerCode(cause instanceof ApiRequestError ? cause.code : undefined)) {
restoreAttachments(snapshot);
}
- if (alive.current && !controller.signal.aborted && !completed) setError(explainError(cause));
+ if (alive.current && !controller.signal.aborted && !completed) {
+ const message = explainError(cause);
+ setError(message);
+ setTurnFailures((previous) => ({ ...previous, [id]: message }));
+ }
} finally {
if (active.current?.id === id) active.current = null;
locked.current = false;
@@ -1417,7 +1432,11 @@ function AiSidebarSession({
},
});
} catch (cause) {
- if (alive.current && !controller.signal.aborted && !completed) setError(explainError(cause));
+ if (alive.current && !controller.signal.aborted && !completed) {
+ const message = explainError(cause);
+ setError(message);
+ setTurnFailures((previous) => ({ ...previous, [turn.id]: message }));
+ }
} finally {
if (active.current?.id === turn.id) active.current = null;
locked.current = false;
@@ -1624,7 +1643,10 @@ function AiSidebarSession({
</Button>
) : null}
{turn.status === "failed" || turn.status === "cancelled" ? (
- <p className="text-xs text-slate-500">{t(`companion.status.${turn.status}`)}</p>
+ <>
+ <p className="text-xs text-slate-500">{t(`companion.status.${turn.status}`)}</p>
+ {turn.status === "failed" && turnFailures[turn.id] ? <p className="text-xs leading-5 text-rose-700">{turnFailures[turn.id]}</p> : null}
+ </>
) : null}
{renderSelectionReply(turn.id, turn.response, turn.status)}
{renderActions(turn.id)}
diff --git a/packages/client/src/companion-direct-stream.test.mjs b/packages/client/src/companion-direct-stream.test.mjs
index 6fe65518..36898832 100644
--- a/packages/client/src/companion-direct-stream.test.mjs
+++ b/packages/client/src/companion-direct-stream.test.mjs
@@ -1,4 +1,4 @@
-import { describe, expect, test } from "bun:test";
+import { describe, expect, test, spyOn } from "bun:test";
import { createEdgeEverClient } from "./index.ts";
import { parsePreparedCompanion } from "./companion-direct-stream.ts";
@@ -142,3 +142,25 @@ describe("direct companion client", () => {
expect(events).toEqual([{ type: "text-delta", text: "proxied" }]);
});
});
+
+test("direct provider rejection includes safe diagnostics and completes the failed turn once", async () => {
+ const { streamDirectCompanion } = await import("./companion-direct-stream.ts");
+ const events = [];
+ const completed = [];
+ const log = spyOn(console, "error").mockImplementation(() => {});
+ try {
+ await streamDirectCompanion(preparedTurn, {
+ fetch: async () => new Response(JSON.stringify({ error: { message: "private-key-secret private-note", type: "invalid_request_error" } }), { status: 404, headers: { "content-type": "application/json" } }),
+ onEvent: event => events.push(event),
+ executeTool: async () => { throw new Error("must not execute tools"); },
+ checkpoint: async () => { throw new Error("must not checkpoint"); },
+ complete: async body => { completed.push(body); return { turn: { ...preparedTurn.turn, ...body } }; },
+ });
+ expect(completed).toHaveLength(1);
+ expect(completed[0].status).toBe("failed");
+ expect(events.at(-1)).toEqual({ type: "error", code: "companion_generation_failed", diagnostics: { reason: "http", status: 404 } });
+ expect(JSON.stringify(events)).not.toContain("private-key-secret");
+ expect(JSON.stringify(events)).not.toContain("private-note");
+ expect(log).not.toHaveBeenCalled();
+ } finally { log.mockRestore(); }
+});
diff --git a/packages/client/src/companion-direct-stream.ts b/packages/client/src/companion-direct-stream.ts
index 61b17276..090a581a 100644
--- a/packages/client/src/companion-direct-stream.ts
+++ b/packages/client/src/companion-direct-stream.ts
@@ -11,7 +11,7 @@ import type {
CompanionTurnCompleteInput,
} from "@edgeever/shared";
import type { ModelMessage } from "ai";
-import { sealCompanionProcess } from "@edgeever/shared";
+import { companionFailureDiagnostics, sealCompanionProcess } from "@edgeever/shared";
import { isAiCorsFailure } from "./ai-direct-stream";
import { createClientAiModel } from "./ai-model";
@@ -135,7 +135,7 @@ export const streamDirectCompanion = async (
complete: (body: CompanionTurnCompleteInput) => Promise<{ turn: CompanionTurn }>;
},
) => {
- const { ToolLoopAgent, isStepCount, jsonSchema, tool } = await import("ai");
+ const { streamText, isStepCount, jsonSchema, tool } = await import("ai");
let response = prepared.turn.response ?? "";
let process = prepared.turn.process ?? "";
let persisted = response.length;
@@ -160,10 +160,10 @@ export const streamDirectCompanion = async (
const completed = await options.complete({
response, process, status, inputTokens: usage?.inputTokens, outputTokens: usage?.outputTokens,
});
- if (status === "failed" && error) options.onEvent({ type: "error", code: companionDirectFailureCode(error) });
+ if (status === "failed" && error) options.onEvent({ type: "error", code: companionDirectFailureCode(error), diagnostics: companionFailureDiagnostics(error) });
else options.onEvent({ type: "done", turn: completed.turn });
} catch (completeError) {
- options.onEvent({ type: "error", code: companionDirectFailureCode(completeError) });
+ options.onEvent({ type: "error", code: companionDirectFailureCode(completeError), diagnostics: companionFailureDiagnostics(completeError) });
}
};
@@ -196,7 +196,7 @@ export const streamDirectCompanion = async (
}),
]));
- const agent = new ToolLoopAgent({
+ const generation = {
model: createClientAiModel({
provider: prepared.provider,
baseUrl: prepared.baseUrl,
@@ -209,7 +209,9 @@ export const streamDirectCompanion = async (
stopWhen: [isStepCount(prepared.maxSteps), () => pause.ask],
maxOutputTokens: prepared.maxOutputTokens,
maxRetries: 0,
- });
+ // fullStream errors are handled below; SDK logging can expose request data.
+ onError: () => {},
+ };
const messages: ModelMessage[] = prepared.messages.map((message) => {
if (message.role === "assistant") {
if (typeof message.content !== "string") throw new Error("Assistant content must be a string.");
@@ -225,7 +227,8 @@ export const streamDirectCompanion = async (
}),
};
});
- const result = await agent.stream({
+ const result = streamText({
+ ...generation,
messages,
abortSignal: options.signal,
});
diff --git a/packages/shared/src/companion-failure.test.mjs b/packages/shared/src/companion-failure.test.mjs
new file mode 100644
index 00000000..4d5f4130
--- /dev/null
+++ b/packages/shared/src/companion-failure.test.mjs
@@ -0,0 +1,32 @@
+import { expect, test } from "bun:test";
+import { companionFailureDiagnostics } from "./companion.ts";
+
+test("diagnostics expose only fixed categories and valid HTTP status", () => {
+ const error = Object.assign(new Error("secret request and response"), {
+ statusCode: 404, responseBody: "api-key-secret", requestBodyValues: { prompt: "private note" },
+ url: "https://provider.example?key=secret",
+ });
+ expect(companionFailureDiagnostics(error)).toEqual({ reason: "http", status: 404 });
+ expect(companionFailureDiagnostics(new Error("provider-secret"))).toBeUndefined();
+ for (const status of [200, 400.5, 600, NaN, "401"]) {
+ expect(companionFailureDiagnostics({ status })).toBeUndefined();
+ }
+});
+
+test("distinguishes stream validation, network, empty output, and output limit", () => {
+ for (const name of ["AI_InvalidResponseDataError", "AI_JSONParseError", "AI_TypeValidationError"]) {
+ expect(companionFailureDiagnostics({ name, message: "secret" })).toEqual({ reason: "invalidResponse" });
+ }
+ expect(companionFailureDiagnostics(new TypeError("Failed to fetch"))).toEqual({ reason: "network" });
+ expect(companionFailureDiagnostics(new TypeError("Cannot read property"))).toBeUndefined();
+ expect(companionFailureDiagnostics(new Error("No text returned."))).toEqual({ reason: "emptyResponse" });
+ expect(companionFailureDiagnostics(new Error("Response limit exceeded."))).toEqual({ reason: "responseLimit" });
+});
+
+
+test("classifies wrapped network errors without exposing cause data or looping", () => {
+ expect(companionFailureDiagnostics({ name: "AI_APICallError", cause: new TypeError("fetch failed") })).toEqual({ reason: "network" });
+ expect(companionFailureDiagnostics(new Error("net::ERR_CONNECTION_REFUSED"))).toEqual({ reason: "network" });
+ const circular = { message: "secret" }; circular.cause = circular;
+ expect(companionFailureDiagnostics(circular)).toBeUndefined();
+});
diff --git a/packages/shared/src/companion.ts b/packages/shared/src/companion.ts
index c74f75fa..f663cf9c 100644
--- a/packages/shared/src/companion.ts
+++ b/packages/shared/src/companion.ts
@@ -352,7 +352,7 @@ export type CompanionEvent =
| { type: "process"; text: string }
| { type: "tools"; tools: CompanionToolCall[]; todos: CompanionTodo[]; questions: CompanionQuestion[] }
| { type: "done"; turn: CompanionTurn }
- | { type: "error"; code: string };
+ | { type: "error"; code: string; diagnostics?: CompanionFailureDiagnostics };
export const sealCompanionProcess = (process: string, response: string) => ({
process: [process.trim(), response.trim()].filter(Boolean).join("\n\n"),
@@ -371,3 +371,28 @@ export const CompanionMemoryImportSchema = z.object({
memories: z.array(z.object({ content: z.string().trim().min(1).max(500), kind: z.enum(["explicit", "inferred"]).optional() })).max(50),
controls: z.object({ useMemory: z.boolean(), learningEnabled: z.boolean() }).optional(),
}).strict();
+
+/** Only fixed categories and HTTP status cross the UI boundary. Never forward SDK
+ * messages, request bodies, response bodies, URLs, headers, or credentials. */
+export type CompanionFailureDiagnostics = {
+ reason: "http" | "network" | "invalidResponse" | "emptyResponse" | "responseLimit";
+ status?: number;
+};
+
+export const companionFailureDiagnostics = (error: unknown, depth = 0): CompanionFailureDiagnostics | undefined => {
+ if (!error || typeof error !== "object" || depth >= 3) return undefined;
+ const record = error as { statusCode?: unknown; status?: unknown; name?: unknown; message?: unknown; cause?: unknown };
+ const status = record.statusCode ?? record.status;
+ if (typeof status === "number" && Number.isInteger(status) && status >= 400 && status <= 599) {
+ return { reason: "http", status };
+ }
+ if (record.name === "AI_InvalidResponseDataError" || record.name === "AI_JSONParseError"
+ || record.name === "AI_TypeValidationError") return { reason: "invalidResponse" };
+ if (record.name === "AI_NoOutputGeneratedError" || record.message === "No text returned.") return { reason: "emptyResponse" };
+ if (record.message === "Response limit exceeded.") return { reason: "responseLimit" };
+ if (typeof record.message === "string" && (
+ (record.name === "TypeError" && /fetch|network|cors/i.test(record.message))
+ || /^(?:fetch failed|failed to fetch|net::ERR_[A-Z_]+)(?:$|\b)/i.test(record.message)
+ )) return { reason: "network" };
+ return companionFailureDiagnostics(record.cause, depth + 1);
+};
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index ac5a216f..049ed4db 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -361,6 +361,13 @@ export const enUS = {
"providerPaymentRequired": "The model provider reported insufficient credit. Check the account balance and try again.",
"providerRateLimited": "The model provider rate-limited this request. Wait a moment and try again.",
"providerRequestRejected": "The default model rejected this request. Confirm it supports tool calling, or choose a different default model.",
+ "failureDetails": {
+ "http": "The request was rejected. Check the provider URL, model ID, and supported request features.",
+ "network": "The model provider could not be reached. Check your network, proxy, and provider URL.",
+ "invalidResponse": "The provider returned an incompatible response. Check the selected API protocol and streaming support.",
+ "emptyResponse": "The model returned no text or completed tool calls.",
+ "responseLimit": "The model response exceeded the conversation limit.",
+ },
"conflict": "A memory was changed elsewhere or the 50-memory limit was reached. Refresh and try again.",
"historyFull": "Chats and discoveries reached the combined 500-record limit. Export and clear history before continuing.",
"unavailable": "Preview requires a signed-in personal account on a non-demo instance.",
diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.ts
index 1c9fc123..dd6f1b25 100644
--- a/packages/shared/src/i18n/ja.ts
+++ b/packages/shared/src/i18n/ja.ts
@@ -350,6 +350,13 @@ export const ja = {
"providerPaymentRequired": "モデル提供元が残高不足を返しました。残高を確認してから再試行してください。",
"providerRateLimited": "モデル提供元がレート制限しています。しばらく待ってから再試行してください。",
"providerRequestRejected": "デフォルトモデルがこのリクエストを拒否しました。ツール呼び出しに対応しているか確認するか、別のデフォルトモデルを選んでください。",
+ "failureDetails": {
+ "http": "リクエストが拒否されました。提供元のURL、モデルID、対応機能を確認してください。",
+ "network": "モデル提供元に接続できません。ネットワーク、プロキシ、URLを確認してください。",
+ "invalidResponse": "応答形式に互換性がありません。APIプロトコルとストリーミング対応を確認してください。",
+ "emptyResponse": "モデルはテキストも完了したツール呼び出しも返しませんでした。",
+ "responseLimit": "モデルの応答が会話の長さ制限を超えました。",
+ },
"conflict": "記憶が他で変更されたか、50 件の上限に達しました。更新してから再試行してください。",
"historyFull": "チャットと発見の合計が 500 件の上限に達しました。続ける前にエクスポートして履歴を消去してください。",
"unavailable": "プレビューは、非デモインスタンスにサインインした個人アカウントでのみ利用できます。",
diff --git a/packages/shared/src/i18n/pl.ts b/packages/shared/src/i18n/pl.ts
index 1297ba9c..7892e972 100644
--- a/packages/shared/src/i18n/pl.ts
+++ b/packages/shared/src/i18n/pl.ts
@@ -350,6 +350,13 @@ export const pl = {
"providerPaymentRequired": "Dostawca modelu zgłosił brak wystarczających środków. Sprawdź saldo konta i spróbuj ponownie.",
"providerRateLimited": "Dostawca modelu ograniczył liczbę żądań. Odczekaj chwilę i spróbuj ponownie.",
"providerRequestRejected": "Domyślny model odrzucił to żądanie. Upewnij się, że obsługuje wywoływanie narzędzi, lub wybierz inny model domyślny.",
+ "failureDetails": {
+ "http": "Żądanie zostało odrzucone. Sprawdź adres dostawcy, identyfikator modelu i obsługiwane funkcje.",
+ "network": "Nie można połączyć się z dostawcą modelu. Sprawdź sieć, proxy i adres dostawcy.",
+ "invalidResponse": "Dostawca zwrócił niezgodną odpowiedź. Sprawdź protokół API i obsługę strumieniowania.",
+ "emptyResponse": "Model nie zwrócił tekstu ani ukończonych wywołań narzędzi.",
+ "responseLimit": "Odpowiedź modelu przekroczyła limit długości rozmowy.",
+ },
"conflict": "Wspomnienie zostało zmienione w innym miejscu lub osiągnięto limit 50 wspomnień. Odśwież i spróbuj ponownie.",
"historyFull": "Rozmowy i odkrycia osiągnęły łączny limit 500 zapisów. Przed kontynuowaniem wyeksportuj i wyczyść historię.",
"unavailable": "Wersja zapoznawcza wymaga zalogowania na konto osobiste w instancji innej niż demo.",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index 5102d2dd..7164c18d 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -361,6 +361,13 @@ export const zhCN = {
"providerPaymentRequired": "模型服务商返回额度不足,请检查账户余额后重试。",
"providerRateLimited": "模型服务商限流,请稍后再试。",
"providerRequestRejected": "默认模型拒绝了这次请求。请确认该模型支持工具调用,或更换默认模型。",
+ "failureDetails": {
+ "http": "请求被拒绝,请检查服务商地址、模型 ID 和请求功能支持。",
+ "network": "无法连接模型服务商,请检查网络、代理和服务商地址。",
+ "invalidResponse": "服务商返回了不兼容的响应,请检查所选 API 协议及流式响应支持。",
+ "emptyResponse": "模型未返回文本,也没有完成工具调用。",
+ "responseLimit": "模型响应超过了对话长度限制。",
+ },
"conflict": "记忆已被其他操作修改,或超过 50 条上限。请刷新后再试。",
"historyFull": "聊天与发现已达到合计 500 条历史上限,请先导出并清空历史。",
"unavailable": "预览功能仅对非演示实例中已登录的个人账户开放。",