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): keep Agent tool schemas compatible with OpenAI-style calling

tianma-iffc4a94be4447
diff --git a/apps/api/src/ai-runtime.test.mjs b/apps/api/src/ai-runtime.test.mjs
index c8c64867..f058c065 100644
--- a/apps/api/src/ai-runtime.test.mjs
+++ b/apps/api/src/ai-runtime.test.mjs
@@ -1,5 +1,15 @@
import { describe, expect, test } from "bun:test";
-import { parseAiTagSuggestionNames } from "./ai-runtime.ts";
+import { openaiCompatibleHeaders, parseAiTagSuggestionNames } from "./ai-runtime.ts";
+
+describe("OpenAI-compatible provider headers", () => {
+ test("identifies OpenRouter so rankings and tool routes stay attributed", () => {
+ expect(openaiCompatibleHeaders("https://openrouter.ai/api/v1")).toEqual({
+ "HTTP-Referer": "https://edgeever.org",
+ "X-Title": "EdgeEver",
+ });
+ expect(openaiCompatibleHeaders("https://api.openai.com/v1")).toBeUndefined();
+ });
+});
describe("AI tag response parsing", () => {
test("parses the requested suggestions object", () => {
diff --git a/apps/api/src/ai-runtime.ts b/apps/api/src/ai-runtime.ts
index 9b691e94..8396082e 100644
--- a/apps/api/src/ai-runtime.ts
+++ b/apps/api/src/ai-runtime.ts
@@ -4,6 +4,17 @@ import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { MAX_AI_TAG_SUGGESTIONS, type AiProvider } from "@edgeever/shared";
import { generateText, streamText } from "ai";
+export const openaiCompatibleHeaders = (baseUrl: string) => {
+ try {
+ const host = new URL(baseUrl).hostname.toLowerCase();
+ if (host === "openrouter.ai" || host.endsWith(".openrouter.ai")) {
+ return { "HTTP-Referer": "https://edgeever.org", "X-Title": "EdgeEver" };
+ }
+ } catch {
+ // Invalid URLs are rejected by the provider factory.
+ }
+};
+
export const createAiModel = (config: {
provider: AiProvider;
baseUrl: string;
@@ -21,6 +32,7 @@ export const createAiModel = (config: {
baseURL: config.baseUrl,
apiKey: config.apiKey,
includeUsage: true,
+ headers: openaiCompatibleHeaders(config.baseUrl),
})(config.modelId);
}
};
diff --git a/apps/api/src/companion-routes.ts b/apps/api/src/companion-routes.ts
index b8220433..77febb01 100644
--- a/apps/api/src/companion-routes.ts
+++ b/apps/api/src/companion-routes.ts
@@ -23,6 +23,21 @@ const fail = (c: AppContext, error: unknown) => {
return apiError(c, "companion_failed", "The companion is unavailable. Please retry later.", 503);
};
+const asRecord = (value: unknown): Record<string, unknown> | null =>
+ value && typeof value === "object" ? value as Record<string, unknown> : null;
+
+export const companionGenerationFailure = (error: unknown): { code: string } => {
+ if (error instanceof AppError) return { code: error.code };
+ const record = asRecord(error);
+ const status = typeof record?.statusCode === "number" ? record.statusCode
+ : typeof record?.status === "number" ? record.status : undefined;
+ if (status === 401 || status === 403) return { code: "ai_credentials_rejected" };
+ if (status === 402) return { code: "ai_provider_payment_required" };
+ if (status === 429) return { code: "ai_provider_rate_limited" };
+ if (status === 400) return { code: "ai_provider_request_rejected" };
+ return { code: "companion_generation_failed" };
+};
+
const streamCompanionTurn = (
c: AppContext,
dependencies: { stream?: typeof streamCompanion },
@@ -117,7 +132,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", code: error instanceof AppError ? error.code : "companion_generation_failed" });
+ else send({ type: "error", ...companionGenerationFailure(error) });
} finally {
stop.abort();
clearTimeout(timeout);
diff --git a/apps/api/src/companion-tool-catalog.ts b/apps/api/src/companion-tool-catalog.ts
index 5422b2d1..4c5559e7 100644
--- a/apps/api/src/companion-tool-catalog.ts
+++ b/apps/api/src/companion-tool-catalog.ts
@@ -16,7 +16,29 @@ const allowed = new Set([
"use_note_template", "list_ai_instructions", "get_ai_instruction", "create_ai_instruction", "update_ai_instruction",
"delete_ai_instruction", "restore_default_ai_instructions",
]);
+
+const OPENAI_INCOMPATIBLE_SCHEMA_KEYS = ["oneOf", "anyOf", "allOf", "const"] as const;
+
+export function assertOpenAiCompatibleToolSchema(schema: unknown, toolName: string) {
+ const visit = (value: unknown, path: string) => {
+ if (!value || typeof value !== "object") return;
+ if (Array.isArray(value)) {
+ value.forEach((item, index) => visit(item, `${path}[${index}]`));
+ return;
+ }
+ const record = value as Record<string, unknown>;
+ for (const keyword of OPENAI_INCOMPATIBLE_SCHEMA_KEYS) {
+ if (keyword in record) {
+ throw new Error(`${toolName} ${path} uses ${keyword}, which OpenAI-compatible tool calling rejects.`);
+ }
+ }
+ for (const [key, child] of Object.entries(record)) visit(child, `${path}.${key}`);
+ };
+ visit(schema, "inputSchema");
+}
+
export const COMPANION_MCP_TOOLS = MCP_TOOLS.filter(tool => allowed.has(tool.name));
+for (const tool of COMPANION_MCP_TOOLS) assertOpenAiCompatibleToolSchema(tool.inputSchema, tool.name);
const validators = new Map<string, z.ZodType>();
export function validateCompanionTool(name: string, args: Record<string, unknown>) {
const definition = COMPANION_MCP_TOOLS.find(tool => tool.name === name);
diff --git a/apps/api/src/companion.test.mjs b/apps/api/src/companion.test.mjs
index bc16711f..ed1c4bd3 100644
--- a/apps/api/src/companion.test.mjs
+++ b/apps/api/src/companion.test.mjs
@@ -352,8 +352,19 @@ describe("companion HTTP contracts", () => {
const payload = input();
const result = await (await request("turns", "POST", payload)).text();
expect(result).not.toContain("provider-secret");
+ expect(parseEvents(result).some(event => event.type === "error" && event.code === "companion_generation_failed")).toBe(true);
expect((await getCompanionTurn(db, scope, payload.id))).toMatchObject({ status: "failed", response: "partial response" });
});
+ test("maps provider HTTP 400 without leaking the response body", async () => {
+ const { request } = fixture({ stream: async () => ({ totalUsage: Promise.resolve({}), fullStream: (async function* () {
+ const error = new Error("Invalid schema sk-secret");
+ error.statusCode = 400;
+ throw error;
+ })() }) });
+ const result = await (await request("turns", "POST", input())).text();
+ expect(result).not.toContain("sk-secret");
+ 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 () => {
const { request, db } = fixture({ stream: async () => ({ totalUsage: Promise.resolve({}), fullStream: (async function* () {
yield { type: "text-delta", text: "a".repeat(300) };
diff --git a/apps/api/src/mcp-tool-service.ts b/apps/api/src/mcp-tool-service.ts
index f0cc4e85..76e2b38c 100644
--- a/apps/api/src/mcp-tool-service.ts
+++ b/apps/api/src/mcp-tool-service.ts
@@ -451,8 +451,8 @@ const applyDiagramOperations = async (
const index = findNodeIndex(nodeId);
const previous = nodes[index];
const candidate: Record<string, unknown> = { ...previous, ...operation.changes, id: nodeId };
- if (operation.changes.parentId === null) delete candidate.parentId;
- if (operation.changes.resourceIcon === null) delete candidate.resourceIcon;
+ if (operation.changes.parentId === null || operation.changes.parentId === "") delete candidate.parentId;
+ if (operation.changes.resourceIcon === null || operation.changes.resourceIcon === "") delete candidate.resourceIcon;
const next = parseDiagramNode(candidate, operationIndex);
nodes[index] = next;
if (operation.changes.label !== undefined || operation.changes.type !== undefined) resizedNodeIds.add(nodeId);
@@ -514,8 +514,8 @@ const applyDiagramOperations = async (
const index = findEdgeIndex(edgeId);
const candidate: Record<string, unknown> = { ...edges[index], ...operation.changes };
delete candidate.id;
- if (operation.changes.label === null) delete candidate.label;
- if (operation.changes.type === null) delete candidate.type;
+ if (operation.changes.label === null || operation.changes.label === "") delete candidate.label;
+ if (operation.changes.type === null || operation.changes.type === "") delete candidate.type;
if (operation.changes.bidirectional === null) delete candidate.bidirectional;
edges[index] = { id: edgeId, ...parseDiagramEdge(candidate, operationIndex) };
counts.updatedEdges += 1;
diff --git a/apps/api/src/mcp-tools.test.mjs b/apps/api/src/mcp-tools.test.mjs
index 65465ea7..86cffe8b 100644
--- a/apps/api/src/mcp-tools.test.mjs
+++ b/apps/api/src/mcp-tools.test.mjs
@@ -1,5 +1,6 @@
import { describe, expect, test } from "bun:test";
import { MCP_TOOLS } from "./mcp-tools";
+import { assertOpenAiCompatibleToolSchema, COMPANION_MCP_TOOLS } from "./companion-tool-catalog";
describe("MCP tool catalog", () => {
test("keeps tool names unique and schemas object-shaped", () => {
@@ -14,6 +15,19 @@ describe("MCP tool catalog", () => {
}
});
+ test("keeps Agent tool JSON schemas compatible with OpenAI-style function calling", () => {
+ expect(COMPANION_MCP_TOOLS.length).toBeGreaterThan(20);
+ expect(() => assertOpenAiCompatibleToolSchema({ type: "object", oneOf: [] }, "bad_tool"))
+ .toThrow(/oneOf/);
+ expect(() => assertOpenAiCompatibleToolSchema({ type: "object", anyOf: [] }, "bad_tool"))
+ .toThrow(/anyOf/);
+ expect(() => assertOpenAiCompatibleToolSchema({ properties: { op: { const: "add_node" } } }, "bad_tool"))
+ .toThrow(/const/);
+ for (const tool of COMPANION_MCP_TOOLS) {
+ expect(() => assertOpenAiCompatibleToolSchema(tool.inputSchema, tool.name)).not.toThrow();
+ }
+ });
+
test("marks reads and destructive writes consistently", () => {
const byName = new Map(MCP_TOOLS.map((tool) => [tool.name, tool]));
@@ -68,8 +82,22 @@ describe("MCP tool catalog", () => {
});
expect(byName.get("update_diagram")?.inputSchema).toMatchObject({
required: ["memoId", "expectedRevision", "operations"],
- properties: { operations: { minItems: 1, maxItems: 100 } },
+ properties: {
+ operations: {
+ minItems: 1,
+ maxItems: 100,
+ items: {
+ type: "object",
+ required: ["op"],
+ properties: {
+ op: { enum: ["add_node", "update_node", "remove_node", "add_edge", "update_edge", "remove_edge"] },
+ },
+ },
+ },
+ },
});
+ expect(byName.get("update_diagram")?.inputSchema.properties.operations.items.oneOf).toBeUndefined();
+ expect(byName.get("update_diagram")?.inputSchema.properties.operations.items.properties.op.const).toBeUndefined();
expect(byName.get("rename_notebook")?.annotations).toMatchObject({
readOnlyHint: false,
destructiveHint: false,
diff --git a/apps/api/src/mcp-tools.ts b/apps/api/src/mcp-tools.ts
index f1d4ef43..d82ebc62 100644
--- a/apps/api/src/mcp-tools.ts
+++ b/apps/api/src/mcp-tools.ts
@@ -18,6 +18,35 @@ const DIAGRAM_IR_NODE_TYPES = [
"boundary",
] as const;
+const diagramNodeProperties = {
+ id: { type: "string", minLength: 1, maxLength: 100 },
+ label: { type: "string", maxLength: 500 },
+ type: { type: "string", enum: [...DIAGRAM_IR_NODE_TYPES] },
+ parentId: { type: "string", minLength: 1, maxLength: 100 },
+ resourceIcon: { type: "string", enum: [...ARCHITECTURE_RESOURCE_ICONS] },
+};
+
+const diagramNodeSchema = {
+ type: "object",
+ required: ["id", "label"],
+ additionalProperties: false,
+ properties: diagramNodeProperties,
+};
+
+const diagramEdgeSchema = {
+ type: "object",
+ required: ["source", "target"],
+ additionalProperties: false,
+ properties: {
+ id: { type: "string", minLength: 1, maxLength: 100 },
+ source: { type: "string", minLength: 1, maxLength: 100 },
+ target: { type: "string", minLength: 1, maxLength: 100 },
+ label: { type: "string", maxLength: 500 },
+ type: { type: "string", enum: ["dependency", "request", "async", "data"] },
+ bidirectional: { type: "boolean" },
+ },
+};
+
const MCP_TOOL_DEFINITIONS = [
{
name: "get_current_user",
@@ -120,34 +149,12 @@ const MCP_TOOL_DEFINITIONS = [
type: "array",
minItems: 1,
maxItems: 200,
- items: {
- type: "object",
- required: ["id", "label"],
- additionalProperties: false,
- properties: {
- id: { type: "string", minLength: 1, maxLength: 100 },
- label: { type: "string", maxLength: 500 },
- type: { type: "string", enum: [...DIAGRAM_IR_NODE_TYPES] },
- parentId: { type: "string", minLength: 1, maxLength: 100 },
- resourceIcon: { type: "string", enum: [...ARCHITECTURE_RESOURCE_ICONS] },
- },
- },
+ items: diagramNodeSchema,
},
edges: {
type: "array",
maxItems: 400,
- items: {
- type: "object",
- required: ["source", "target"],
- additionalProperties: false,
- properties: {
- source: { type: "string", minLength: 1, maxLength: 100 },
- target: { type: "string", minLength: 1, maxLength: 100 },
- label: { type: "string", maxLength: 500 },
- type: { type: "string", enum: ["dependency", "request", "async", "data"] },
- bidirectional: { type: "boolean" },
- },
- },
+ items: diagramEdgeSchema,
},
},
},
@@ -184,76 +191,33 @@ const MCP_TOOL_DEFINITIONS = [
minItems: 1,
maxItems: 100,
items: {
- oneOf: [
- {
- type: "object", required: ["op", "node"], additionalProperties: false,
- properties: {
- op: { const: "add_node" },
- node: {
- type: "object", required: ["id", "label"], additionalProperties: false,
- properties: {
- id: { type: "string", minLength: 1, maxLength: 100 },
- label: { type: "string", maxLength: 500 },
- type: { type: "string", enum: [...DIAGRAM_IR_NODE_TYPES] },
- parentId: { type: "string", minLength: 1, maxLength: 100 },
- resourceIcon: { type: "string", enum: [...ARCHITECTURE_RESOURCE_ICONS] },
- },
- },
- },
- },
- {
- type: "object", required: ["op", "nodeId", "changes"], additionalProperties: false,
- properties: {
- op: { const: "update_node" }, nodeId: { type: "string", minLength: 1 },
- changes: {
- type: "object", minProperties: 1, additionalProperties: false,
- properties: {
- label: { type: "string", maxLength: 500 },
- type: { type: "string", enum: [...DIAGRAM_IR_NODE_TYPES] },
- parentId: { type: ["string", "null"], maxLength: 100 },
- resourceIcon: { type: ["string", "null"], enum: [...ARCHITECTURE_RESOURCE_ICONS, null] },
- },
- },
- },
- },
- {
- type: "object", required: ["op", "nodeId"], additionalProperties: false,
- properties: { op: { const: "remove_node" }, nodeId: { type: "string", minLength: 1 }, cascade: { type: "boolean" } },
- },
- {
- type: "object", required: ["op", "edge"], additionalProperties: false,
- properties: {
- op: { const: "add_edge" },
- edge: {
- type: "object", required: ["source", "target"], additionalProperties: false,
- properties: {
- id: { type: "string", minLength: 1, maxLength: 100 },
- source: { type: "string", minLength: 1, maxLength: 100 }, target: { type: "string", minLength: 1, maxLength: 100 },
- label: { type: "string", maxLength: 500 }, type: { type: "string", enum: ["dependency", "request", "async", "data"] },
- bidirectional: { type: "boolean" },
- },
- },
- },
+ type: "object",
+ required: ["op"],
+ additionalProperties: false,
+ properties: {
+ op: {
+ type: "string",
+ enum: ["add_node", "update_node", "remove_node", "add_edge", "update_edge", "remove_edge"],
},
- {
- type: "object", required: ["op", "edgeId", "changes"], additionalProperties: false,
+ node: diagramNodeSchema,
+ nodeId: { type: "string", minLength: 1 },
+ edge: diagramEdgeSchema,
+ edgeId: { type: "string", minLength: 1 },
+ changes: {
+ type: "object",
+ additionalProperties: false,
properties: {
- op: { const: "update_edge" }, edgeId: { type: "string", minLength: 1 },
- changes: {
- type: "object", minProperties: 1, additionalProperties: false,
- properties: {
- source: { type: "string", minLength: 1, maxLength: 100 }, target: { type: "string", minLength: 1, maxLength: 100 },
- label: { type: ["string", "null"], maxLength: 500 }, type: { type: ["string", "null"], enum: ["dependency", "request", "async", "data", null] },
- bidirectional: { type: ["boolean", "null"] },
- },
- },
+ label: { type: "string", maxLength: 500 },
+ type: { type: "string", enum: [...DIAGRAM_IR_NODE_TYPES] },
+ parentId: { type: "string", maxLength: 100 },
+ resourceIcon: { type: "string", enum: [...ARCHITECTURE_RESOURCE_ICONS] },
+ source: { type: "string", minLength: 1, maxLength: 100 },
+ target: { type: "string", minLength: 1, maxLength: 100 },
+ bidirectional: { type: "boolean" },
},
},
- {
- type: "object", required: ["op", "edgeId"], additionalProperties: false,
- properties: { op: { const: "remove_edge" }, edgeId: { type: "string", minLength: 1 } },
- },
- ],
+ cascade: { type: "boolean" },
+ },
},
},
},
@@ -655,7 +619,6 @@ const MCP_TOOL_DEFINITIONS = [
type: "object",
required: ["name"],
additionalProperties: false,
- anyOf: [{ required: ["memoId"] }, { required: ["contentMarkdown"] }],
properties: {
name: { type: "string", minLength: 1, maxLength: 160 },
description: { type: "string", maxLength: 500 },
@@ -673,13 +636,6 @@ const MCP_TOOL_DEFINITIONS = [
type: "object",
required: ["templateId"],
additionalProperties: false,
- anyOf: [
- { required: ["name"] },
- { required: ["description"] },
- { required: ["title"] },
- { required: ["contentMarkdown"] },
- { required: ["tags"] },
- ],
properties: {
templateId: { type: "string", minLength: 1 },
name: { type: "string", minLength: 1, maxLength: 160 },
@@ -763,13 +719,6 @@ const MCP_TOOL_DEFINITIONS = [
type: "object",
required: ["instructionId"],
additionalProperties: false,
- anyOf: [
- { required: ["name"] },
- { required: ["description"] },
- { required: ["instruction"] },
- { required: ["parameterKind"] },
- { required: ["resultMode"] },
- ],
properties: {
instructionId: { type: "string", minLength: 1 },
name: { type: "string", minLength: 1, maxLength: 80 },
diff --git a/apps/web/src/components/CompanionChat.tsx b/apps/web/src/components/CompanionChat.tsx
index 9dd5edee..6773dcb4 100644
--- a/apps/web/src/components/CompanionChat.tsx
+++ b/apps/web/src/components/CompanionChat.tsx
@@ -64,6 +64,10 @@ export function CompanionChat({
const explainError = (cause: unknown) => {
const code = cause instanceof ApiRequestError ? cause.code : "";
if (code === "ai_not_configured") return t("companion.configureModel");
+ if (code === "ai_credentials_rejected") return t("companion.credentialsRejected");
+ if (code === "ai_provider_payment_required") return t("companion.providerPaymentRequired");
+ if (code === "ai_provider_rate_limited") return t("companion.providerRateLimited");
+ if (code === "ai_provider_request_rejected") return t("companion.providerRequestRejected");
if (code === "companion_memory_conflict") return t("companion.conflict");
if (code === "companion_history_full") return t("companion.historyFull");
if (code === "companion_action_conflict") return t("companion.actions.conflict");
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index bc21897b..6f9acc6a 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -141,6 +141,10 @@ export const enUS = {
"clearHelp": "Permanently delete all chats, discoveries and operation records, and stop generation. Memories and discovery settings remain. Previously skipped source groups may reappear. Export a backup first if needed.",
"forgetHelp": "Delete this memory and its learning evidence, block automatic relearning of the same rule, stop current generation and exclude old replies from future automatic context. Existing chat text, exported backups and provider-held data are not deleted; clear them separately if needed.",
"configureModel": "Configure a default model in AI settings before chatting.",
+ "credentialsRejected": "The default model credentials were rejected. Check the provider URL and API key in AI settings.",
+ "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.",
"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 0e59f084..0d3ca5a2 100644
--- a/packages/shared/src/i18n/ja.ts
+++ b/packages/shared/src/i18n/ja.ts
@@ -141,6 +141,10 @@ export const ja = {
"clearHelp": "すべてのチャット、発見、操作記録を完全に削除し、生成を停止します。記憶と発見の設定は残ります。以前スキップした出典グループが再表示される場合があります。必要なら先にバックアップをエクスポートしてください。",
"forgetHelp": "この記憶と学習の根拠を削除し、同じ規則の自動再学習を止め、現在の生成を停止し、今後の自動コンテキストから古い返信を外します。既存のチャット本文、エクスポート済みバックアップ、提供元が保持するデータは削除されません。必要なら別途消去してください。",
"configureModel": "チャットの前に、AI 設定でデフォルトモデルを設定してください。",
+ "credentialsRejected": "デフォルトモデルの認証情報が拒否されました。AI 設定でプロバイダー URL と API キーを確認してください。",
+ "providerPaymentRequired": "モデル提供元が残高不足を返しました。残高を確認してから再試行してください。",
+ "providerRateLimited": "モデル提供元がレート制限しています。しばらく待ってから再試行してください。",
+ "providerRequestRejected": "デフォルトモデルがこのリクエストを拒否しました。ツール呼び出しに対応しているか確認するか、別のデフォルトモデルを選んでください。",
"conflict": "記憶が他で変更されたか、50 件の上限に達しました。更新してから再試行してください。",
"historyFull": "チャットと発見の合計が 500 件の上限に達しました。続ける前にエクスポートして履歴を消去してください。",
"unavailable": "プレビューは、非デモインスタンスにサインインした個人アカウントでのみ利用できます。",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index 51a8291d..6bb1c495 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -141,6 +141,10 @@ export const zhCN = {
"clearHelp": "删除全部聊天、发现及操作记录(不可撤销),并停止当前生成;保留记忆和发现设置。已略过的来源组可能再次出现。可先导出备份。",
"forgetHelp": "删除这条记忆及关联学习证据,不再自动学习同一条规律,停止当前生成,并从后续自动上下文中排除旧回复。已有聊天文本、导出备份及模型服务商的数据不会随之删除;需要时请另行清空。",
"configureModel": "请先在 AI 设置中配置默认模型,再开始聊天。",
+ "credentialsRejected": "默认模型的密钥被拒绝。请在 AI 设置中检查服务商地址和密钥。",
+ "providerPaymentRequired": "模型服务商返回额度不足,请检查账户余额后重试。",
+ "providerRateLimited": "模型服务商限流,请稍后再试。",
+ "providerRequestRejected": "默认模型拒绝了这次请求。请确认该模型支持工具调用,或更换默认模型。",
"conflict": "记忆已被其他操作修改,或超过 50 条上限。请刷新后再试。",
"historyFull": "聊天与发现已达到合计 500 条历史上限,请先导出并清空历史。",
"unavailable": "预览功能仅对非演示实例中已登录的个人账户开放。",