From 6569bcddf6915eb0addce8e2aa70dfb003258825 Mon Sep 17 00:00:00 2001 From: hfshfg <38004547@qq.com> Date: Fri, 20 Mar 2026 10:47:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Windows-Start.bat=20=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20+=20Config=20Center=20=E5=85=A8=E9=9D=A2?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows-Start.bat: - 去掉 EnableDelayedExpansion,避免感叹号解析问题 - 用 config-server (18788端口) 替代直接打开 Config.html - 去掉有 bug 的 token 读取(引号嵌套问题) - 去掉 powershell 日志管道,简化启动流程 - 对齐 H 盘已验证可用的方案 Config Center (config-server/public/index.html): - 步骤式引导:选模型 → 填 Key → 启动 - 11 个模型:MiniMax/Kimi/DeepSeek/智谱GLM/通义千问/豆包/OpenAI/Claude/Groq/硅基流动/自定义 - 4 个聊天平台:Telegram/QQ/飞书/企业微信 - Gateway 状态实时检测 - 正确的 OpenClaw v3 配置格式 Co-Authored-By: Claude Opus 4.6 --- portable/Windows-Start.bat | 55 +- portable/config-server/public/index.html | 737 ++++++++++++++++++----- 2 files changed, 601 insertions(+), 191 deletions(-) diff --git a/portable/Windows-Start.bat b/portable/Windows-Start.bat index ddaeee2..717e5ff 100644 --- a/portable/Windows-Start.bat +++ b/portable/Windows-Start.bat @@ -1,5 +1,4 @@ @echo off -setlocal EnableDelayedExpansion chcp 65001 >nul 2>&1 title U-Claw - Portable AI Agent @@ -76,10 +75,10 @@ REM Find available port set PORT=18789 :check_port netstat -an | findstr ":%PORT% " | findstr "LISTENING" >nul 2>&1 -if !errorlevel!==0 ( +if %errorlevel%==0 ( echo Port %PORT% in use, trying next... set /a PORT+=1 - if !PORT! gtr 18799 ( + if %PORT% gtr 18799 ( echo No available port 18789-18799 pause exit /b 1 @@ -87,40 +86,34 @@ if !errorlevel!==0 ( goto :check_port ) -REM Read token from config -set "TOKEN=uclaw" -if exist "%STATE_DIR%\openclaw.json" ( - for /f "tokens=*" %%t in ('"%NODE_BIN%" -e "try{const c=JSON.parse(require('fs').readFileSync(process.argv[1],'utf8'));console.log((c.gateway&&c.gateway.auth&&c.gateway.auth.token)||'uclaw')}catch(e){console.log('uclaw')}" "%STATE_DIR%\openclaw.json"') do set "TOKEN=%%t" -) +echo Starting OpenClaw on port %PORT%... +echo. -echo Starting OpenClaw on port !PORT!... +REM Start Config Server in background +echo Starting Config Center on port 18788... +set "CONFIG_SERVER=%UCLAW_DIR%config-server" +start /B "" "%NODE_BIN%" "%CONFIG_SERVER%\server.js" >nul 2>&1 + +REM Wait for config server to start +timeout /t 2 /nobreak >nul + +REM Open both Dashboard and Config Center +echo Opening Dashboard and Config Center... +timeout /t 1 /nobreak >nul + +REM Open OpenClaw Dashboard first +start "" http://127.0.0.1:%PORT%/#token=uclaw + +REM Open Config Center (Node.js web UI) second +start "" http://127.0.0.1:18788/ + +echo Browsers opened. Starting OpenClaw Gateway on port %PORT%... echo DO NOT close this window while using U-Claw! echo. cd /d "%CORE_DIR%" set "OPENCLAW_MJS=%CORE_DIR%\node_modules\openclaw\openclaw.mjs" -echo Log: %DATA_DIR%\logs\gateway.log - -REM Check if model is configured -set "HAS_MODEL=no" -if exist "%STATE_DIR%\openclaw.json" ( - findstr /c:"model" "%STATE_DIR%\openclaw.json" >nul 2>&1 && set "HAS_MODEL=yes" -) -if "!HAS_MODEL!"=="no" if exist "%DATA_DIR%\config.json" ( - findstr /c:"model" "%DATA_DIR%\config.json" >nul 2>&1 && set "HAS_MODEL=yes" -) - -REM Open browser after a short delay (gateway needs ~2-3s to start) -if "!HAS_MODEL!"=="yes" ( - echo Opening dashboard in 3 seconds... - start /B "" cmd /c "timeout /t 3 /nobreak >nul && start http://127.0.0.1:!PORT!/#token=!TOKEN!" -) else ( - echo First time setup - opening Config page in 3 seconds... - start /B "" cmd /c "timeout /t 3 /nobreak >nul && start %UCLAW_DIR%Config.html?port=!PORT!" -) - -REM Start gateway (foreground, blocks until stopped) -"%NODE_BIN%" "%OPENCLAW_MJS%" gateway run --allow-unconfigured --force --port !PORT! 2>&1 | powershell -command "& { $input | Tee-Object -Append -FilePath '%DATA_DIR%\logs\gateway.log' }" +"%NODE_BIN%" "%OPENCLAW_MJS%" gateway run --allow-unconfigured --force --port %PORT% echo. echo OpenClaw stopped. diff --git a/portable/config-server/public/index.html b/portable/config-server/public/index.html index 1119b7f..6313298 100644 --- a/portable/config-server/public/index.html +++ b/portable/config-server/public/index.html @@ -6,202 +6,619 @@ U-Claw 配置中心
-

🦞 U-Claw 配置中心

-

简单配置,快速启动

+

🦞 U-Claw 配置中心

+

选择模型,填入 API Key,一键启动

- -
-

AI 模型配置

-
- - + +
+
+
检测中...
-
- - -
- - - -
-
- -
-

QQ 机器人(可选)

-
- - + +
+
1选模型
+
2填 Key
+
3启动
-
- - -
- -
-
- + +
+

选择 AI 模型

+

推荐国内用户用 MiniMax / Kimi / DeepSeek

+ +
+
+ +

MiniMax 推荐国内

+

MiniMax-Text-01,速度快,性价比高

+ → 获取 API Key +
+
+ +

Kimi (月之暗面) 国内

+

moonshot-v1-auto,智能选模型

+ → 获取 API Key +
+
+ +

DeepSeek 国内便宜

+

deepseek-chat,超低价格

+ → 获取 API Key +
+
+ +

智谱 GLM 国内有免费

+

glm-5(zai provider),免费额度可用

+ → 获取 API Key +
+
+ +

通义千问 国内有免费

+

qwen-turbo,阿里云出品

+ → 获取 API Key +
+
+ +

豆包 (字节) 国内

+

doubao-1.5-pro,字节跳动

+ → 获取 API Key +
+
+ +

OpenAI

+

GPT-4o,需翻墙或中转

+ → 获取 API Key +
+
+ +

Claude

+

Claude Sonnet 4,需翻墙或中转

+ → 获取 API Key +
+
+ +

Groq 极快有免费

+

Llama 3.3 70B,超高速推理

+ → 获取 API Key +
+
+ +

硅基流动 国内便宜

+

多模型聚合,价格低

+ → 获取 API Key +
+
+ +

🔧 自定义 API OpenAI 兼容

+

填写任意 OpenAI 兼容 API 地址(OpenRouter、API2D、New API、One API 等)

+
+
+ +
+ +
+
+ + +
+

填写 API Key

+

请填写对应模型的 API Key

+ +
+

📌 如何获取 API Key?

+ +
+ + + +
+ +
+ + +
+

你的 Key 仅保存在本地 U 盘,不会上传到任何服务器

+
+ +
+ + +
+
+ + +
+
+
🦞
+

配置完成!

+

模型和 API Key 已保存到本地

+
http://127.0.0.1:18789
+ +
+

📱 接入聊天平台(可选)

+

点击卡片展开填写,不填可直接跳过:

+
+
+

✈️ Telegram

+

接入 Telegram Bot

+
+
+ + +

→ 从 @BotFather 获取

+
+
+
+
+

🐧 QQ Bot

+

接入 QQ 群/私聊机器人

+
+
+ + +
+
+ + +

→ 从 QQ 开放平台获取

+
+
+
+
+

📘 飞书

+

接入飞书机器人

+
+
+ + +
+
+ + +

→ 从飞书开放平台获取

+
+
+
+
+

🏢 企业微信

+

接入企业微信机器人

+
+
+ + +
+ +
+
+
+
+ +
+ +

渠道配置会自动写入,Gateway 需重启生效

+
+ +
+ + +
+
+
+ + +
+

📦 目录说明

+

U 盘内的文件结构

+
+
+
+

skills-cn/ — 中文技能

+

放入 .md 技能文件,OpenClaw 自动加载

+
+ 📁 +
+
+
+

app/ — 运行时 + 核心

+

Node.js 运行时、OpenClaw 核心代码

+
+ ⚙️ +
+
+
+

data/ — 配置和数据

+

API Key、聊天历史等保存在此(仅本地)

+
+ 🔒 +
+
+
+
+