openclawapi 1.3.9 → 1.3.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.
Files changed (2) hide show
  1. package/cli.js +35 -11
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -489,17 +489,41 @@ async function restartGateway() {
489
489
 
490
490
  const { exec } = require('child_process');
491
491
 
492
+ // 尝试多种命令
493
+ const commands = [
494
+ 'openclaw gateway restart',
495
+ 'clawdbot gateway restart',
496
+ 'npx openclaw gateway restart',
497
+ 'npx clawdbot gateway restart'
498
+ ];
499
+
492
500
  return new Promise((resolve) => {
493
- exec('openclaw gateway restart', { timeout: 30000 }, (error, stdout, stderr) => {
494
- if (error) {
495
- console.log(chalk.red(`❌ 重启失败: ${error.message}`));
501
+ let tried = 0;
502
+
503
+ const tryNext = () => {
504
+ if (tried >= commands.length) {
505
+ console.log(chalk.red(`❌ 重启失败: 找不到 openclaw/clawdbot 命令`));
496
506
  console.log(chalk.gray(` 请手动运行: openclaw gateway restart`));
497
- } else {
498
- console.log(chalk.green(`✅ Gateway 已重启`));
499
- console.log(chalk.gray(` 现在可以在 Web/Telegram/Discord 等渠道测试对话了`));
507
+ console.log(chalk.gray(` 或: clawdbot gateway restart`));
508
+ resolve();
509
+ return;
500
510
  }
501
- resolve();
502
- });
511
+
512
+ const cmd = commands[tried];
513
+ tried++;
514
+
515
+ exec(cmd, { timeout: 30000 }, (error) => {
516
+ if (error) {
517
+ tryNext();
518
+ } else {
519
+ console.log(chalk.green(`✅ Gateway 已重启`));
520
+ console.log(chalk.gray(` 现在可以在 Web/Telegram/Discord 等渠道测试对话了`));
521
+ resolve();
522
+ }
523
+ });
524
+ };
525
+
526
+ tryNext();
503
527
  });
504
528
  }
505
529
 
@@ -511,8 +535,8 @@ function testClaudeApi(baseUrl, apiKey, model) {
511
535
 
512
536
  const postData = JSON.stringify({
513
537
  model: model || 'claude-sonnet-4-5',
514
- max_tokens: 100,
515
- messages: [{ role: 'user', content: '你是什么模型?请简短回答。' }]
538
+ max_tokens: 150,
539
+ messages: [{ role: 'user', content: '你是哪个模型?请用一句话回答你的模型名称和版本。' }]
516
540
  });
517
541
 
518
542
  const options = {
@@ -571,7 +595,7 @@ function testCodexApi(baseUrl, apiKey, model) {
571
595
 
572
596
  const postData = JSON.stringify({
573
597
  model: model || 'gpt-5.2',
574
- input: '你是什么模型?请简短回答。'
598
+ input: '你是哪个模型?请用一句话回答你的模型名称和版本。'
575
599
  });
576
600
 
577
601
  const options = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclawapi",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "description": "跨平台 OpenClaw/Clawdbot 配置管理工具 - 管理中转地址、模型切换、API Keys、测速优化",
5
5
  "main": "cli.js",
6
6
  "bin": {