imtoagent 0.3.3 → 0.3.4

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.
@@ -48,7 +48,6 @@ function readKey(): Promise<string> {
48
48
 
49
49
  async function selectMenu(title: string, options: string[]): Promise<number> {
50
50
  let idx = 0;
51
- const linesAbove = options.length + 2;
52
51
 
53
52
  function render() {
54
53
  // 清除之前的输出
@@ -481,8 +480,11 @@ export async function runSetupWizard(): Promise<void> {
481
480
  console.log(`✅ 已保留 ${Object.keys(providers).length} 个现有供应商\n`);
482
481
  }
483
482
 
484
- let addingProviders = true;
485
- while (addingProviders) {
483
+ // Step 4 外层循环:确保至少有一个供应商(用户明确跳过时退出)
484
+ let step4Loop = true;
485
+ while (step4Loop) {
486
+ let addingProviders = true;
487
+ while (addingProviders) {
486
488
  console.log('--- 添加新供应商 ---\n');
487
489
 
488
490
  // 选择预设 or 自定义
@@ -552,6 +554,9 @@ export async function runSetupWizard(): Promise<void> {
552
554
  // API Key(所有路径都需要)
553
555
  const apiKey = await promptText('API Key');
554
556
  if ((apiKey as any) === -1) continue;
557
+ if (!apiKey) {
558
+ console.log('⚠️ API Key 为空,当前供应商将暂时无法使用\n');
559
+ }
555
560
 
556
561
  // 价格(可选)
557
562
  const priceInput = await promptText('价格 (入/出 每百万 Token,如 0.55,2.19,留空跳过)');
@@ -578,8 +583,11 @@ export async function runSetupWizard(): Promise<void> {
578
583
  if (Object.keys(providers).length === 0) {
579
584
  console.log('\n⚠️ 未配置任何供应商。');
580
585
  const r = await confirm('至少配置一个供应商吗?');
581
- if (r === true) { addingProviders = true; }
586
+ if (r === true) continue; // 重新进入 step4Loop
587
+ if (r === -1) { console.log('\n⚠️ 已跳过,你可以稍后配置。\n'); }
582
588
  }
589
+ step4Loop = false; // 有供应商或用户明确跳过
590
+ }
583
591
 
584
592
  // ===== Step 5: 选择默认模型 =====
585
593
  console.log('\n📌 Step 5: 选择默认模型\n');
@@ -1007,6 +1007,17 @@ export function startAnthropicProxy(port = 18899): Promise<number> {
1007
1007
  console.log(`[Proxy] 本地代理启动 http://localhost:${port}/v1/messages`);
1008
1008
  console.log(`[Proxy] 当前模型: ${sharedState.activeConfig ? `${sharedState.activeConfig.providerName}/${sharedState.activeConfig.model} (${sharedState.activeConfig.format})` : '未设置'}`);
1009
1009
  console.log(`[Proxy] 供应商: ${sharedState.activeConfig?.baseUrl || '无'}`);
1010
+
1011
+ // 检查有空 API Key 的供应商
1012
+ const emptyKeyProviders: string[] = [];
1013
+ providers.forEach((cfg, name) => {
1014
+ if (!cfg.apiKey) emptyKeyProviders.push(name);
1015
+ });
1016
+ if (emptyKeyProviders.length > 0) {
1017
+ console.log(`⚠️ 以下供应商 API Key 为空,可能无法正常工作: ${emptyKeyProviders.join(', ')}`);
1018
+ console.log(' 建议: 运行 "imtoagent setup" 设置必要的参数\n');
1019
+ }
1020
+
1010
1021
  resolve(port);
1011
1022
  });
1012
1023
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imtoagent",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "IM ↔ Agent 统一网关 — 飞书/Telegram/微信/企业微信对接 Claude Code/Codex/OpenCode",
5
5
  "type": "module",
6
6
  "bin": {