bingocode 1.1.64 → 1.1.65

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": "bingocode",
3
- "version": "1.1.64",
3
+ "version": "1.1.65",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
@@ -55,6 +55,7 @@
55
55
  "chokidar": "^5.0.0",
56
56
  "cli-boxes": "^4.0.1",
57
57
  "code-excerpt": "^4.0.0",
58
+ "commander": "^14.0.3",
58
59
  "diff": "^8.0.4",
59
60
  "emoji-regex": "^10.6.0",
60
61
  "env-paths": "^4.0.0",
@@ -99,10 +99,11 @@ presets:
99
99
  - id: deepseek
100
100
  name: DeepSeek
101
101
  baseUrl: https://api.deepseek.com/anthropic
102
- apiFormat: openai_chat
102
+ apiFormat: anthropic
103
103
  needsApiKey: true
104
104
  websiteUrl: https://platform.deepseek.com
105
- modelsUrl: /v1/models
105
+ # 模型列表走 OpenAI 端(/anthropic 路径下无 /v1/models
106
+ modelsUrl: https://api.deepseek.com/v1/models
106
107
  modelsAuthStyle: bearer
107
108
  modelsDataPath: data
108
109
  fields:
@@ -123,7 +124,7 @@ presets:
123
124
  apiFormat: openai_chat
124
125
  needsApiKey: true
125
126
  websiteUrl: https://open.bigmodel.cn
126
- modelsUrl: /models
127
+ modelsUrl: /v4/models
127
128
  modelsAuthStyle: bearer
128
129
  modelsDataPath: data
129
130
  fields:
@@ -136,11 +137,11 @@ presets:
136
137
  label: API Key
137
138
  required: true
138
139
  secret: true
139
- placeholder: '智谱 API Key'
140
+ placeholder: '智谱 API Key (glm-5.1)'
140
141
 
141
142
  - id: kimi
142
143
  name: Kimi
143
- baseUrl: https://api.moonshot.cn/v1
144
+ baseUrl: https://api.moonshot.ai/v1
144
145
  apiFormat: openai_chat
145
146
  needsApiKey: true
146
147
  websiteUrl: https://platform.moonshot.cn
@@ -157,11 +158,11 @@ presets:
157
158
  label: API Key
158
159
  required: true
159
160
  secret: true
160
- placeholder: 'Moonshot API Key'
161
+ placeholder: 'Moonshot API Key (kimi-k2.6)'
161
162
 
162
163
  - id: minimax
163
164
  name: MiniMax
164
- baseUrl: https://api.minimaxi.com/v1
165
+ baseUrl: https://api.minimax.io/v1
165
166
  apiFormat: openai_chat
166
167
  needsApiKey: true
167
168
  websiteUrl: https://platform.minimaxi.com
@@ -178,7 +179,7 @@ presets:
178
179
  label: API Key
179
180
  required: true
180
181
  secret: true
181
- placeholder: 'MiniMax API Key'
182
+ placeholder: 'MiniMax API Key (MiniMax-M2.7)'
182
183
 
183
184
  - id: custom
184
185
  name: Custom
@@ -498,7 +498,8 @@ export class ProviderService {
498
498
  }
499
499
 
500
500
  const modelsUrl = preset?.modelsUrl || '/v1/models'
501
- const url = `${base}${modelsUrl}`
501
+ // modelsUrl 为绝对 URL 时直接使用(如 DeepSeek: baseUrl 是 anthropic 端,模型列表需走 OpenAI 端)
502
+ const url = modelsUrl.startsWith('http') ? modelsUrl : `${base}${modelsUrl}`
502
503
 
503
504
  const headers: Record<string, string> = {
504
505
  'Content-Type': 'application/json',
@@ -516,8 +517,9 @@ export class ProviderService {
516
517
  const directOpts = getDirectFetchOptions()
517
518
  const res = await fetch(url, { headers, signal: AbortSignal.timeout(10000), ...directOpts })
518
519
  if (!res.ok) {
519
- console.error(`[ProviderService] Failed to fetch models from ${url}: ${res.status}`)
520
- return []
520
+ const errText = await res.text().catch(() => '')
521
+ console.error(`[ProviderService] Failed to fetch models from ${url}: ${res.status} ${errText}`)
522
+ throw new Error(`HTTP ${res.status}: ${errText.slice(0, 200)}`)
521
523
  }
522
524
  const data = await res.json() as any
523
525
  const dataPath = preset?.modelsDataPath || 'data'
@@ -526,7 +528,7 @@ export class ProviderService {
526
528
  return list.map((m: any) => (typeof m === 'string' ? m : m.id)).filter(Boolean)
527
529
  } catch (err) {
528
530
  console.error(`[ProviderService] Error fetching models from ${url}:`, err)
529
- return []
531
+ throw err
530
532
  }
531
533
  }
532
534
 
@@ -553,14 +555,19 @@ export class ProviderService {
553
555
  }
554
556
  }
555
557
 
556
- // 兜底:如果仍然没有有效的 modelId,直接返回有意义的错误
558
+ // 兜底:动态拉取失败时,按 apiFormat 使用通用 fallback 模型做连通性测试
557
559
  if (!modelId) {
558
- return {
559
- connectivity: {
560
- success: false,
561
- latencyMs: 0,
562
- error: '无法确定测试用模型:models.main 为空且自动拉取模型列表失败。请先在槽位配置中选择模型,或检查 API Key 和网络连接。',
563
- },
560
+ if (apiFormat === 'anthropic') {
561
+ modelId = 'claude-3-5-haiku-20241022'
562
+ } else {
563
+ // openai_chat / openai_responses: 无法确定模型,返回有意义的错误
564
+ return {
565
+ connectivity: {
566
+ success: false,
567
+ latencyMs: 0,
568
+ error: '无法确定测试用模型:models.main 为空且自动拉取模型列表失败。请先在槽位配置中选择模型,或检查 API Key 和网络连接。',
569
+ },
570
+ }
564
571
  }
565
572
  }
566
573