zen-gitsync 2.11.9 → 2.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-gitsync",
3
- "version": "2.11.9",
3
+ "version": "2.11.12",
4
4
  "description": "一个 git 提交的工具",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/config.js CHANGED
@@ -40,7 +40,9 @@ const defaultConfig = {
40
40
  autoClosePushModal: false,
41
41
  // 通用设置
42
42
  theme: 'light', // 主题: light | dark | auto
43
- locale: 'zh-CN' // 语言: zh-CN | en-US
43
+ locale: 'zh-CN', // 语言: zh-CN | en-US
44
+ // AI 模型配置
45
+ models: []
44
46
  };
45
47
 
46
48
  // 规范化项目路径作为配置键
@@ -120,12 +122,14 @@ async function loadConfig() {
120
122
 
121
123
  // 新版结构:{ projects: { [key]: projectConfig }, theme?, locale?, recentDirectories? }
122
124
  const projectConfig = raw?.projects?.[key];
123
- // 合并:默认配置 + 项目配置 + 全局通用设置(theme, locale)
125
+ // 合并:默认配置 + 项目配置 + 全局通用设置(theme, locale, models
126
+ // models 是全局配置(跨项目共享),优先取项目级,否则回退顶层(兼容旧数据)
124
127
  return {
125
128
  ...defaultConfig,
126
129
  ...(projectConfig || {}),
127
130
  theme: raw?.theme ?? defaultConfig.theme,
128
- locale: raw?.locale ?? defaultConfig.locale
131
+ locale: raw?.locale ?? defaultConfig.locale,
132
+ models: projectConfig?.models ?? raw?.models ?? defaultConfig.models
129
133
  };
130
134
  }
131
135
 
@@ -157,7 +161,8 @@ async function saveConfig(config) {
157
161
  }
158
162
 
159
163
  // 分离全局设置和项目设置
160
- const { theme, locale, ...projectConfig } = config;
164
+ // models 也是全局配置(跨项目共享),和 theme/locale 一样存到顶层
165
+ const { theme, locale, models, ...projectConfig } = config;
161
166
 
162
167
  // 保存全局设置到根级别
163
168
  if (theme !== undefined) {
@@ -166,6 +171,9 @@ async function saveConfig(config) {
166
171
  if (locale !== undefined) {
167
172
  raw.locale = locale;
168
173
  }
174
+ if (models !== undefined) {
175
+ raw.models = models;
176
+ }
169
177
 
170
178
  // 写入当前项目配置(在 defaultConfig 基础上合并,但不清空顶层其它键)
171
179
  const existingProjectConfig = (raw.projects[key] && typeof raw.projects[key] === 'object') ? raw.projects[key] : {};