@pikecode/api-key-manager 1.0.30 → 1.0.32
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 +1 -1
- package/src/commands/edit.js +2 -7
- package/src/commands/switch.js +8 -2
package/package.json
CHANGED
package/src/commands/edit.js
CHANGED
|
@@ -200,14 +200,9 @@ class ProviderEditor extends BaseCommand {
|
|
|
200
200
|
await this.configManager.addProvider(name, {
|
|
201
201
|
displayName: answers.displayName,
|
|
202
202
|
ideName: 'codex',
|
|
203
|
-
authMode: 'openai_api_key',
|
|
204
203
|
baseUrl: answers.baseUrl || null,
|
|
205
204
|
authToken: answers.authToken,
|
|
206
|
-
tokenType: null,
|
|
207
|
-
codexFiles: null,
|
|
208
205
|
launchArgs: existingProvider.launchArgs || [],
|
|
209
|
-
primaryModel: existingProvider.models?.primary || null,
|
|
210
|
-
smallFastModel: existingProvider.models?.smallFast || null,
|
|
211
206
|
setAsDefault: false
|
|
212
207
|
});
|
|
213
208
|
} else {
|
|
@@ -221,8 +216,8 @@ class ProviderEditor extends BaseCommand {
|
|
|
221
216
|
tokenType: answers.tokenType, // 仅在 authMode 为 'api_key' 时使用
|
|
222
217
|
launchArgs: answers.launchArgs,
|
|
223
218
|
// Retain original model settings unless we add editing for them
|
|
224
|
-
primaryModel: existingProvider.models
|
|
225
|
-
smallFastModel: existingProvider.models
|
|
219
|
+
primaryModel: existingProvider.models?.primary || null,
|
|
220
|
+
smallFastModel: existingProvider.models?.smallFast || null,
|
|
226
221
|
setAsDefault: false, // Don't change default status on edit
|
|
227
222
|
});
|
|
228
223
|
}
|
package/src/commands/switch.js
CHANGED
|
@@ -21,6 +21,7 @@ class EnvSwitcher extends BaseCommand {
|
|
|
21
21
|
this.currentPromptContext = null;
|
|
22
22
|
this.activeStatusRefresh = null;
|
|
23
23
|
this.filter = null;
|
|
24
|
+
this.filteredProviders = null; // 保存过滤后的供应商列表用于状态更新
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
async validateProvider(providerName) {
|
|
@@ -348,7 +349,10 @@ class EnvSwitcher extends BaseCommand {
|
|
|
348
349
|
} else if (this.filter === 'claude') {
|
|
349
350
|
providers = providers.filter(p => p.ideName !== 'codex');
|
|
350
351
|
}
|
|
351
|
-
|
|
352
|
+
|
|
353
|
+
// 保存过滤后的供应商列表用于状态更新
|
|
354
|
+
this.filteredProviders = providers;
|
|
355
|
+
|
|
352
356
|
const initialStatusMap = this._buildInitialStatusMap(providers);
|
|
353
357
|
// 显示欢迎界面(立即渲染)
|
|
354
358
|
this.showWelcomeScreen(providers, initialStatusMap, null);
|
|
@@ -429,6 +433,7 @@ class EnvSwitcher extends BaseCommand {
|
|
|
429
433
|
this.currentPromptContext = null;
|
|
430
434
|
}
|
|
431
435
|
this._cancelStatusRefresh();
|
|
436
|
+
this.filteredProviders = null; // 清除保存的供应商列表
|
|
432
437
|
}
|
|
433
438
|
}
|
|
434
439
|
|
|
@@ -1141,7 +1146,8 @@ class EnvSwitcher extends BaseCommand {
|
|
|
1141
1146
|
}
|
|
1142
1147
|
|
|
1143
1148
|
const includeActions = this.currentPromptContext === 'manage';
|
|
1144
|
-
|
|
1149
|
+
// 使用保存的过滤后供应商列表,而不是重新获取全部
|
|
1150
|
+
const providers = this.filteredProviders || this.configManager.listProviders();
|
|
1145
1151
|
const statusMap = this.latestStatusMap || {};
|
|
1146
1152
|
const updatedChoicesBase = this.createProviderChoices(providers, includeActions, statusMap);
|
|
1147
1153
|
const updatedChoices = [...updatedChoicesBase];
|