@pikecode/api-key-manager 2.0.5 → 2.0.6

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": "@pikecode/api-key-manager",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "A CLI tool for managing and switching multiple API provider configurations",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -100,12 +100,18 @@ async function promptProviderInfo(adder) {
100
100
  { name: UI_MESSAGES.AUTH_MODE_CODEX_CHATGPT_LOGIN, value: 'chatgpt_login' }
101
101
  ],
102
102
  default: 'api_key',
103
- when: answers => {
103
+ when: async answers => {
104
104
  const isCodex = (answers.ideName || adder.presetIdeName) === 'codex';
105
105
  if (!isCodex) return false;
106
106
  // 如果已经有官方配置了,就用 api_key 模式,不提示选择
107
- const hasOfficialConfig = adder.configManager.getProvider('openai-official');
108
- return !hasOfficialConfig;
107
+ try {
108
+ await adder.configManager.ensureLoaded();
109
+ const hasOfficialConfig = adder.configManager.getProvider('openai-official');
110
+ return !hasOfficialConfig;
111
+ } catch {
112
+ // 如果加载失败,仍然显示选择提示
113
+ return true;
114
+ }
109
115
  }
110
116
  },
111
117
  {