fix(config): 保存不再误删 CLI 后加的顶层配置节 + 未知供应商类型原样保留
- 导出 stale-key 清理增加导入基线(imported_section_keys):CLI 在导入后 新增的顶层节(kimi-code 0.38+ 的 [task]/[swarm]/[cron] 等)在保存时 原样保留;用户在 UI 显式删除的节仍被移除;空基线(SQLite 快照恢复) 不删任何键(安全退化) - ProviderType 增加 Unknown(String) 变体,手写 serde 保持纯字符串线格式, 上游新增的 type 值往返不再被改写为 kimi;SQLite 快照恢复路径同步修复; 模型发现对未知类型返回明确错误,不再误用 KIMI_API_KEY - 新增 3 个往返测试(106 个 Rust 测试全绿),前端 tsc/vitest 通过
This commit is contained in:
1 parent
9764929919
commit
67db19eda4
9 files changed
+251
-58
No files matched your search
@@ -54,6 +54,8 @@ function defaultBaseUrl(agent: Agent, type: ProviderType): string {
|
||||
case "anthropic":
|
||||
case "vertexai":
|
||||
return "";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// Pi defaults
|
||||
@@ -68,6 +70,8 @@ function defaultBaseUrl(agent: Agent, type: ProviderType): string {
|
||||
case "anthropic":
|
||||
case "vertexai":
|
||||
return "";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,6 +311,11 @@ export function ProviderEdit({
|
||||
{t}
|
||||
</option>
|
||||
))}
|
||||
{!PROVIDER_TYPES.includes(provider.provider_type) && (
|
||||
<option value={provider.provider_type}>
|
||||
{t("apiFormatUnknown", { type: provider.provider_type })}
|
||||
</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -74,6 +74,7 @@ export const enTranslations: Record<TranslationKey, string> = {
|
||||
kimiOAuthStart: "Start sign-in",
|
||||
apiSettings: "API Settings",
|
||||
apiFormat: "API Format",
|
||||
apiFormatUnknown: "Unknown format ({type}, kept verbatim)",
|
||||
authField: "Auth Field",
|
||||
apiKey: "API Key",
|
||||
getApiKeyLink: "Get API Key",
|
||||
|
||||
@@ -72,6 +72,7 @@ export const zhTranslations = {
|
||||
kimiOAuthStart: "开始登录",
|
||||
apiSettings: "API 设置",
|
||||
apiFormat: "API 格式",
|
||||
apiFormatUnknown: "未知格式({type},原样保留)",
|
||||
authField: "认证字段",
|
||||
apiKey: "API Key",
|
||||
getApiKeyLink: "获取 API Key",
|
||||
|
||||
+9
-1
@@ -6,7 +6,9 @@ export type ProviderType =
|
||||
| "openai"
|
||||
| "openai_responses"
|
||||
| "google-genai"
|
||||
| "vertexai";
|
||||
| "vertexai"
|
||||
/** Any other string the CLI writes — preserved verbatim on round-trip. */
|
||||
| (string & {});
|
||||
|
||||
export interface Provider {
|
||||
name: string;
|
||||
@@ -62,6 +64,12 @@ export interface Config {
|
||||
providers: Record<string, Provider>;
|
||||
models: Record<string, Model>;
|
||||
raw_other?: unknown;
|
||||
/**
|
||||
* Top-level section keys captured at import time by the Rust side.
|
||||
* Export drops only baseline keys absent from raw_other (sections the
|
||||
* user removed in the UI); CLI-added sections are preserved.
|
||||
*/
|
||||
imported_section_keys?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user