galaxy-opc 0.5.7 → 0.5.10
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/bin/cli.mjs +63 -28
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -439,6 +439,63 @@ async function cmdSetup() {
|
|
|
439
439
|
{ label: "OAuth 扫码登录", desc: "浏览器扫码,无需 API Key", recommended: true },
|
|
440
440
|
{ label: "DashScope API Key", desc: "从 dashscope.aliyun.com 获取" },
|
|
441
441
|
]);
|
|
442
|
+
const configureQwenApiKey = async () => {
|
|
443
|
+
const mode = await askChoice("选择 Qwen API 通道", [
|
|
444
|
+
{ label: "Coding Plan(推荐)", desc: "baseUrl: coding.dashscope.aliyuncs.com/v1,模型: bailian/qwen3.5-plus", recommended: true },
|
|
445
|
+
{ label: "标准 DashScope", desc: "baseUrl: dashscope.aliyuncs.com/compatible-mode/v1,模型: dashscope/qwen-plus" },
|
|
446
|
+
]);
|
|
447
|
+
if (mode === 0) {
|
|
448
|
+
printQwenCodingPlanGuide();
|
|
449
|
+
const key = await ask("\n 请输入 Coding Plan API Key(sk-sp-...,可直接回车跳过): ");
|
|
450
|
+
if (!key) return false;
|
|
451
|
+
newEnv["DASHSCOPE_API_KEY"] = key;
|
|
452
|
+
defaultModel = "bailian/qwen3.5-plus";
|
|
453
|
+
newConfig = deepMerge(newConfig, {
|
|
454
|
+
models: {
|
|
455
|
+
providers: {
|
|
456
|
+
bailian: {
|
|
457
|
+
baseUrl: "https://coding.dashscope.aliyuncs.com/v1",
|
|
458
|
+
apiKey: key,
|
|
459
|
+
api: "openai-completions",
|
|
460
|
+
models: [
|
|
461
|
+
{ id: "qwen3.5-plus", name: "Qwen 3.5 Plus", contextWindow: 128000, maxTokens: 8192 },
|
|
462
|
+
{ id: "qwen3-max-2026-01-23", name: "Qwen 3 Max", contextWindow: 128000, maxTokens: 8192 },
|
|
463
|
+
{ id: "qwen3-coder-next", name: "Qwen 3 Coder Next", contextWindow: 128000, maxTokens: 8192 },
|
|
464
|
+
{ id: "qwen3-coder-plus", name: "Qwen 3 Coder Plus", contextWindow: 128000, maxTokens: 8192 },
|
|
465
|
+
],
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
agents: {
|
|
470
|
+
defaults: {
|
|
471
|
+
model: { primary: "bailian/qwen3.5-plus" },
|
|
472
|
+
models: {
|
|
473
|
+
"bailian/qwen3.5-plus": {},
|
|
474
|
+
"bailian/qwen3-max-2026-01-23": {},
|
|
475
|
+
"bailian/qwen3-coder-next": {},
|
|
476
|
+
"bailian/qwen3-coder-plus": {},
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
});
|
|
481
|
+
console.log(green(" ✓ 已保存 Coding Plan 配置"));
|
|
482
|
+
return true;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const key = await ask("\n 请输入 DashScope API Key(sk-...,可直接回车跳过): ");
|
|
486
|
+
if (!key) return false;
|
|
487
|
+
newEnv["DASHSCOPE_API_KEY"] = key;
|
|
488
|
+
defaultModel = "dashscope/qwen-plus";
|
|
489
|
+
newConfig = deepMerge(newConfig, {
|
|
490
|
+
models: { providers: { dashscope: { baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1", apiKey: key, api: "openai-completions", models: [{ id: "qwen-plus", name: "Qwen Plus", contextWindow: 128000, maxTokens: 8192 }] } } },
|
|
491
|
+
agents: { defaults: { model: { primary: "dashscope/qwen-plus" } } },
|
|
492
|
+
});
|
|
493
|
+
console.log(green(" ✓ 已保存 DashScope 标准配置"));
|
|
494
|
+
return true;
|
|
495
|
+
};
|
|
496
|
+
// User explicitly chose Qwen. Set Qwen as default target unless a stronger config is provided below.
|
|
497
|
+
defaultModel = "qwen-portal/qwen-max";
|
|
498
|
+
newConfig = deepMerge(newConfig, { agents: { defaults: { model: { primary: "qwen-portal/qwen-max" } } } });
|
|
442
499
|
if (m === 0) {
|
|
443
500
|
console.log(gray("\n 浏览器即将打开,扫码登录通义千问(qwen-portal)...\n"));
|
|
444
501
|
const doLogin = await askYesNo(" 现在执行登录?", true);
|
|
@@ -446,44 +503,21 @@ async function cmdSetup() {
|
|
|
446
503
|
try {
|
|
447
504
|
await runCommand("openclaw", ["models", "auth", "login", "--provider", "qwen-portal"]);
|
|
448
505
|
console.log(green("\n ✓ Qwen OAuth 登录成功"));
|
|
449
|
-
defaultModel = "qwen-portal/qwen-max";
|
|
450
|
-
newConfig = deepMerge(newConfig, { agents: { defaults: { model: { primary: "qwen-portal/qwen-max" } } } });
|
|
451
506
|
} catch {
|
|
452
507
|
console.log(yellow("\n ! Qwen OAuth 登录失败"));
|
|
453
508
|
console.log(gray(" 你可以稍后手动运行: openclaw models auth login --provider qwen-portal"));
|
|
454
509
|
const useKey = await askYesNo(" 改用 DashScope API Key 方式继续配置?", true);
|
|
455
510
|
if (useKey) {
|
|
456
|
-
|
|
457
|
-
if (key) {
|
|
458
|
-
newEnv["DASHSCOPE_API_KEY"] = key;
|
|
459
|
-
defaultModel = "dashscope/qwen-plus";
|
|
460
|
-
newConfig = deepMerge(newConfig, {
|
|
461
|
-
models: { providers: { dashscope: { baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1", apiKey: key, api: "openai-completions", models: [{ id: "qwen-plus", name: "Qwen Plus", contextWindow: 128000, maxTokens: 8192 }] } } },
|
|
462
|
-
agents: { defaults: { model: { primary: "dashscope/qwen-plus" } } },
|
|
463
|
-
});
|
|
464
|
-
console.log(green(" ✓ 已保存"));
|
|
465
|
-
}
|
|
511
|
+
await configureQwenApiKey();
|
|
466
512
|
}
|
|
467
513
|
}
|
|
468
514
|
} else {
|
|
469
515
|
console.log(dim(" 已跳过 OAuth 登录,可稍后执行:openclaw models auth login --provider qwen-portal"));
|
|
470
516
|
}
|
|
471
517
|
} else {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
console.log(dim(" 已跳过 API Key 输入,稍后可运行 npx galaxy-opc setup 继续配置。"));
|
|
476
|
-
} else {
|
|
477
|
-
const key = await ask("\n 请输入 DashScope API Key (sk-...): ");
|
|
478
|
-
if (key) {
|
|
479
|
-
newEnv["DASHSCOPE_API_KEY"] = key;
|
|
480
|
-
defaultModel = "dashscope/qwen-plus";
|
|
481
|
-
newConfig = deepMerge(newConfig, {
|
|
482
|
-
models: { providers: { dashscope: { baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1", apiKey: key, api: "openai-completions", models: [{ id: "qwen-plus", name: "Qwen Plus", contextWindow: 128000, maxTokens: 8192 }] } } },
|
|
483
|
-
agents: { defaults: { model: { primary: "dashscope/qwen-plus" } } },
|
|
484
|
-
});
|
|
485
|
-
console.log(green(" ✓ 已保存"));
|
|
486
|
-
}
|
|
518
|
+
const ok = await configureQwenApiKey();
|
|
519
|
+
if (!ok) {
|
|
520
|
+
console.log(dim(" 已跳过 API Key 输入,默认使用 qwen-portal/qwen-max;可稍后执行 Qwen OAuth 登录。"));
|
|
487
521
|
}
|
|
488
522
|
}
|
|
489
523
|
} else if (cnIdx === 1) {
|
|
@@ -623,8 +657,9 @@ async function cmdSetup() {
|
|
|
623
657
|
${cyan("openclaw gateway")}
|
|
624
658
|
|
|
625
659
|
${bold("启动后访问:")}
|
|
626
|
-
对话界面: ${cyan(
|
|
660
|
+
对话界面: ${cyan(`http://localhost:18789/?token=${gatewayToken}`)}
|
|
627
661
|
管理后台: ${cyan(`http://localhost:18789/opc/admin?token=${gatewayToken}`)}
|
|
662
|
+
${dim("注意:不要访问 http://localhost:18791(内部 Browser Control 端口,直接打开会显示 Unauthorized)")}
|
|
628
663
|
|
|
629
664
|
${bold("后台驻守(开机自启):")}
|
|
630
665
|
${cyan("openclaw onboard --install-daemon")}
|