bingocode 1.1.64 → 1.1.66

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.
@@ -39,14 +39,14 @@
39
39
  } catch (e) { lastErr = e; }
40
40
  await new Promise(r => setTimeout(r, HEALTH_RETRY_MS));
41
41
  }
42
- throw new Error(`健康检查超时:${lastErr?.message || 'unknown'}`);
42
+ throw new Error(`Health check timeout: ${lastErr?.message || 'unknown'}`);
43
43
  }
44
44
  function resolveBunPath() {
45
45
  const fromEnv = process.env.BUN_PATH;
46
46
  if (fromEnv) return fromEnv;
47
47
  const r = spawnSync('bun', ['--version'], { stdio: 'ignore' });
48
48
  if (r.status === 0) return 'bun';
49
- throw new Error('未检测到 bun,请安装 https://bun.sh 或设置 BUN_PATH');
49
+ throw new Error('Bun not detected. Please install https://bun.sh or set BUN_PATH');
50
50
  }
51
51
 
52
52
  async function acquireLease(): Promise<string> {
@@ -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
 
@@ -242,6 +242,7 @@ export type GlobalConfig = {
242
242
  hasUsedBackgroundTask?: boolean // Whether the user has backgrounded a task (Ctrl+B)
243
243
  queuedCommandUpHintCount?: number // Counter for how many times the user has seen the queued command up hint
244
244
  diffTool?: DiffTool // Which tool to use for displaying diffs (terminal or vscode)
245
+ language: 'en' | 'zh' // User's preferred language for CLI menus
245
246
 
246
247
  // Terminal setup state tracking
247
248
  iterm2SetupInProgress?: boolean
@@ -619,6 +620,7 @@ function createDefaultGlobalConfig(): GlobalConfig {
619
620
  cachedGrowthBookFeatures: {},
620
621
  respectGitignore: true,
621
622
  copyFullResponse: false,
623
+ language: 'en',
622
624
  }
623
625
  }
624
626
 
@@ -663,6 +665,7 @@ export const GLOBAL_CONFIG_KEYS = [
663
665
  'prStatusFooterEnabled',
664
666
  'remoteControlAtStartup',
665
667
  'remoteDialogSeen',
668
+ 'language',
666
669
  ] as const
667
670
 
668
671
  export type GlobalConfigKey = (typeof GLOBAL_CONFIG_KEYS)[number]