feat(common-config): add extract from current provider functionality

- Add backend command to extract common config snippet from current provider
- Automatically extract common config on first run after importing default provider
- Auto-enable common config checkbox in new provider mode when snippet exists
- Refactor Gemini common config to operate on .env instead of config.json
- Add "Extract from Current" button to all three common config modals
- Update i18n translations for new extraction feature
This commit is contained in:
Jason
2026-01-03 23:43:39 +08:00
parent c049c5f2bb
commit 188c94f2e3
17 changed files with 892 additions and 295 deletions
+15
View File
@@ -47,3 +47,18 @@ export async function setCommonConfigSnippet(
): Promise<void> {
return invoke("set_common_config_snippet", { appType, snippet });
}
/**
* 从当前供应商提取通用配置片段
*
* 读取当前激活供应商的配置,自动排除差异化字段(API Key、模型配置、端点等),
* 返回可复用的通用配置片段。
*
* @param appType - 应用类型(claude/codex/gemini
* @returns 提取的通用配置片段(JSON/TOML 字符串)
*/
export async function extractCommonConfigSnippet(
appType: AppType,
): Promise<string> {
return invoke<string>("extract_common_config_snippet", { appType });
}