mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-01 04:02:02 +08:00
fix: common config checkbox state not persisting for Codex/Claude/Gemini (#2191)
修复:Codex/Claude/Gemini 通用配置勾选状态无法正确保存的问题 Co-authored-by: 曾兴 <zengx@gantsoftware.com>
This commit is contained in:
@@ -244,9 +244,13 @@ export function useGeminiCommonConfig({
|
||||
env,
|
||||
parsed.env as Record<string, string>,
|
||||
);
|
||||
const hasCommon = initialEnabled ?? inferredHasCommon;
|
||||
|
||||
if (hasCommon && !inferredHasCommon) {
|
||||
// 优先级:显式设置的 initialEnabled > 从配置推断的值
|
||||
// 如果 initialEnabled 为 undefined,使用推断值
|
||||
const hasCommon = initialEnabled !== undefined ? initialEnabled : inferredHasCommon;
|
||||
|
||||
// 如果应该启用通用配置但配置中还没有,则自动添加
|
||||
if (hasCommon && !inferredHasCommon && Object.keys(parsed.env).length > 0) {
|
||||
const currentEnv = envStringToObj(envValue);
|
||||
const merged = applySnippetToEnv(currentEnv, parsed.env);
|
||||
const nextEnvString = envObjToString(merged);
|
||||
|
||||
Reference in New Issue
Block a user