openclawapi 1.3.12 → 1.3.13
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/cli.js +11 -6
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -417,7 +417,6 @@ async function testConnection(paths) {
|
|
|
417
417
|
|
|
418
418
|
// 获取 Gateway 配置
|
|
419
419
|
const gatewayPort = config.gateway?.port || 18789;
|
|
420
|
-
const gatewayToken = config.gateway?.auth?.token || '';
|
|
421
420
|
|
|
422
421
|
console.log(chalk.gray(`当前激活: ${typeLabel}`));
|
|
423
422
|
console.log(chalk.gray(`中转节点: ${provider.baseUrl}`));
|
|
@@ -428,12 +427,19 @@ async function testConnection(paths) {
|
|
|
428
427
|
console.log(chalk.cyan('步骤 1/2: 重启 Gateway 使配置生效...'));
|
|
429
428
|
await restartGateway();
|
|
430
429
|
|
|
431
|
-
// 步骤2:
|
|
432
|
-
console.log(chalk.cyan(`\n步骤 2/2:
|
|
430
|
+
// 步骤2: 直接测试中转 API 验证配置
|
|
431
|
+
console.log(chalk.cyan(`\n步骤 2/2: 测试 ${typeLabel} 中转 API...`));
|
|
433
432
|
|
|
434
433
|
try {
|
|
435
434
|
const startTime = Date.now();
|
|
436
|
-
|
|
435
|
+
let result;
|
|
436
|
+
|
|
437
|
+
if (type === 'claude') {
|
|
438
|
+
result = await testClaudeApi(provider.baseUrl, provider.apiKey, provider.models?.[0]?.id);
|
|
439
|
+
} else {
|
|
440
|
+
result = await testCodexApi(provider.baseUrl, provider.apiKey, provider.models?.[0]?.id);
|
|
441
|
+
}
|
|
442
|
+
|
|
437
443
|
const latency = Date.now() - startTime;
|
|
438
444
|
|
|
439
445
|
if (result.success) {
|
|
@@ -441,9 +447,8 @@ async function testConnection(paths) {
|
|
|
441
447
|
console.log(chalk.cyan(` 响应时间: ${latency}ms`));
|
|
442
448
|
console.log(chalk.yellow(` 模型回复: ${result.message}`));
|
|
443
449
|
} else {
|
|
444
|
-
console.log(chalk.red(`\n❌
|
|
450
|
+
console.log(chalk.red(`\n❌ ${typeLabel} API 连接失败`));
|
|
445
451
|
console.log(chalk.red(` 错误: ${result.error}`));
|
|
446
|
-
console.log(chalk.gray(`\n💡 请确保 Gateway 正在运行: openclaw gateway`));
|
|
447
452
|
}
|
|
448
453
|
} catch (error) {
|
|
449
454
|
console.log(chalk.red(`❌ 测试失败: ${error.message}`));
|