diff --git a/Dockerfile b/Dockerfile index e272506d..0b252976 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ # ============================================================ -# ClawdBot Docker 镜像 -# -# 构建: docker build -t clawdbot . -# 运行: docker run -d --name clawdbot -v ~/.clawdbot:/root/.clawdbot clawdbot +# OpenClaw Docker 镜像 +# +# 构建: docker build -t openclaw . +# 运行: docker run -d --name openclaw -v ~/.openclaw:/root/.openclaw openclaw # ============================================================ FROM node:22-alpine -LABEL maintainer="ClawdBot Community" -LABEL description="ClawdBot - Your Personal AI Assistant" +LABEL maintainer="OpenClaw Community" +LABEL description="OpenClaw - Your Personal AI Assistant" LABEL version="1.0.0" # 安装基础依赖 @@ -26,32 +26,32 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone # 创建工作目录 WORKDIR /app -# 安装 ClawdBot -RUN npm install -g clawdbot@latest +# 安装 OpenClaw +RUN npm install -g openclaw@latest # 创建配置目录 -RUN mkdir -p /root/.clawdbot/logs \ - /root/.clawdbot/data \ - /root/.clawdbot/skills \ - /root/.clawdbot/backups +RUN mkdir -p /root/.openclaw/logs \ + /root/.openclaw/data \ + /root/.openclaw/skills \ + /root/.openclaw/backups # 复制默认配置和技能 -COPY examples/config.example.yaml /root/.clawdbot/config.yaml.example -COPY examples/skills/ /root/.clawdbot/skills/ +COPY examples/config.example.yaml /root/.openclaw/config.yaml.example +COPY examples/skills/ /root/.openclaw/skills/ # 设置卷挂载点 -VOLUME ["/root/.clawdbot"] +VOLUME ["/root/.openclaw"] # 暴露端口 EXPOSE 18789 # 健康检查 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD clawdbot health || exit 1 + CMD openclaw health || exit 1 # 入口脚本 COPY docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["clawdbot", "start", "--daemon"] +CMD ["openclaw", "gateway"] diff --git a/README.md b/README.md index 8598772e..6866ec0f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 🦞 ClawdBot 一键部署工具 +# 🦞 OpenClaw 一键部署工具

Version @@ -6,10 +6,10 @@ License

-> 🚀 一键部署你的私人 AI 助手 ClawdBot,支持多平台多模型配置 +> 🚀 一键部署你的私人 AI 助手 OpenClaw,支持多平台多模型配置

- ClawdBot 配置中心 + OpenClaw 配置中心

## 📖 目录 @@ -29,7 +29,7 @@ ### 🤖 多模型支持

- AI 模型配置 + OpenClaw AI 模型配置

**主流服务商:** @@ -60,10 +60,12 @@ > 💡 **自定义 API 地址**: Anthropic Claude 和 OpenAI GPT 都支持自定义 API 地址,可接入 OneAPI/NewAPI/API 代理等服务。配置时先输入自定义地址,再输入 API Key。 +> ⚠️ **重要更新**: 从 v2026.1.9 版本开始,命令已从 `clawdbot` 更改为 `openclaw`,`message` 命令改为子命令格式。 + ### 📱 多渠道接入

- 消息渠道配置 + OpenClaw 消息渠道配置

- Telegram Bot @@ -77,12 +79,12 @@ ### 🧪 快速测试

- 快速测试 + OpenClaw 快速测试

- API 连接测试 - 渠道连接验证 -- ClawdBot 诊断工具 +- OpenClaw 诊断工具 ### 🧠 核心能力 - **持久记忆** - 跨对话、跨平台的长期记忆 @@ -105,23 +107,23 @@ ```bash # 下载并运行安装脚本 -curl -fsSL https://raw.githubusercontent.com/miaoxworld/ClawdBotInstaller/main/install.sh | bash +curl -fsSL https://raw.githubusercontent.com/miaoxworld/OpenClawInstaller/main/install.sh | bash ``` 安装脚本会自动: 1. 检测系统环境并安装依赖 -2. 安装 ClawdBot +2. 安装 OpenClaw 3. 引导完成核心配置(AI模型、身份信息) 4. 测试 API 连接 -5. **自动启动 ClawdBot 服务** +5. **自动启动 OpenClaw 服务** 6. 可选打开配置菜单进行详细配置(渠道等) ### 方式二:手动安装 ```bash # 1. 克隆仓库 -git clone https://github.com/miaoxworld/ClawdBotInstaller.git -cd ClawdBotInstaller +git clone https://github.com/miaoxworld/OpenClawInstaller.git +cd OpenClawInstaller # 2. 添加执行权限 chmod +x install.sh config-menu.sh @@ -134,23 +136,23 @@ chmod +x install.sh config-menu.sh 安装完成后脚本会: 1. **自动询问是否启动服务**(推荐选择 Y) -2. 后台启动 ClawdBot Gateway +2. 后台启动 OpenClaw Gateway 3. 可选打开配置菜单进行渠道配置 如果需要后续管理: ```bash # 手动启动服务 -source ~/.clawdbot/env && clawdbot gateway +source ~/.openclaw/env && openclaw gateway # 后台启动服务 -clawdbot gateway start +openclaw gateway start # 运行配置菜单进行详细配置 -bash ~/.clawdbot/config-menu.sh +bash ~/.openclaw/config-menu.sh # 或从 GitHub 下载运行 -curl -fsSL https://raw.githubusercontent.com/miaoxworld/ClawdBotInstaller/main/config-menu.sh | bash +curl -fsSL https://raw.githubusercontent.com/miaoxworld/OpenClawInstaller/main/config-menu.sh | bash ``` ## ⚙️ 详细配置 @@ -160,7 +162,7 @@ curl -fsSL https://raw.githubusercontent.com/miaoxworld/ClawdBotInstaller/main/c 运行配置菜单后选择 `[2] AI 模型配置`,可选择多种 AI 提供商:

- AI 模型配置界面 + OpenClaw AI 模型配置界面

#### Anthropic Claude 配置 @@ -168,7 +170,7 @@ curl -fsSL https://raw.githubusercontent.com/miaoxworld/ClawdBotInstaller/main/c 1. 在配置菜单中选择 Anthropic Claude 2. **先输入自定义 API 地址**(留空使用官方 API) 3. 输入 API Key(官方 Key 从 [Anthropic Console](https://console.anthropic.com/) 获取) -4. 选择模型(推荐 Sonnet 4) +4. 选择模型(推荐 Sonnet 4.5) > 💡 支持 OneAPI/NewAPI 等第三方代理服务,只需填入对应的 API 地址和 Key @@ -177,7 +179,7 @@ curl -fsSL https://raw.githubusercontent.com/miaoxworld/ClawdBotInstaller/main/c 1. 在配置菜单中选择 OpenAI GPT 2. **先输入自定义 API 地址**(留空使用官方 API) 3. 输入 API Key(官方 Key 从 [OpenAI Platform](https://platform.openai.com/) 获取) -4. 选择模型 +4. 选择模型(推荐 GPT-4o) #### Ollama 本地模型 @@ -186,7 +188,7 @@ curl -fsSL https://raw.githubusercontent.com/miaoxworld/ClawdBotInstaller/main/c curl -fsSL https://ollama.ai/install.sh | sh # 2. 下载模型 -ollama pull llama3 +ollama pull llama3.3 # 3. 在配置菜单中选择 Ollama # 输入服务地址:http://localhost:11434 @@ -197,14 +199,14 @@ ollama pull llama3 1. 访问 [Groq Console](https://console.groq.com/) 获取 API Key 2. 在配置菜单中选择 Groq 3. 输入 API Key -4. 选择模型(推荐 llama-3.3-70b-versatile) +4. 选择模型(推荐 llama-3.3-70b-versatile 或 llama-4) #### Google Gemini -1. 访问 [Google AI Studio](https://makersuite.google.com/app/apikey) 获取 API Key +1. 访问 [Google AI Studio](https://aistudio.google.com/app/apikey) 获取 API Key 2. 在配置菜单中选择 Google Gemini 3. 输入 API Key -4. 选择模型(推荐 gemini-2.0-flash) +4. 选择模型(推荐 gemini-2.0-flash 或 gemini-2.5-pro) ### 配置 Telegram 机器人 @@ -247,72 +249,102 @@ ollama pull llama3 ```bash # 启动服务(后台守护进程) -clawdbot gateway start +openclaw gateway start # 停止服务 -clawdbot gateway stop +openclaw gateway stop -# 重启服务 -clawdbot gateway restart +# 查看服务状态(表格格式,包含 OS/update/gateway/daemon/agents/sessions) +openclaw status -# 查看服务状态 -clawdbot gateway status +# 查看完整状态报告 +openclaw status --all # 前台运行(用于调试) -clawdbot gateway +openclaw gateway --port 18789 --verbose # 查看日志 -clawdbot logs +openclaw logs # 实时日志 -clawdbot logs --follow +openclaw logs --follow ``` ### 配置管理 ```bash # 打开配置文件 -clawdbot config +openclaw config # 运行配置向导 -clawdbot onboard +openclaw onboard --install-daemon # 诊断配置问题 -clawdbot doctor +openclaw doctor # 健康检查 -clawdbot health +openclaw health +``` + +### 消息发送(v2026.1.9+ 新格式) + +```bash +# 发送消息(必须指定 provider,除非只配置了一个) +openclaw message send --to +1234567890 --message "Hello" --provider + +# 轮询消息 +openclaw message poll --provider +``` + +### Agent 交互 + +```bash +# 与助手对话 +openclaw agent --message "Ship checklist" --thinking high + +# 本地测试 +openclaw agent --local --to "+1234567890" --message "Test message" +``` + +### 更新命令(v2026.1.10+ 新增) + +```bash +# 更新到最新版本 +openclaw update + +# 或简写形式 +openclaw --update ``` ### 数据管理 ```bash # 导出对话历史 -clawdbot export --format json +openclaw export --format json # 清理记忆 -clawdbot memory clear +openclaw memory clear # 备份数据 -clawdbot backup +openclaw backup ``` ## 📋 配置说明 -ClawdBot 使用以下配置方式: +OpenClaw 使用以下配置方式: -- **环境变量**: `~/.clawdbot/env` - 存储 API Key 和 Base URL -- **ClawdBot 配置**: `~/.clawdbot/clawdbot.json` - ClawdBot 内部配置(自动管理) -- **命令行工具**: `clawdbot config set` / `clawdbot models set` 等 +- **环境变量**: `~/.openclaw/env` - 存储 API Key 和 Base URL +- **OpenClaw 配置**: `~/.openclaw/openclaw.json` - OpenClaw 内部配置(自动管理) +- **命令行工具**: `openclaw config set` / `openclaw models set` 等 > 💡 **注意**:配置主要通过安装向导或 `config-menu.sh` 完成,无需手动编辑配置文件 ### 环境变量配置示例 -`~/.clawdbot/env` 文件内容: +`~/.openclaw/env` 文件内容: ```bash -# ClawdBot 环境变量配置 +# OpenClaw 环境变量配置 export ANTHROPIC_API_KEY=sk-ant-xxxxx export ANTHROPIC_BASE_URL=https://your-api-proxy.com # 可选,自定义 API 地址 @@ -323,7 +355,7 @@ export OPENAI_BASE_URL=https://your-api-proxy.com/v1 # 可选 ### 自定义 Provider 配置 -当使用自定义 API 地址时,安装脚本会自动在 `~/.clawdbot/clawdbot.json` 中配置自定义 Provider: +当使用自定义 API 地址时,安装脚本会自动在 `~/.openclaw/openclaw.json` 中配置自定义 Provider: ```json { @@ -351,44 +383,59 @@ export OPENAI_BASE_URL=https://your-api-proxy.com/v1 # 可选 ### 目录结构 ``` -~/.clawdbot/ -├── clawdbot.json # ClawdBot 核心配置 +~/.openclaw/ +├── openclaw.json # OpenClaw 核心配置 ├── env # 环境变量 (API Key 等) ├── backups/ # 配置备份 -└── logs/ # 日志文件 (由 ClawdBot 管理) +└── logs/ # 日志文件 (由 OpenClaw 管理) ``` ## 🛡️ 安全建议 -> ⚠️ **重要警告**:ClawdBot 需要完全的计算机权限,请务必注意安全! +> ⚠️ **重要警告**:OpenClaw 需要完全的计算机权限,请务必注意安全! ### 部署建议 1. **不要在主工作电脑上部署** - 建议使用专用服务器或虚拟机 2. **使用 AWS/GCP/Azure 免费实例** - 隔离环境更安全 3. **Docker 部署** - 提供额外的隔离层 +4. **沙箱模式** - 设置 `agents.defaults.sandbox.mode: "non-main"` 运行非主会话在 Docker 沙箱中 ### 权限控制 1. **禁用危险功能**(默认已禁用) - ```yaml - security: - enable_shell_commands: false - enable_file_access: false + ```json + { + "security": { + "enable_shell_commands": false, + "enable_file_access": false + } + } ``` -2. **启用沙箱模式** - ```yaml - security: - sandbox_mode: true +2. **启用沙箱模式**(推荐用于非主会话) + ```json + { + "agents": { + "defaults": { + "sandbox": { + "mode": "non-main" + } + } + } + } ``` -3. **限制允许的用户** - ```yaml - channels: - telegram: - allowed_users: - - "only-your-user-id" +3. **DM 配对策略**(防止未知用户访问) + ```json + { + "channels": { + "telegram": { + "dmPolicy": "pairing", + "allowFrom": ["your-user-id"] + } + } + } ``` ### API Key 安全 @@ -396,6 +443,7 @@ export OPENAI_BASE_URL=https://your-api-proxy.com/v1 # 可选 - 定期轮换 API Key - 不要在公开仓库中提交配置文件 - 使用环境变量存储敏感信息 +- 使用 `openclaw doctor` 检查配置安全性 ```bash # 使用环境变量 @@ -407,6 +455,8 @@ export TELEGRAM_BOT_TOKEN="xxx" ### Q: 安装时提示 Node.js 版本过低? +OpenClaw 需要 Node.js v22 或更高版本。 + ```bash # macOS brew install node@22 @@ -419,52 +469,70 @@ sudo apt-get install -y nodejs ### Q: 启动后无法连接? -1. 检查配置文件是否正确 -2. 运行诊断命令:`clawdbot doctor` -3. 查看日志:`clawdbot logs` +1. 检查配置文件是否正确 (`~/.openclaw/openclaw.json`) +2. 运行诊断命令:`openclaw doctor` +3. 查看日志:`openclaw logs` +4. 检查健康状态:`openclaw health` ### Q: Telegram 机器人没有响应? 1. 确认 Bot Token 正确 -2. 确认 User ID 在 allowed_users 列表中 -3. 检查网络连接(可能需要代理) +2. 确认 User ID 在 `allowFrom` 列表中 +3. 检查 DM 配对策略设置 +4. 检查网络连接(可能需要代理) +5. 运行 `openclaw channels list` 查看渠道状态 ### Q: 如何更新到最新版本? ```bash -# 使用 npm 更新 -npm update -g clawdbot +# 方法 1: 使用 openclaw update 命令 (v2026.1.10+) +openclaw update + +# 或简写 +openclaw --update -# 或使用配置菜单 +# 方法 2: 使用 npm 更新 +npm update -g openclaw + +# 方法 3: 使用配置菜单 ./config-menu.sh -# 选择 [7] 高级设置 → [7] 更新 ClawdBot +# 选择 [7] 高级设置 → [7] 更新 OpenClaw ``` ### Q: 如何备份数据? ```bash # 手动备份 -cp -r ~/.clawdbot ~/clawdbot_backup_$(date +%Y%m%d) +cp -r ~/.openclaw ~/openclaw_backup_$(date +%Y%m%d) # 使用命令备份 -clawdbot backup +openclaw backup ``` ### Q: 如何完全卸载? ```bash # 停止服务 -clawdbot gateway stop +openclaw gateway stop # 卸载程序 -npm uninstall -g clawdbot +npm uninstall -g openclaw # 删除配置(可选) -rm -rf ~/.clawdbot +rm -rf ~/.openclaw ``` ## 📜 更新日志 +### v1.1.0 (2026-01-30) +- 🔄 同步 OpenClaw v2026.1.24 命令变更 +- 📝 命令从 `clawdbot` 更改为 `openclaw` +- ⚠️ `message` 命令改为子命令格式 `message send|poll|...` +- ✨ 新增 `openclaw update` 更新命令 +- ✨ 新增 `openclaw status --all` 完整状态报告 +- 🔒 更新安全配置说明(DM 配对策略) +- 📚 完善文档和常见问题 + ### v1.0.0 (2026-01-29) - 🎉 首次发布 - ✨ 支持一键安装部署 @@ -480,11 +548,12 @@ rm -rf ~/.clawdbot ## 🔗 相关链接 -- [ClawdBot 官网](https://clawd.bot) -- [官方文档](https://clawd.bot/docs) -- [安装工具仓库](https://github.com/miaoxworld/ClawdBotInstaller) -- [ClawdBot 主仓库](https://github.com/clawdbot/clawdbot) -- [社区讨论](https://github.com/miaoxworld/ClawdBotInstaller/discussions) +- [OpenClaw 官网](https://openclaw.ai) +- [官方文档](https://docs.openclaw.ai) +- [安装工具仓库](https://github.com/miaoxworld/OpenClawInstaller) +- [OpenClaw 主仓库](https://github.com/openclaw/openclaw) +- [社区 Discord](https://discord.gg/clawd) +- [社区讨论](https://github.com/miaoxworld/OpenClawInstaller/discussions) --- diff --git a/config-menu.sh b/config-menu.sh index 94de4657..955845e4 100755 --- a/config-menu.sh +++ b/config-menu.sh @@ -2,7 +2,7 @@ # # ╔═══════════════════════════════════════════════════════════════════════════╗ # ║ ║ -# ║ 🦞 ClawdBot 交互式配置菜单 v1.0.0 ║ +# ║ 🦞 OpenClaw 交互式配置菜单 v1.0.0 ║ # ║ 便捷的可视化配置工具 ║ # ║ ║ # ╚═══════════════════════════════════════════════════════════════════════════╝ @@ -50,11 +50,11 @@ BG_GREEN='\033[42m' BG_RED='\033[41m' # ================================ 配置变量 ================================ -CONFIG_DIR="$HOME/.clawdbot" +CONFIG_DIR="$HOME/.openclaw" -# ClawdBot 环境变量配置 -CLAWDBOT_ENV="$CONFIG_DIR/env" -CLAWDBOT_JSON="$CONFIG_DIR/clawdbot.json" +# OpenClaw 环境变量配置 +OPENCLAW_ENV="$CONFIG_DIR/env" +OPENCLAW_JSON="$CONFIG_DIR/openclaw.json" BACKUP_DIR="$CONFIG_DIR/backups" # ================================ 工具函数 ================================ @@ -68,7 +68,7 @@ print_header() { cat << 'EOF' ╔═══════════════════════════════════════════════════════════════╗ ║ ║ - ║ 🦞 ClawdBot 配置中心 ║ + ║ 🦞 OpenClaw 配置中心 ║ ║ ║ ╚═══════════════════════════════════════════════════════════════╝ EOF @@ -138,8 +138,8 @@ check_dependencies() { backup_config() { mkdir -p "$BACKUP_DIR" local backup_file="$BACKUP_DIR/env_$(date +%Y%m%d_%H%M%S).bak" - if [ -f "$CLAWDBOT_ENV" ]; then - cp "$CLAWDBOT_ENV" "$backup_file" + if [ -f "$OPENCLAW_ENV" ]; then + cp "$OPENCLAW_ENV" "$backup_file" echo "$backup_file" fi } @@ -147,16 +147,16 @@ backup_config() { # 从环境变量文件读取配置 get_env_value() { local key=$1 - if [ -f "$CLAWDBOT_ENV" ]; then - grep "^export $key=" "$CLAWDBOT_ENV" 2>/dev/null | sed 's/.*=//' | tr -d '"' + if [ -f "$OPENCLAW_ENV" ]; then + grep "^export $key=" "$OPENCLAW_ENV" 2>/dev/null | sed 's/.*=//' | tr -d '"' fi } # ================================ 测试功能 ================================ -# 检查 ClawdBot 是否已安装 -check_clawdbot_installed() { - command -v clawdbot &> /dev/null +# 检查 OpenClaw 是否已安装 +check_openclaw_installed() { + command -v openclaw &> /dev/null } # 重启 Gateway 使渠道配置生效 @@ -165,14 +165,14 @@ restart_gateway_for_channel() { log_info "正在重启 Gateway..." # 先尝试停止 - clawdbot gateway stop 2>/dev/null || true - pkill -f "clawdbot.*gateway" 2>/dev/null || true + openclaw gateway stop 2>/dev/null || true + pkill -f "openclaw.*gateway" 2>/dev/null || true sleep 2 # 加载环境变量 - if [ -f "$CLAWDBOT_ENV" ]; then - source "$CLAWDBOT_ENV" - log_info "已加载环境变量: $CLAWDBOT_ENV" + if [ -f "$OPENCLAW_ENV" ]; then + source "$OPENCLAW_ENV" + log_info "已加载环境变量: $OPENCLAW_ENV" fi # 后台启动 Gateway(使用 setsid 完全脱离终端) @@ -180,17 +180,17 @@ restart_gateway_for_channel() { # 使用 setsid 创建新会话,确保进程完全独立 if command -v setsid &> /dev/null; then - if [ -f "$CLAWDBOT_ENV" ]; then - setsid bash -c "source $CLAWDBOT_ENV && exec clawdbot gateway --port 18789" > /tmp/clawdbot-gateway.log 2>&1 & + if [ -f "$OPENCLAW_ENV" ]; then + setsid bash -c "source $OPENCLAW_ENV && exec openclaw gateway --port 18789" > /tmp/openclaw-gateway.log 2>&1 & else - setsid clawdbot gateway --port 18789 > /tmp/clawdbot-gateway.log 2>&1 & + setsid openclaw gateway --port 18789 > /tmp/openclaw-gateway.log 2>&1 & fi else # 备用方案:nohup + disown - if [ -f "$CLAWDBOT_ENV" ]; then - nohup bash -c "source $CLAWDBOT_ENV && exec clawdbot gateway --port 18789" > /tmp/clawdbot-gateway.log 2>&1 & + if [ -f "$OPENCLAW_ENV" ]; then + nohup bash -c "source $OPENCLAW_ENV && exec openclaw gateway --port 18789" > /tmp/openclaw-gateway.log 2>&1 & else - nohup clawdbot gateway --port 18789 > /tmp/clawdbot-gateway.log 2>&1 & + nohup openclaw gateway --port 18789 > /tmp/openclaw-gateway.log 2>&1 & fi disown 2>/dev/null || true fi @@ -198,21 +198,21 @@ restart_gateway_for_channel() { sleep 3 # 检查是否启动成功 - if pgrep -f "clawdbot.*gateway" > /dev/null 2>&1; then + if pgrep -f "openclaw.*gateway" > /dev/null 2>&1; then log_info "Gateway 已在后台启动!" echo "" - echo -e "${CYAN}查看日志: ${WHITE}tail -f /tmp/clawdbot-gateway.log${NC}" - echo -e "${CYAN}停止服务: ${WHITE}clawdbot gateway stop${NC}" + echo -e "${CYAN}查看日志: ${WHITE}tail -f /tmp/openclaw-gateway.log${NC}" + echo -e "${CYAN}停止服务: ${WHITE}openclaw gateway stop${NC}" else log_warn "Gateway 可能未正常启动" - echo -e "${YELLOW}请手动启动: source ~/.clawdbot/env && clawdbot gateway${NC}" + echo -e "${YELLOW}请手动启动: source ~/.openclaw/env && openclaw gateway${NC}" fi } -# 检查 ClawdBot Gateway 是否运行 +# 检查 OpenClaw Gateway 是否运行 check_gateway_running() { - if check_clawdbot_installed; then - clawdbot health &>/dev/null + if check_openclaw_installed; then + openclaw health &>/dev/null return $? fi return 1 @@ -229,26 +229,26 @@ test_ai_connection() { echo -e "${CYAN}━━━ 测试 AI 配置 ━━━${NC}" echo "" - if ! check_clawdbot_installed; then - log_error "ClawdBot 未安装" + if ! check_openclaw_installed; then + log_error "OpenClaw 未安装" return 1 fi # 确保环境变量已加载 - [ -f "$CLAWDBOT_ENV" ] && source "$CLAWDBOT_ENV" + [ -f "$OPENCLAW_ENV" ] && source "$OPENCLAW_ENV" # 显示当前模型配置 echo -e "${CYAN}当前模型配置:${NC}" - clawdbot models status 2>&1 | grep -E "Default|Auth|effective" | head -5 + openclaw models status 2>&1 | grep -E "Default|Auth|effective" | head -5 echo "" - # 使用 clawdbot agent --local 测试 - echo -e "${YELLOW}运行 clawdbot agent --local 测试...${NC}" + # 使用 openclaw agent --local 测试 + echo -e "${YELLOW}运行 openclaw agent --local 测试...${NC}" echo "" local result # 添加 || true 防止命令失败导致函数退出 - result=$(clawdbot agent --local --to "+1234567890" --message "回复 OK" 2>&1) || true + result=$(openclaw agent --local --to "+1234567890" --message "回复 OK" 2>&1) || true local exit_code=$? # 过滤掉 Node.js 警告信息 @@ -256,7 +256,7 @@ test_ai_connection() { echo "" if [ $exit_code -eq 0 ] && ! echo "$result" | grep -qiE "error|failed|401|403|Unknown model"; then - log_info "ClawdBot AI 测试成功!" + log_info "OpenClaw AI 测试成功!" echo "" # 显示 AI 响应(过滤掉空行) local ai_response=$(echo "$result" | grep -v "^$" | head -5) @@ -266,7 +266,7 @@ test_ai_connection() { fi return 0 else - log_error "ClawdBot AI 测试失败" + log_error "OpenClaw AI 测试失败" echo "" echo -e " ${RED}错误信息:${NC}" echo "$result" | head -5 | sed 's/^/ /' @@ -274,17 +274,17 @@ test_ai_connection() { # 提供修复建议 if echo "$result" | grep -q "Unknown model"; then - echo -e "${YELLOW}提示: 模型不被 ClawdBot 识别${NC}" - echo " 运行: clawdbot configure --section model" + echo -e "${YELLOW}提示: 模型不被 OpenClaw 识别${NC}" + echo " 运行: openclaw configure --section model" elif echo "$result" | grep -q "401\|Incorrect API key"; then echo -e "${YELLOW}提示: API Key 无效或 Base URL 配置不正确${NC}" - echo " ClawdBot 可能不支持自定义 API 地址" - echo " 运行: clawdbot configure --section model" + echo " OpenClaw 可能不支持自定义 API 地址" + echo " 运行: openclaw configure --section model" fi echo "" echo " 其他诊断命令:" - echo " clawdbot doctor" - echo " clawdbot models status" + echo " openclaw doctor" + echo " openclaw models status" return 1 fi } @@ -410,7 +410,7 @@ test_telegram_bot() { echo "" echo -e "${YELLOW}2. 发送测试消息...${NC}" - local message="🦞 ClawdBot 测试消息 + local message="🦞 OpenClaw 测试消息 这是一条来自配置工具的测试消息。 如果你收到这条消息,说明 Telegram 机器人配置成功! @@ -521,7 +521,7 @@ if len(guilds) > 5: # 使用单行消息避免 JSON 格式问题 local timestamp=$(date '+%Y-%m-%d %H:%M:%S') - local message="🦞 **ClawdBot 测试消息** - 配置成功!时间: $timestamp" + local message="🦞 **OpenClaw 测试消息** - 配置成功!时间: $timestamp" # 使用 python 正确编码 JSON local json_payload @@ -650,104 +650,104 @@ test_ollama_connection() { fi } -# 测试 WhatsApp (通过 clawdbot status) +# 测试 WhatsApp (通过 openclaw status) test_whatsapp() { echo "" echo -e "${CYAN}━━━ 测试 WhatsApp 连接 ━━━${NC}" echo "" - if check_clawdbot_installed; then + if check_openclaw_installed; then echo -e "${YELLOW}检查 WhatsApp 渠道状态...${NC}" echo "" - clawdbot status 2>/dev/null | grep -i whatsapp || echo "WhatsApp 渠道未配置" + openclaw status 2>/dev/null | grep -i whatsapp || echo "WhatsApp 渠道未配置" echo "" - echo -e "${CYAN}提示: 使用 'clawdbot channels login' 配置 WhatsApp${NC}" + echo -e "${CYAN}提示: 使用 'openclaw channels login' 配置 WhatsApp${NC}" return 0 else - log_warn "WhatsApp 测试需要 ClawdBot 已安装" - echo -e "${YELLOW}请先完成 ClawdBot 安装${NC}" + log_warn "WhatsApp 测试需要 OpenClaw 已安装" + echo -e "${YELLOW}请先完成 OpenClaw 安装${NC}" return 1 fi } -# 测试 iMessage (通过 clawdbot status) +# 测试 iMessage (通过 openclaw status) test_imessage() { echo "" echo -e "${CYAN}━━━ 测试 iMessage 连接 ━━━${NC}" echo "" - if check_clawdbot_installed; then + if check_openclaw_installed; then echo -e "${YELLOW}检查 iMessage 渠道状态...${NC}" echo "" - clawdbot status 2>/dev/null | grep -i imessage || echo "iMessage 渠道未配置" + openclaw status 2>/dev/null | grep -i imessage || echo "iMessage 渠道未配置" return 0 else - log_warn "iMessage 测试需要 ClawdBot 已安装" - echo -e "${YELLOW}请先完成 ClawdBot 安装${NC}" + log_warn "iMessage 测试需要 OpenClaw 已安装" + echo -e "${YELLOW}请先完成 OpenClaw 安装${NC}" return 1 fi } -# 测试微信 (通过 clawdbot status) +# 测试微信 (通过 openclaw status) test_wechat() { echo "" echo -e "${CYAN}━━━ 测试微信连接 ━━━${NC}" echo "" - if check_clawdbot_installed; then + if check_openclaw_installed; then echo -e "${YELLOW}检查微信渠道状态...${NC}" echo "" - clawdbot status 2>/dev/null | grep -i wechat || echo "微信渠道未配置" + openclaw status 2>/dev/null | grep -i wechat || echo "微信渠道未配置" return 0 else - log_warn "微信测试需要 ClawdBot 已安装" - echo -e "${YELLOW}请先完成 ClawdBot 安装${NC}" + log_warn "微信测试需要 OpenClaw 已安装" + echo -e "${YELLOW}请先完成 OpenClaw 安装${NC}" return 1 fi } -# 运行 ClawdBot 诊断 (使用 clawdbot doctor) -run_clawdbot_doctor() { +# 运行 OpenClaw 诊断 (使用 openclaw doctor) +run_openclaw_doctor() { echo "" - echo -e "${CYAN}━━━ ClawdBot 诊断 ━━━${NC}" + echo -e "${CYAN}━━━ OpenClaw 诊断 ━━━${NC}" echo "" - if check_clawdbot_installed; then - clawdbot doctor + if check_openclaw_installed; then + openclaw doctor return $? else - log_error "ClawdBot 未安装" - echo -e "${YELLOW}请先运行 install.sh 安装 ClawdBot${NC}" + log_error "OpenClaw 未安装" + echo -e "${YELLOW}请先运行 install.sh 安装 OpenClaw${NC}" return 1 fi } -# 运行 ClawdBot 状态检查 (使用 clawdbot status) -run_clawdbot_status() { +# 运行 OpenClaw 状态检查 (使用 openclaw status) +run_openclaw_status() { echo "" - echo -e "${CYAN}━━━ ClawdBot 状态 ━━━${NC}" + echo -e "${CYAN}━━━ OpenClaw 状态 ━━━${NC}" echo "" - if check_clawdbot_installed; then - clawdbot status + if check_openclaw_installed; then + openclaw status return $? else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" return 1 fi } -# 运行 ClawdBot 健康检查 (使用 clawdbot health) -run_clawdbot_health() { +# 运行 OpenClaw 健康检查 (使用 openclaw health) +run_openclaw_health() { echo "" echo -e "${CYAN}━━━ Gateway 健康检查 ━━━${NC}" echo "" - if check_clawdbot_installed; then - clawdbot health + if check_openclaw_installed; then + openclaw health return $? else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" return 1 fi } @@ -762,39 +762,39 @@ show_status() { print_divider echo "" - # ClawdBot 服务状态 - if command -v clawdbot &> /dev/null; then - echo -e " ${GREEN}✓${NC} ClawdBot 已安装: $(clawdbot --version 2>/dev/null || echo 'unknown')" + # OpenClaw 服务状态 + if command -v openclaw &> /dev/null; then + echo -e " ${GREEN}✓${NC} OpenClaw 已安装: $(openclaw --version 2>/dev/null || echo 'unknown')" # 检查服务运行状态 - if pgrep -f "clawdbot" > /dev/null 2>&1; then + if pgrep -f "openclaw" > /dev/null 2>&1; then echo -e " ${GREEN}●${NC} 服务状态: ${GREEN}运行中${NC}" else echo -e " ${RED}●${NC} 服务状态: ${RED}已停止${NC}" fi else - echo -e " ${RED}✗${NC} ClawdBot 未安装" + echo -e " ${RED}✗${NC} OpenClaw 未安装" fi echo "" # 当前配置 - if [ -f "$CLAWDBOT_ENV" ]; then + if [ -f "$OPENCLAW_ENV" ]; then echo "" echo -e " ${CYAN}当前配置:${NC}" - # 显示 ClawdBot 模型配置 - if check_clawdbot_installed; then - local default_model=$(clawdbot config get models.default 2>/dev/null || echo "未配置") + # 显示 OpenClaw 模型配置 + if check_openclaw_installed; then + local default_model=$(openclaw config get models.default 2>/dev/null || echo "未配置") echo -e " • 默认模型: ${WHITE}$default_model${NC}" fi # 检查 API Key 配置 - if grep -q "ANTHROPIC_API_KEY" "$CLAWDBOT_ENV" 2>/dev/null; then + if grep -q "ANTHROPIC_API_KEY" "$OPENCLAW_ENV" 2>/dev/null; then echo -e " • AI 提供商: ${WHITE}Anthropic${NC}" - elif grep -q "OPENAI_API_KEY" "$CLAWDBOT_ENV" 2>/dev/null; then + elif grep -q "OPENAI_API_KEY" "$OPENCLAW_ENV" 2>/dev/null; then echo -e " • AI 提供商: ${WHITE}OpenAI${NC}" - elif grep -q "GOOGLE_API_KEY" "$CLAWDBOT_ENV" 2>/dev/null; then + elif grep -q "GOOGLE_API_KEY" "$OPENCLAW_ENV" 2>/dev/null; then echo -e " • AI 提供商: ${WHITE}Google${NC}" fi else @@ -806,8 +806,8 @@ show_status() { # 目录状态 echo -e " ${CYAN}目录结构:${NC}" [ -d "$CONFIG_DIR" ] && echo -e " ${GREEN}✓${NC} 配置目录: $CONFIG_DIR" || echo -e " ${RED}✗${NC} 配置目录" - [ -f "$CLAWDBOT_ENV" ] && echo -e " ${GREEN}✓${NC} 环境变量: $CLAWDBOT_ENV" || echo -e " ${RED}✗${NC} 环境变量" - [ -f "$CLAWDBOT_JSON" ] && echo -e " ${GREEN}✓${NC} ClawdBot 配置: $CLAWDBOT_JSON" || echo -e " ${YELLOW}⚠${NC} ClawdBot 配置" + [ -f "$OPENCLAW_ENV" ] && echo -e " ${GREEN}✓${NC} 环境变量: $OPENCLAW_ENV" || echo -e " ${RED}✗${NC} 环境变量" + [ -f "$OPENCLAW_JSON" ] && echo -e " ${GREEN}✓${NC} OpenClaw 配置: $OPENCLAW_JSON" || echo -e " ${YELLOW}⚠${NC} OpenClaw 配置" echo "" print_divider @@ -935,8 +935,8 @@ config_anthropic() { *) model="claude-sonnet-4-5-20250929" ;; esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "anthropic" "$api_key" "$model" "$base_url" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "anthropic" "$api_key" "$model" "$base_url" echo "" log_info "Anthropic Claude 配置完成!" @@ -996,8 +996,8 @@ config_openai() { *) model="gpt-4o" ;; esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "openai" "$api_key" "$model" "$base_url" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "openai" "$api_key" "$model" "$base_url" echo "" log_info "OpenAI GPT 配置完成!" @@ -1052,8 +1052,8 @@ config_ollama() { esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "ollama" "" "$model" "$ollama_url" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "ollama" "" "$model" "$ollama_url" echo "" log_info "Ollama 配置完成!" @@ -1090,7 +1090,7 @@ config_openrouter() { fi echo "" - local base_url="" # ClawdBot 不支持自定义 API 地址 + local base_url="" # OpenClaw 不支持自定义 API 地址 base_url=${base_url:-"https://openrouter.ai/api/v1"} echo "" @@ -1116,8 +1116,8 @@ config_openrouter() { esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "openrouter" "$api_key" "$model" "$base_url" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "openrouter" "$api_key" "$model" "$base_url" echo "" log_info "OpenRouter 配置完成!" @@ -1152,7 +1152,7 @@ config_google_gemini() { return fi echo "" - local base_url="" # ClawdBot 不支持自定义 API 地址 + local base_url="" # OpenClaw 不支持自定义 API 地址 echo "" echo -e "${CYAN}选择模型:${NC}" @@ -1175,8 +1175,8 @@ config_google_gemini() { esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "google" "$api_key" "$model" "$base_url" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "google" "$api_key" "$model" "$base_url" echo "" log_info "Google Gemini 配置完成!" @@ -1245,7 +1245,7 @@ config_groq() { return fi echo "" - local base_url="" # ClawdBot 不支持自定义 API 地址 + local base_url="" # OpenClaw 不支持自定义 API 地址 base_url=${base_url:-"https://api.groq.com/openai/v1"} echo "" @@ -1271,8 +1271,8 @@ config_groq() { esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "groq" "$api_key" "$model" "$base_url" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "groq" "$api_key" "$model" "$base_url" echo "" log_info "Groq 配置完成!" @@ -1307,7 +1307,7 @@ config_mistral() { return fi echo "" - local base_url="" # ClawdBot 不支持自定义 API 地址 + local base_url="" # OpenClaw 不支持自定义 API 地址 base_url=${base_url:-"https://api.mistral.ai/v1"} echo "" @@ -1331,8 +1331,8 @@ config_mistral() { esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "mistral" "$api_key" "$model" "$base_url" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "mistral" "$api_key" "$model" "$base_url" echo "" log_info "Mistral AI 配置完成!" @@ -1392,8 +1392,8 @@ config_xai() { *) model="grok-4-fast" ;; esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "xai" "$api_key" "$model" "" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "xai" "$api_key" "$model" "" echo "" log_info "xAI Grok 配置完成!" @@ -1452,8 +1452,8 @@ config_zai() { *) model="glm-4.7" ;; esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "zai" "$api_key" "$model" "" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "zai" "$api_key" "$model" "" echo "" log_info "智谱 GLM 配置完成!" @@ -1520,8 +1520,8 @@ config_minimax() { *) model="MiniMax-M2.1" ;; esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "$provider" "$api_key" "$model" "" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "$provider" "$api_key" "$model" "" echo "" log_info "MiniMax 配置完成!" @@ -1586,8 +1586,8 @@ config_opencode() { *) model="claude-sonnet-4-5" ;; esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "opencode" "$api_key" "$model" "" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "opencode" "$api_key" "$model" "" echo "" log_info "OpenCode 配置完成!" @@ -1648,8 +1648,8 @@ config_google_gemini_cli() { *) model="gemini-3-pro-preview" ;; esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "google-gemini-cli" "$api_key" "$model" "" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "google-gemini-cli" "$api_key" "$model" "" echo "" log_info "Google Gemini CLI 配置完成!" @@ -1713,8 +1713,8 @@ config_google_antigravity() { *) model="gemini-3-pro-high" ;; esac - # 保存到 ClawdBot 环境变量配置 - save_clawdbot_ai_config "google-antigravity" "$api_key" "$model" "" + # 保存到 OpenClaw 环境变量配置 + save_openclaw_ai_config "google-antigravity" "$api_key" "$model" "" echo "" log_info "Google Antigravity 配置完成!" @@ -1787,18 +1787,18 @@ config_telegram() { if [ -n "$bot_token" ] && [ -n "$user_id" ]; then - # 使用 clawdbot 命令配置 - if check_clawdbot_installed; then + # 使用 openclaw 命令配置 + if check_openclaw_installed; then echo "" - log_info "正在配置 ClawdBot Telegram 渠道..." + log_info "正在配置 OpenClaw Telegram 渠道..." # 启用 Telegram 插件 echo -e "${YELLOW}启用 Telegram 插件...${NC}" - clawdbot plugins enable telegram 2>/dev/null || true + openclaw plugins enable telegram 2>/dev/null || true # 添加 Telegram channel echo -e "${YELLOW}添加 Telegram 账号...${NC}" - if clawdbot channels add --channel telegram --token "$bot_token" 2>/dev/null; then + if openclaw channels add --channel telegram --token "$bot_token" 2>/dev/null; then log_info "Telegram 渠道配置成功!" else log_warn "Telegram 渠道可能已存在或配置失败" @@ -1819,7 +1819,7 @@ config_telegram() { restart_gateway_for_channel fi else - log_error "ClawdBot 未安装,请先安装 ClawdBot" + log_error "OpenClaw 未安装,请先安装 OpenClaw" fi # 询问是否测试 @@ -1878,18 +1878,18 @@ config_discord() { if [ -n "$bot_token" ] && [ -n "$channel_id" ]; then - # 使用 clawdbot 命令配置 - if check_clawdbot_installed; then + # 使用 openclaw 命令配置 + if check_openclaw_installed; then echo "" - log_info "正在配置 ClawdBot Discord 渠道..." + log_info "正在配置 OpenClaw Discord 渠道..." # 启用 Discord 插件 echo -e "${YELLOW}启用 Discord 插件...${NC}" - clawdbot plugins enable discord 2>/dev/null || true + openclaw plugins enable discord 2>/dev/null || true # 添加 Discord channel echo -e "${YELLOW}添加 Discord 账号...${NC}" - if clawdbot channels add --channel discord --token "$bot_token" 2>/dev/null; then + if openclaw channels add --channel discord --token "$bot_token" 2>/dev/null; then log_info "Discord 渠道配置成功!" else log_warn "Discord 渠道可能已存在或配置失败" @@ -1897,7 +1897,7 @@ config_discord() { # 设置 groupPolicy 为 open(只响应 @ 机器人的消息) echo -e "${YELLOW}设置消息响应策略...${NC}" - clawdbot config set channels.discord.groupPolicy open 2>/dev/null || true + openclaw config set channels.discord.groupPolicy open 2>/dev/null || true log_info "已设置为: 响应 @机器人 的消息" echo "" @@ -1914,7 +1914,7 @@ config_discord() { restart_gateway_for_channel fi else - log_error "ClawdBot 未安装,请先安装 ClawdBot" + log_error "OpenClaw 未安装,请先安装 OpenClaw" fi # 询问是否测试 @@ -1940,8 +1940,8 @@ config_whatsapp() { echo -e "${CYAN}WhatsApp 配置需要扫描二维码登录${NC}" echo "" - if ! check_clawdbot_installed; then - log_error "ClawdBot 未安装,请先运行安装脚本" + if ! check_openclaw_installed; then + log_error "OpenClaw 未安装,请先运行安装脚本" press_enter return fi @@ -1954,12 +1954,12 @@ config_whatsapp() { if confirm "是否继续?"; then # 确保初始化 - ensure_clawdbot_init + ensure_openclaw_init # 启用 WhatsApp 插件 echo "" log_info "启用 WhatsApp 插件..." - clawdbot plugins enable whatsapp 2>/dev/null || true + openclaw plugins enable whatsapp 2>/dev/null || true echo "" log_info "正在启动 WhatsApp 登录向导..." @@ -1967,7 +1967,7 @@ config_whatsapp() { echo "" # 使用 channels login 命令 - clawdbot channels login --channel whatsapp --verbose + openclaw channels login --channel whatsapp --verbose echo "" if confirm "是否重启 Gateway 使配置生效?" "y"; then @@ -2000,18 +2000,18 @@ config_slack() { if [ -n "$bot_token" ] && [ -n "$app_token" ]; then - # 使用 clawdbot 命令配置 - if check_clawdbot_installed; then + # 使用 openclaw 命令配置 + if check_openclaw_installed; then echo "" - log_info "正在配置 ClawdBot Slack 渠道..." + log_info "正在配置 OpenClaw Slack 渠道..." # 启用 Slack 插件 echo -e "${YELLOW}启用 Slack 插件...${NC}" - clawdbot plugins enable slack 2>/dev/null || true + openclaw plugins enable slack 2>/dev/null || true # 添加 Slack channel echo -e "${YELLOW}添加 Slack 账号...${NC}" - if clawdbot channels add --channel slack --bot-token "$bot_token" --app-token "$app_token" 2>/dev/null; then + if openclaw channels add --channel slack --bot-token "$bot_token" --app-token "$app_token" 2>/dev/null; then log_info "Slack 渠道配置成功!" else log_warn "Slack 渠道可能已存在或配置失败" @@ -2055,20 +2055,20 @@ config_wechat() { echo -e "${YELLOW}⚠️ 注意: 微信接入需要第三方工具支持${NC}" echo "" - if ! check_clawdbot_installed; then - log_error "ClawdBot 未安装" + if ! check_openclaw_installed; then + log_error "OpenClaw 未安装" press_enter return fi echo -e "${CYAN}微信接入方案:${NC}" - echo " • ClawdBot 可能通过插件支持微信" - echo " • 请查看 ClawdBot 文档了解详情" + echo " • OpenClaw 可能通过插件支持微信" + echo " • 请查看 OpenClaw 文档了解详情" echo "" # 检查是否有微信相关插件 echo -e "${YELLOW}检查可用插件...${NC}" - local plugins=$(clawdbot plugins list 2>/dev/null | grep -i wechat || echo "") + local plugins=$(openclaw plugins list 2>/dev/null | grep -i wechat || echo "") if [ -n "$plugins" ]; then echo "" @@ -2077,7 +2077,7 @@ config_wechat() { echo "" if confirm "是否启用微信插件?"; then - clawdbot plugins enable wechat 2>/dev/null || true + openclaw plugins enable wechat 2>/dev/null || true log_info "微信插件已启用" if confirm "是否重启 Gateway?" "y"; then @@ -2112,8 +2112,8 @@ config_imessage() { return fi - if ! check_clawdbot_installed; then - log_error "ClawdBot 未安装" + if ! check_openclaw_installed; then + log_error "OpenClaw 未安装" press_enter return fi @@ -2127,17 +2127,17 @@ config_imessage() { if confirm "是否继续配置?"; then # 确保初始化 - ensure_clawdbot_init + ensure_openclaw_init # 启用 iMessage 插件 echo "" log_info "启用 iMessage 插件..." - clawdbot plugins enable imessage 2>/dev/null || true + openclaw plugins enable imessage 2>/dev/null || true # 添加 iMessage channel echo "" log_info "配置 iMessage 渠道..." - clawdbot channels add --channel imessage 2>/dev/null || true + openclaw channels add --channel imessage 2>/dev/null || true echo "" log_info "iMessage 配置完成!" @@ -2159,7 +2159,7 @@ install_feishu_plugin() { echo "" # 检查是否已安装飞书插件 - local installed=$(clawdbot plugins list 2>/dev/null | grep -i feishu || echo "") + local installed=$(openclaw plugins list 2>/dev/null | grep -i feishu || echo "") if [ -n "$installed" ]; then log_info "飞书插件已安装: $installed" @@ -2169,8 +2169,8 @@ install_feishu_plugin() { echo -e "${CYAN}正在安装社区飞书插件 @m1heng-clawd/feishu ...${NC}" echo "" - # 使用 clawdbot plugins install 安装 - if clawdbot plugins install @m1heng-clawd/feishu 2>&1; then + # 使用 openclaw plugins install 安装 + if openclaw plugins install @m1heng-clawd/feishu 2>&1; then echo "" log_info "✅ 飞书插件安装成功!" return 0 @@ -2187,7 +2187,7 @@ install_feishu_plugin() { log_error "插件安装失败" echo "" echo -e "${CYAN}请手动安装:${NC}" - echo " clawdbot plugins install @m1heng-clawd/feishu" + echo " openclaw plugins install @m1heng-clawd/feishu" echo " # 或" echo " npm install -g @m1heng-clawd/feishu" echo "" @@ -2207,8 +2207,8 @@ config_feishu() { echo -e "${YELLOW}⚠️ 注意: 飞书接入通过社区插件支持${NC}" echo "" - if ! check_clawdbot_installed; then - log_error "ClawdBot 未安装" + if ! check_openclaw_installed; then + log_error "OpenClaw 未安装" press_enter return fi @@ -2325,22 +2325,22 @@ config_feishu_app() { echo "" log_info "正在保存配置..." - # 使用 clawdbot config set 命令配置飞书渠道 + # 使用 openclaw config set 命令配置飞书渠道 echo -e "${YELLOW}配置飞书渠道...${NC}" # 设置飞书配置 - clawdbot config set channels.feishu.appId "$feishu_app_id" 2>/dev/null - clawdbot config set channels.feishu.appSecret "$feishu_app_secret" 2>/dev/null - clawdbot config set channels.feishu.enabled true 2>/dev/null + openclaw config set channels.feishu.appId "$feishu_app_id" 2>/dev/null + openclaw config set channels.feishu.appSecret "$feishu_app_secret" 2>/dev/null + openclaw config set channels.feishu.enabled true 2>/dev/null # 设置连接模式为 WebSocket(推荐,无需公网服务器) - clawdbot config set channels.feishu.connectionMode "websocket" 2>/dev/null + openclaw config set channels.feishu.connectionMode "websocket" 2>/dev/null # 设置域名(国内用 feishu,国际用 lark) - clawdbot config set channels.feishu.domain "feishu" 2>/dev/null + openclaw config set channels.feishu.domain "feishu" 2>/dev/null # 设置群组策略 - clawdbot config set channels.feishu.requireMention true 2>/dev/null + openclaw config set channels.feishu.requireMention true 2>/dev/null if [ $? -eq 0 ]; then log_info "飞书渠道配置成功!" @@ -2394,15 +2394,15 @@ config_identity() { print_divider echo "" - if ! check_clawdbot_installed; then - log_error "ClawdBot 未安装" + if ! check_openclaw_installed; then + log_error "OpenClaw 未安装" press_enter return fi # 显示当前配置 echo -e "${CYAN}当前配置:${NC}" - clawdbot config get identity 2>/dev/null || echo " (未配置)" + openclaw config get identity 2>/dev/null || echo " (未配置)" echo "" print_divider echo "" @@ -2411,10 +2411,10 @@ config_identity() { read -p "$(echo -e "${YELLOW}如何称呼你: ${NC}")" user_name read -p "$(echo -e "${YELLOW}时区 (如 Asia/Shanghai): ${NC}")" timezone - # 使用 clawdbot 命令设置 - [ -n "$bot_name" ] && clawdbot config set identity.name "$bot_name" 2>/dev/null - [ -n "$user_name" ] && clawdbot config set identity.user_name "$user_name" 2>/dev/null - [ -n "$timezone" ] && clawdbot config set identity.timezone "$timezone" 2>/dev/null + # 使用 openclaw 命令设置 + [ -n "$bot_name" ] && openclaw config set identity.name "$bot_name" 2>/dev/null + [ -n "$user_name" ] && openclaw config set identity.user_name "$user_name" 2>/dev/null + [ -n "$timezone" ] && openclaw config set identity.timezone "$timezone" 2>/dev/null echo "" log_info "身份配置已更新!" @@ -2448,21 +2448,21 @@ config_security() { case $choice in 1) - if confirm "允许 ClawdBot 执行系统命令?这可能带来安全风险" "n"; then + if confirm "允许 OpenClaw 执行系统命令?这可能带来安全风险" "n"; then log_info "已启用系统命令执行" else log_info "已禁用系统命令执行" fi ;; 2) - if confirm "允许 ClawdBot 读写文件?" "n"; then + if confirm "允许 OpenClaw 读写文件?" "n"; then log_info "已启用文件访问" else log_info "已禁用文件访问" fi ;; 3) - if confirm "允许 ClawdBot 浏览网络?" "y"; then + if confirm "允许 OpenClaw 浏览网络?" "y"; then log_info "已启用网络浏览" else log_info "已禁用网络浏览" @@ -2495,21 +2495,21 @@ config_whitelist() { print_divider echo "" - if ! check_clawdbot_installed; then - log_error "ClawdBot 未安装" + if ! check_openclaw_installed; then + log_error "OpenClaw 未安装" press_enter return fi - echo -e "${CYAN}使用 clawdbot 命令配置白名单:${NC}" + echo -e "${CYAN}使用 openclaw 命令配置白名单:${NC}" echo "" - echo " clawdbot config set security.allowed_paths '/path/to/dir1,/path/to/dir2'" + echo " openclaw config set security.allowed_paths '/path/to/dir1,/path/to/dir2'" echo "" read -p "$(echo -e "${YELLOW}输入允许访问的目录 (逗号分隔): ${NC}")" paths if [ -n "$paths" ]; then - clawdbot config set security.allowed_paths "$paths" 2>/dev/null + openclaw config set security.allowed_paths "$paths" 2>/dev/null log_info "白名单配置已保存" fi } @@ -2525,7 +2525,7 @@ manage_service() { echo "" # 检查服务状态 - if pgrep -f "clawdbot.*gateway" > /dev/null 2>&1; then + if pgrep -f "openclaw.*gateway" > /dev/null 2>&1; then echo -e " 当前状态: ${GREEN}● 运行中${NC}" else echo -e " 当前状态: ${RED}● 已停止${NC}" @@ -2548,26 +2548,26 @@ manage_service() { case $choice in 1) echo "" - if command -v clawdbot &> /dev/null; then + if command -v openclaw &> /dev/null; then # 确保基础配置正确 - ensure_clawdbot_init + ensure_openclaw_init # 加载环境变量 - if [ -f "$CLAWDBOT_ENV" ]; then - source "$CLAWDBOT_ENV" + if [ -f "$OPENCLAW_ENV" ]; then + source "$OPENCLAW_ENV" log_info "已加载环境变量" fi # 先验证配置是否有效 log_info "验证配置..." - local config_check=$(clawdbot doctor 2>&1 | head -5) + local config_check=$(openclaw doctor 2>&1 | head -5) if echo "$config_check" | grep -qi "Config invalid"; then log_error "配置无效,请先修复配置" echo "" echo -e "${YELLOW}错误详情:${NC}" echo "$config_check" | head -10 echo "" - echo -e "${CYAN}建议运行: clawdbot doctor --fix${NC}" + echo -e "${CYAN}建议运行: openclaw doctor --fix${NC}" press_enter manage_service return @@ -2577,137 +2577,137 @@ manage_service() { # 后台启动 Gateway(使用 setsid 完全脱离终端) if command -v setsid &> /dev/null; then - if [ -f "$CLAWDBOT_ENV" ]; then - setsid bash -c "source $CLAWDBOT_ENV && exec clawdbot gateway --port 18789" > /tmp/clawdbot-gateway.log 2>&1 & + if [ -f "$OPENCLAW_ENV" ]; then + setsid bash -c "source $OPENCLAW_ENV && exec openclaw gateway --port 18789" > /tmp/openclaw-gateway.log 2>&1 & else - setsid clawdbot gateway --port 18789 > /tmp/clawdbot-gateway.log 2>&1 & + setsid openclaw gateway --port 18789 > /tmp/openclaw-gateway.log 2>&1 & fi else # 备用方案:nohup + disown - if [ -f "$CLAWDBOT_ENV" ]; then - nohup bash -c "source $CLAWDBOT_ENV && exec clawdbot gateway --port 18789" > /tmp/clawdbot-gateway.log 2>&1 & + if [ -f "$OPENCLAW_ENV" ]; then + nohup bash -c "source $OPENCLAW_ENV && exec openclaw gateway --port 18789" > /tmp/openclaw-gateway.log 2>&1 & else - nohup clawdbot gateway --port 18789 > /tmp/clawdbot-gateway.log 2>&1 & + nohup openclaw gateway --port 18789 > /tmp/openclaw-gateway.log 2>&1 & fi disown 2>/dev/null || true fi sleep 3 - if pgrep -f "clawdbot.*gateway" > /dev/null 2>&1; then + if pgrep -f "openclaw.*gateway" > /dev/null 2>&1; then log_info "服务已在后台启动" - echo -e "${CYAN}日志文件: /tmp/clawdbot-gateway.log${NC}" + echo -e "${CYAN}日志文件: /tmp/openclaw-gateway.log${NC}" # 显示最近的日志 echo "" echo -e "${GRAY}最近日志:${NC}" - tail -5 /tmp/clawdbot-gateway.log 2>/dev/null | sed 's/^/ /' + tail -5 /tmp/openclaw-gateway.log 2>/dev/null | sed 's/^/ /' else log_error "启动失败" echo "" echo -e "${YELLOW}错误日志:${NC}" - tail -10 /tmp/clawdbot-gateway.log 2>/dev/null | sed 's/^/ /' + tail -10 /tmp/openclaw-gateway.log 2>/dev/null | sed 's/^/ /' echo "" - echo -e "${CYAN}建议运行: clawdbot doctor --fix${NC}" + echo -e "${CYAN}建议运行: openclaw doctor --fix${NC}" fi else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" fi ;; 2) echo "" log_info "正在停止服务..." - if command -v clawdbot &> /dev/null; then - clawdbot gateway stop 2>/dev/null || true + if command -v openclaw &> /dev/null; then + openclaw gateway stop 2>/dev/null || true # 确保进程被杀死 - pkill -f "clawdbot.*gateway" 2>/dev/null || true + pkill -f "openclaw.*gateway" 2>/dev/null || true sleep 1 - if ! pgrep -f "clawdbot.*gateway" > /dev/null 2>&1; then + if ! pgrep -f "openclaw.*gateway" > /dev/null 2>&1; then log_info "服务已停止" else log_warn "进程可能仍在运行" fi else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" fi ;; 3) echo "" log_info "正在重启服务..." - if command -v clawdbot &> /dev/null; then - clawdbot gateway stop 2>/dev/null || true - pkill -f "clawdbot.*gateway" 2>/dev/null || true + if command -v openclaw &> /dev/null; then + openclaw gateway stop 2>/dev/null || true + pkill -f "openclaw.*gateway" 2>/dev/null || true sleep 2 - ensure_clawdbot_init + ensure_openclaw_init # 加载环境变量 - if [ -f "$CLAWDBOT_ENV" ]; then - source "$CLAWDBOT_ENV" + if [ -f "$OPENCLAW_ENV" ]; then + source "$OPENCLAW_ENV" fi # 后台启动 Gateway(使用 setsid 完全脱离终端) if command -v setsid &> /dev/null; then - if [ -f "$CLAWDBOT_ENV" ]; then - setsid bash -c "source $CLAWDBOT_ENV && exec clawdbot gateway --port 18789" > /tmp/clawdbot-gateway.log 2>&1 & + if [ -f "$OPENCLAW_ENV" ]; then + setsid bash -c "source $OPENCLAW_ENV && exec openclaw gateway --port 18789" > /tmp/openclaw-gateway.log 2>&1 & else - setsid clawdbot gateway --port 18789 > /tmp/clawdbot-gateway.log 2>&1 & + setsid openclaw gateway --port 18789 > /tmp/openclaw-gateway.log 2>&1 & fi else - if [ -f "$CLAWDBOT_ENV" ]; then - nohup bash -c "source $CLAWDBOT_ENV && exec clawdbot gateway --port 18789" > /tmp/clawdbot-gateway.log 2>&1 & + if [ -f "$OPENCLAW_ENV" ]; then + nohup bash -c "source $OPENCLAW_ENV && exec openclaw gateway --port 18789" > /tmp/openclaw-gateway.log 2>&1 & else - nohup clawdbot gateway --port 18789 > /tmp/clawdbot-gateway.log 2>&1 & + nohup openclaw gateway --port 18789 > /tmp/openclaw-gateway.log 2>&1 & fi disown 2>/dev/null || true fi sleep 3 - if pgrep -f "clawdbot.*gateway" > /dev/null 2>&1; then + if pgrep -f "openclaw.*gateway" > /dev/null 2>&1; then log_info "服务已重启" else log_error "重启失败" fi else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" fi ;; 4) echo "" - if command -v clawdbot &> /dev/null; then - clawdbot status + if command -v openclaw &> /dev/null; then + openclaw status else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" fi ;; 5) echo "" - if command -v clawdbot &> /dev/null; then + if command -v openclaw &> /dev/null; then echo -e "${CYAN}按 Ctrl+C 退出日志查看${NC}" sleep 1 - clawdbot logs --follow + openclaw logs --follow else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" fi ;; 6) echo "" - if command -v clawdbot &> /dev/null; then - clawdbot doctor --fix + if command -v openclaw &> /dev/null; then + openclaw doctor --fix else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" fi ;; 7) echo "" - if command -v clawdbot &> /dev/null; then + if command -v openclaw &> /dev/null; then log_info "正在安装系统服务..." - clawdbot gateway install + openclaw gateway install log_info "系统服务已安装" echo "" echo -e "${CYAN}现在可以使用以下命令管理服务:${NC}" - echo " clawdbot gateway start" - echo " clawdbot gateway stop" - echo " clawdbot gateway restart" + echo " openclaw gateway start" + echo " openclaw gateway stop" + echo " openclaw gateway restart" else - log_error "ClawdBot 未安装" + log_error "OpenClaw 未安装" fi ;; 0) @@ -2719,40 +2719,40 @@ manage_service() { manage_service } -# 确保 ClawdBot 基础配置正确 -ensure_clawdbot_init() { - local CLAWDBOT_DIR="$HOME/.clawdbot" +# 确保 OpenClaw 基础配置正确 +ensure_openclaw_init() { + local OPENCLAW_DIR="$HOME/.openclaw" # 创建必要的目录 - mkdir -p "$CLAWDBOT_DIR/agents/main/sessions" 2>/dev/null || true - mkdir -p "$CLAWDBOT_DIR/agents/main/agent" 2>/dev/null || true - mkdir -p "$CLAWDBOT_DIR/credentials" 2>/dev/null || true + mkdir -p "$OPENCLAW_DIR/agents/main/sessions" 2>/dev/null || true + mkdir -p "$OPENCLAW_DIR/agents/main/agent" 2>/dev/null || true + mkdir -p "$OPENCLAW_DIR/credentials" 2>/dev/null || true # 修复权限 - chmod 700 "$CLAWDBOT_DIR" 2>/dev/null || true + chmod 700 "$OPENCLAW_DIR" 2>/dev/null || true # 确保 gateway.mode 已设置 - local current_mode=$(clawdbot config get gateway.mode 2>/dev/null) + local current_mode=$(openclaw config get gateway.mode 2>/dev/null) if [ -z "$current_mode" ] || [ "$current_mode" = "undefined" ]; then - clawdbot config set gateway.mode local 2>/dev/null || true + openclaw config set gateway.mode local 2>/dev/null || true fi } -# 保存 AI 配置到 ClawdBot 环境变量 -save_clawdbot_ai_config() { +# 保存 AI 配置到 OpenClaw 环境变量 +save_openclaw_ai_config() { local provider="$1" local api_key="$2" local model="$3" local base_url="$4" - ensure_clawdbot_init + ensure_openclaw_init - local env_file="$CLAWDBOT_ENV" - local config_file="$CLAWDBOT_JSON" + local env_file="$OPENCLAW_ENV" + local config_file="$OPENCLAW_JSON" # 创建或更新环境变量文件 cat > "$env_file" << EOF -# ClawdBot 环境变量配置 +# OpenClaw 环境变量配置 # 由配置菜单自动生成: $(date '+%Y-%m-%d %H:%M:%S') EOF @@ -2802,65 +2802,65 @@ EOF chmod 600 "$env_file" # 设置默认模型 - if check_clawdbot_installed; then - local clawdbot_model="" + if check_openclaw_installed; then + local openclaw_model="" local use_custom_provider=false # 如果使用自定义 BASE_URL,需要配置自定义 provider if [ -n "$base_url" ] && [ "$provider" = "anthropic" ]; then use_custom_provider=true configure_custom_provider "$provider" "$api_key" "$model" "$base_url" "$config_file" - clawdbot_model="anthropic-custom/$model" + openclaw_model="anthropic-custom/$model" elif [ -n "$base_url" ] && [ "$provider" = "openai" ]; then use_custom_provider=true configure_custom_provider "$provider" "$api_key" "$model" "$base_url" "$config_file" - clawdbot_model="openai-custom/$model" + openclaw_model="openai-custom/$model" else case "$provider" in anthropic) - clawdbot_model="anthropic/$model" + openclaw_model="anthropic/$model" ;; openai|groq|mistral) - clawdbot_model="openai/$model" + openclaw_model="openai/$model" ;; openrouter) - clawdbot_model="openrouter/$model" + openclaw_model="openrouter/$model" ;; google) - clawdbot_model="google/$model" + openclaw_model="google/$model" ;; ollama) - clawdbot_model="ollama/$model" + openclaw_model="ollama/$model" ;; xai) - clawdbot_model="xai/$model" + openclaw_model="xai/$model" ;; zai) - clawdbot_model="zai/$model" + openclaw_model="zai/$model" ;; minimax) - clawdbot_model="minimax/$model" + openclaw_model="minimax/$model" ;; minimax-cn) - clawdbot_model="minimax-cn/$model" + openclaw_model="minimax-cn/$model" ;; opencode) - clawdbot_model="opencode/$model" + openclaw_model="opencode/$model" ;; google-gemini-cli) - clawdbot_model="google-gemini-cli/$model" + openclaw_model="google-gemini-cli/$model" ;; google-antigravity) - clawdbot_model="google-antigravity/$model" + openclaw_model="google-antigravity/$model" ;; esac fi - if [ -n "$clawdbot_model" ]; then + if [ -n "$openclaw_model" ]; then # 加载环境变量并设置模型 source "$env_file" - clawdbot models set "$clawdbot_model" 2>/dev/null || true - log_info "ClawdBot 默认模型已设置为: $clawdbot_model" + openclaw models set "$openclaw_model" 2>/dev/null || true + log_info "OpenClaw 默认模型已设置为: $openclaw_model" fi fi @@ -2873,9 +2873,9 @@ EOF fi if [ -n "$shell_rc" ]; then - if ! grep -q "source.*clawdbot/env" "$shell_rc" 2>/dev/null; then + if ! grep -q "source.*openclaw/env" "$shell_rc" 2>/dev/null; then echo "" >> "$shell_rc" - echo "# ClawdBot 环境变量" >> "$shell_rc" + echo "# OpenClaw 环境变量" >> "$shell_rc" echo "[ -f \"$env_file\" ] && source \"$env_file\"" >> "$shell_rc" fi fi @@ -2968,7 +2968,7 @@ try { log_info "使用 node 配置自定义 Provider..." # 将变量写入临时文件,避免 shell 转义问题 - local tmp_vars="/tmp/clawdbot_provider_vars_$$.json" + local tmp_vars="/tmp/openclaw_provider_vars_$$.json" cat > "$tmp_vars" << EOFVARS { "config_file": "$config_file", @@ -3048,7 +3048,7 @@ console.log('Custom provider configured: ' + vars.provider_id); log_info "使用 python3 配置自定义 Provider..." # 将变量写入临时文件,避免 shell 转义问题 - local tmp_vars="/tmp/clawdbot_provider_vars_$$.json" + local tmp_vars="/tmp/openclaw_provider_vars_$$.json" cat > "$tmp_vars" << EOFVARS { "config_file": "$config_file", @@ -3156,8 +3156,8 @@ advanced_settings() { print_menu_item "3" "恢复配置" "📥" print_menu_item "4" "重置配置" "🔄" print_menu_item "5" "清理日志" "🧹" - print_menu_item "6" "更新 ClawdBot" "⬆️" - print_menu_item "7" "卸载 ClawdBot" "🗑️" + print_menu_item "6" "更新 OpenClaw" "⬆️" + print_menu_item "7" "卸载 OpenClaw" "🗑️" print_menu_item "0" "返回主菜单" "↩️" echo "" @@ -3168,18 +3168,18 @@ advanced_settings() { 1) echo "" log_info "正在打开环境变量配置..." - if [ -f "$CLAWDBOT_ENV" ]; then + if [ -f "$OPENCLAW_ENV" ]; then if [ -n "$EDITOR" ]; then - $EDITOR "$CLAWDBOT_ENV" + $EDITOR "$OPENCLAW_ENV" elif command -v nano &> /dev/null; then - nano "$CLAWDBOT_ENV" + nano "$OPENCLAW_ENV" elif command -v vim &> /dev/null; then - vim "$CLAWDBOT_ENV" + vim "$OPENCLAW_ENV" else - cat "$CLAWDBOT_ENV" + cat "$OPENCLAW_ENV" fi else - log_error "环境变量文件不存在: $CLAWDBOT_ENV" + log_error "环境变量文件不存在: $OPENCLAW_ENV" fi ;; 2) @@ -3196,33 +3196,33 @@ advanced_settings() { ;; 4) if confirm "确定要重置所有配置吗?这将删除当前配置" "n"; then - rm -f "$CLAWDBOT_ENV" - rm -rf "$CONFIG_DIR/clawdbot.json" 2>/dev/null + rm -f "$OPENCLAW_ENV" + rm -rf "$CONFIG_DIR/openclaw.json" 2>/dev/null log_info "配置已重置,请重新运行安装脚本" fi ;; 5) if confirm "确定要清理日志吗?" "n"; then - if command -v clawdbot &> /dev/null; then - clawdbot logs clear 2>/dev/null || log_warn "ClawdBot 日志清理命令不可用" + if command -v openclaw &> /dev/null; then + openclaw logs clear 2>/dev/null || log_warn "OpenClaw 日志清理命令不可用" fi - rm -f /tmp/clawdbot-gateway.log 2>/dev/null + rm -f /tmp/openclaw-gateway.log 2>/dev/null log_info "日志已清理" fi ;; 6) echo "" - log_info "正在更新 ClawdBot..." - npm update -g clawdbot + log_info "正在更新 OpenClaw..." + npm update -g openclaw log_info "更新完成" ;; 7) - if confirm "确定要卸载 ClawdBot 吗?" "n"; then - npm uninstall -g clawdbot + if confirm "确定要卸载 OpenClaw 吗?" "n"; then + npm uninstall -g openclaw if confirm "是否同时删除配置文件?" "n"; then rm -rf "$CONFIG_DIR" fi - log_info "ClawdBot 已卸载" + log_info "OpenClaw 已卸载" exit 0 fi ;; @@ -3268,8 +3268,8 @@ restore_config() { if [ -n "$choice" ] && [ "$choice" -ge 1 ] && [ "$choice" -lt "$i" ]; then local selected_backup="${backups[$((choice-1))]}" - cp "$selected_backup" "$CLAWDBOT_ENV" - source "$CLAWDBOT_ENV" + cp "$selected_backup" "$OPENCLAW_ENV" + source "$OPENCLAW_ENV" log_info "环境配置已从备份恢复" else log_error "无效选择" @@ -3287,13 +3287,13 @@ view_config() { echo "" # 显示环境变量配置 - echo -e "${CYAN}环境变量配置 ($CLAWDBOT_ENV):${NC}" + echo -e "${CYAN}环境变量配置 ($OPENCLAW_ENV):${NC}" echo "" - if [ -f "$CLAWDBOT_ENV" ]; then + if [ -f "$OPENCLAW_ENV" ]; then if command -v bat &> /dev/null; then - bat --style=numbers --language=bash "$CLAWDBOT_ENV" + bat --style=numbers --language=bash "$OPENCLAW_ENV" else - cat -n "$CLAWDBOT_ENV" + cat -n "$OPENCLAW_ENV" fi else echo -e " ${GRAY}(未配置)${NC}" @@ -3303,21 +3303,21 @@ view_config() { print_divider echo "" - # 显示 ClawdBot 配置 - if check_clawdbot_installed; then - echo -e "${CYAN}ClawdBot 配置:${NC}" + # 显示 OpenClaw 配置 + if check_openclaw_installed; then + echo -e "${CYAN}OpenClaw 配置:${NC}" echo "" - clawdbot config list 2>/dev/null || echo -e " ${GRAY}(无法获取)${NC}" + openclaw config list 2>/dev/null || echo -e " ${GRAY}(无法获取)${NC}" echo "" echo -e "${CYAN}已配置渠道:${NC}" echo "" - clawdbot channels list 2>/dev/null || echo -e " ${GRAY}(无渠道)${NC}" + openclaw channels list 2>/dev/null || echo -e " ${GRAY}(无渠道)${NC}" echo "" echo -e "${CYAN}当前模型:${NC}" echo "" - clawdbot models status 2>/dev/null || echo -e " ${GRAY}(未配置)${NC}" + openclaw models status 2>/dev/null || echo -e " ${GRAY}(未配置)${NC}" fi echo "" @@ -3335,12 +3335,12 @@ quick_test_menu() { print_divider echo "" - # 显示 ClawdBot 状态 - if check_clawdbot_installed; then - local version=$(clawdbot --version 2>/dev/null || echo "unknown") - echo -e " ${GREEN}✓${NC} ClawdBot 已安装: $version" + # 显示 OpenClaw 状态 + if check_openclaw_installed; then + local version=$(openclaw --version 2>/dev/null || echo "unknown") + echo -e " ${GREEN}✓${NC} OpenClaw 已安装: $version" else - echo -e " ${YELLOW}⚠${NC} ClawdBot 未安装" + echo -e " ${YELLOW}⚠${NC} OpenClaw 未安装" fi echo "" print_divider @@ -3353,10 +3353,10 @@ quick_test_menu() { print_menu_item "4" "测试 Slack 机器人" "💼" print_menu_item "5" "测试 Ollama 本地模型" "🟠" echo "" - echo -e "${CYAN}ClawdBot 诊断 (需要已安装):${NC}" - print_menu_item "6" "clawdbot doctor (诊断)" "🔍" - print_menu_item "7" "clawdbot status (渠道状态)" "📊" - print_menu_item "8" "clawdbot health (Gateway 健康)" "💚" + echo -e "${CYAN}OpenClaw 诊断 (需要已安装):${NC}" + print_menu_item "6" "openclaw doctor (诊断)" "🔍" + print_menu_item "7" "openclaw status (渠道状态)" "📊" + print_menu_item "8" "openclaw health (Gateway 健康)" "💚" echo "" print_menu_item "9" "运行全部 API 测试" "🔄" print_menu_item "0" "返回主菜单" "↩️" @@ -3389,14 +3389,14 @@ quick_test_ai() { echo "" # 从环境变量文件读取配置 - if [ ! -f "$CLAWDBOT_ENV" ]; then + if [ ! -f "$OPENCLAW_ENV" ]; then log_error "AI 模型尚未配置,请先完成配置" press_enter quick_test_menu return fi - source "$CLAWDBOT_ENV" + source "$OPENCLAW_ENV" local provider="" local api_key="" @@ -3438,8 +3438,8 @@ quick_test_ai() { fi # 获取当前模型 - if check_clawdbot_installed; then - model=$(clawdbot config get models.default 2>/dev/null | sed 's|.*/||') + if check_openclaw_installed; then + model=$(openclaw config get models.default 2>/dev/null | sed 's|.*/||') fi echo -e "当前配置:" @@ -3561,10 +3561,10 @@ quick_test_doctor() { clear_screen print_header - echo -e "${WHITE}🔍 ClawdBot 诊断${NC}" + echo -e "${WHITE}🔍 OpenClaw 诊断${NC}" print_divider - run_clawdbot_doctor + run_openclaw_doctor press_enter quick_test_menu @@ -3574,10 +3574,10 @@ quick_test_status() { clear_screen print_header - echo -e "${WHITE}📊 ClawdBot 渠道状态${NC}" + echo -e "${WHITE}📊 OpenClaw 渠道状态${NC}" print_divider - run_clawdbot_status + run_openclaw_status press_enter quick_test_menu @@ -3590,7 +3590,7 @@ quick_test_health() { echo -e "${WHITE}💚 Gateway 健康检查${NC}" print_divider - run_clawdbot_health + run_openclaw_health press_enter quick_test_menu @@ -3611,7 +3611,7 @@ run_all_tests() { local passed_tests=0 # 从环境变量读取 AI 配置 - [ -f "$CLAWDBOT_ENV" ] && source "$CLAWDBOT_ENV" + [ -f "$OPENCLAW_ENV" ] && source "$OPENCLAW_ENV" local provider="" local api_key="" @@ -3632,8 +3632,8 @@ run_all_tests() { fi # 获取当前模型 - if check_clawdbot_installed; then - model=$(clawdbot config get models.default 2>/dev/null | sed 's|.*/||') + if check_openclaw_installed; then + model=$(openclaw config get models.default 2>/dev/null | sed 's|.*/||') fi if [ -n "$provider" ] && [ -n "$api_key" ] && [ "$api_key" != "your-api-key-here" ]; then @@ -3675,7 +3675,7 @@ run_all_tests() { echo "" echo -e "${CYAN}渠道测试:${NC}" echo -e " 使用 ${WHITE}快速测试${NC} 菜单手动测试各个渠道" - echo -e " 或运行 ${WHITE}clawdbot channels list${NC} 查看已配置渠道" + echo -e " 或运行 ${WHITE}openclaw channels list${NC} 查看已配置渠道" echo "" # 汇总结果 @@ -3695,13 +3695,13 @@ run_all_tests() { echo -e "${YELLOW}⚠ 没有可测试的配置,请先完成相关配置${NC}" fi - # 如果 ClawdBot 已安装,提示可用的诊断命令 - if check_clawdbot_installed; then + # 如果 OpenClaw 已安装,提示可用的诊断命令 + if check_openclaw_installed; then echo "" echo -e "${CYAN}提示: 可使用以下命令进行更详细的诊断:${NC}" - echo " • clawdbot doctor - 健康检查 + 修复建议" - echo " • clawdbot status - 渠道状态" - echo " • clawdbot health - Gateway 健康状态" + echo " • openclaw doctor - 健康检查 + 修复建议" + echo " • openclaw status - 渠道状态" + echo " • openclaw health - Gateway 健康状态" fi press_enter diff --git a/docker-compose.yml b/docker-compose.yml index 43dbbbab..2a8ec38c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ # ============================================================ -# ClawdBot Docker Compose 配置 -# +# OpenClaw Docker Compose 配置 +# # 使用方法: -# 1. 复制 examples/config.example.yaml 到 ~/.clawdbot/config.yaml +# 1. 复制 examples/config.example.yaml 到 ~/.openclaw/config.yaml # 2. 编辑配置文件,填入你的 API Key # 3. 运行: docker-compose up -d # 4. 查看日志: docker-compose logs -f @@ -11,12 +11,12 @@ version: '3.8' services: - clawdbot: + openclaw: build: . - image: clawdbot:latest - container_name: clawdbot + image: openclaw:latest + container_name: openclaw restart: unless-stopped - + # 环境变量(可选,优先级高于配置文件) environment: - TZ=Asia/Shanghai @@ -24,36 +24,36 @@ services: # - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} # - OPENAI_API_KEY=${OPENAI_API_KEY} # - TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN} - + # 端口映射 ports: - "18789:18789" - + # 卷挂载 volumes: # 配置和数据持久化 - - ~/.clawdbot:/root/.clawdbot + - ~/.openclaw:/root/.openclaw # 可选:挂载自定义技能目录 - # - ./custom-skills:/root/.clawdbot/skills - + # - ./custom-skills:/root/.openclaw/skills + # 健康检查 healthcheck: - test: ["CMD", "clawdbot", "health"] + test: ["CMD", "openclaw", "health"] interval: 30s timeout: 10s retries: 3 start_period: 10s - + # 日志配置 logging: driver: "json-file" options: max-size: "10m" max-file: "3" - + # 网络配置 networks: - - clawdbot-network + - openclaw-network # 可选:Ollama 本地模型服务 # 取消注释以启用本地 AI 模型 @@ -66,7 +66,7 @@ services: # volumes: # - ollama-data:/root/.ollama # networks: - # - clawdbot-network + # - openclaw-network # deploy: # resources: # reservations: @@ -76,7 +76,7 @@ services: # capabilities: [gpu] networks: - clawdbot-network: + openclaw-network: driver: bridge # volumes: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index e2fc4dff..b58e9935 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -CONFIG_DIR="/root/.clawdbot" +CONFIG_DIR="/root/.openclaw" CONFIG_FILE="$CONFIG_DIR/config.yaml" # 如果配置文件不存在,复制示例配置 @@ -18,7 +18,7 @@ mkdir -p "$CONFIG_DIR/skills" # 打印启动信息 echo "" -echo "🦞 ClawdBot Docker Container" +echo "🦞 OpenClaw Docker Container" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "配置目录: $CONFIG_DIR" echo "日志目录: $CONFIG_DIR/logs" diff --git a/examples/config.example.yaml b/examples/config.example.yaml index 677ee31c..34570631 100644 --- a/examples/config.example.yaml +++ b/examples/config.example.yaml @@ -1,7 +1,7 @@ # ============================================================ -# ClawdBot 配置文件示例 -# 复制此文件到 ~/.clawdbot/config.yaml 并修改相关配置 -# 详细文档: https://clawd.bot/docs/config +# OpenClaw 配置文件示例 +# 复制此文件到 ~/.openclaw/config.yaml 并修改相关配置 +# 详细文档: https://opencode.ai/docs/config # ============================================================ # 配置版本 @@ -187,7 +187,7 @@ channels: whatsapp: enabled: false - # WhatsApp 使用二维码登录,运行 clawdbot onboard --provider whatsapp + # WhatsApp 使用二维码登录,运行 openclaw onboard --provider whatsapp # ---------------------------------------------------------- # Slack 配置 @@ -210,14 +210,14 @@ channels: # ---------------------------------------------------------- wechat: enabled: false - # 微信接入需要额外配置,运行 clawdbot onboard --provider wechat + # 微信接入需要额外配置,运行 openclaw onboard --provider wechat # ---------------------------------------------------------- # iMessage 配置 (仅 macOS) # ---------------------------------------------------------- imessage: enabled: false - # 需要完整磁盘访问权限,运行 clawdbot onboard --provider imessage + # 需要完整磁盘访问权限,运行 openclaw onboard --provider imessage # ---------------------------------------------------------- # 飞书配置 (Feishu/Lark) @@ -248,7 +248,7 @@ memory: enabled: true # 记忆存储路径 - storage_path: "~/.clawdbot/data/memory" + storage_path: "~/.openclaw/data/memory" # 最大上下文长度(token) max_context_length: 32000 @@ -269,7 +269,7 @@ skills: enabled: true # 技能文件目录 - path: "~/.clawdbot/skills" + path: "~/.openclaw/skills" # 内置技能开关 builtin: @@ -304,7 +304,7 @@ security: # 文件访问白名单(仅当 enable_file_access 为 true 时生效) file_whitelist: - - "~/.clawdbot/" + - "~/.openclaw/" - "~/Documents/" # 敏感信息过滤 @@ -347,7 +347,7 @@ logging: level: "info" # 日志文件路径 - path: "~/.clawdbot/logs" + path: "~/.openclaw/logs" # 单个日志文件最大大小 max_size: "10MB" diff --git a/examples/skills/reminder.md b/examples/skills/reminder.md index 1fa74844..bbe7d12d 100644 --- a/examples/skills/reminder.md +++ b/examples/skills/reminder.md @@ -93,7 +93,7 @@ skills: max_reminders: 100 # 最大提醒数量 default_advance: 15 # 默认提前提醒(分钟) persist: true # 重启后保留提醒 - storage: "~/.clawdbot/data/reminders.json" + storage: "~/.openclaw/data/reminders.json" channels: - telegram - discord diff --git a/install.sh b/install.sh index 4152554d..95ad9eea 100755 --- a/install.sh +++ b/install.sh @@ -2,16 +2,22 @@ # # ╔═══════════════════════════════════════════════════════════════════════════╗ # ║ ║ -# ║ 🦞 ClawdBot 一键部署脚本 v1.0.0 ║ +# ║ 🦞 OpenClaw 一键部署脚本 v1.1.0 ║ # ║ 智能 AI 助手部署工具 - 支持多平台多模型 ║ # ║ ║ -# ║ GitHub: https://github.com/miaoxworld/ClawdBotInstaller ║ -# ║ 官方文档: https://clawd.bot/docs ║ -# ║ ║ +# ║ GitHub: https://github.com/miaoxworld/OpenClawInstaller ║ +# ║ 官方文档: https://docs.openclaw.ai ║ # ╚═══════════════════════════════════════════════════════════════════════════╝ # # 使用方法: -# curl -fsSL https://raw.githubusercontent.com/miaoxworld/ClawdBotInstaller/main/install.sh | bash +# curl -fsSL https://raw.githubusercontent.com/miaoxworld/OpenClawInstaller/main/install.sh | bash +# 或本地执行: chmod +x install.sh && ./install.sh +# +# 版本更新: +# v1.1.0 - 同步 OpenClaw v2026.1.24 命令变更 (clawdbot -> openclaw) +# +# 使用方法: +# curl -fsSL https://raw.githubusercontent.com/miaoxworld/OpenClawInstaller/main/install.sh | bash # 或本地执行: chmod +x install.sh && ./install.sh # @@ -39,10 +45,10 @@ GRAY='\033[0;90m' NC='\033[0m' # 无颜色 # ================================ 配置变量 ================================ -CLAWDBOT_VERSION="latest" -CONFIG_DIR="$HOME/.clawdbot" +OPENCLAW_VERSION="latest" +CONFIG_DIR="$HOME/.openclaw" MIN_NODE_VERSION=22 -GITHUB_REPO="miaoxworld/ClawdBotInstaller" +GITHUB_REPO="miaoxworld/OpenClawInstaller" GITHUB_RAW_URL="https://raw.githubusercontent.com/$GITHUB_REPO/main" # ================================ 工具函数 ================================ @@ -51,14 +57,14 @@ print_banner() { echo -e "${CYAN}" cat << 'EOF' - ██████╗██╗ █████╗ ██╗ ██╗██████╗ ██████╗ ██████╗ ████████╗ - ██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔═══██╗╚══██╔══╝ - ██║ ██║ ███████║██║ █╗ ██║██║ ██║██████╔╝██║ ██║ ██║ - ██║ ██║ ██╔══██║██║███╗██║██║ ██║██╔══██╗██║ ██║ ██║ - ╚██████╗███████╗██║ ██║╚███╔███╔╝██████╔╝██████╔╝╚██████╔╝ ██║ - ╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ - - 🦞 智能 AI 助手一键部署工具 v1.0.0 🦞 + ██████╗ ██████╗ ███████╗███╗ ██╗ ██████╗██╗ █████╗ ██╗ ██╗ + ██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝██║ ██╔══██╗╚██╗ ██╔╝ + ██║ ██║██████╔╝█████╗ ██╔██╗ ██║██║ ██║ ███████║ ╚████╔╝ + ██║ ██║██╔══██╗██╔══╝ ██║╚██╗██║██║ ██║ ██╔══██║ ╚██╔╝ + ╚██████╔╝██████╔╝███████╗██║ ╚████║╚██████╗███████╗██║ ██║ ██║ + ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚═╝ + + 🦞 智能 AI 助手一键部署工具 v1.1.0 🦞 EOF echo -e "${NC}" @@ -272,7 +278,7 @@ install_dependencies() { install_nodejs } -# ================================ ClawdBot 安装 ================================ +# ================================ OpenClaw 安装 ================================ create_directories() { log_step "创建配置目录..." @@ -282,64 +288,64 @@ create_directories() { log_info "配置目录: $CONFIG_DIR" } -install_clawdbot() { - log_step "安装 ClawdBot..." +install_openclaw() { + log_step "安装 OpenClaw..." # 检查是否已安装 - if check_command clawdbot; then - local current_version=$(clawdbot --version 2>/dev/null || echo "unknown") - log_warn "ClawdBot 已安装 (版本: $current_version)" + if check_command openclaw; then + local current_version=$(openclaw --version 2>/dev/null || echo "unknown") + log_warn "OpenClaw 已安装 (版本: $current_version)" if ! confirm "是否重新安装/更新?"; then - init_clawdbot_config + init_openclaw_config return 0 fi fi # 使用 npm 全局安装 - log_info "正在从 npm 安装 ClawdBot..." - npm install -g clawdbot@$CLAWDBOT_VERSION + log_info "正在从 npm 安装 OpenClaw..." + npm install -g openclaw@$OPENCLAW_VERSION # 验证安装 - if check_command clawdbot; then - log_info "ClawdBot 安装成功: $(clawdbot --version 2>/dev/null || echo 'installed')" - init_clawdbot_config + if check_command openclaw; then + log_info "OpenClaw 安装成功: $(openclaw --version 2>/dev/null || echo 'installed')" + init_openclaw_config else - log_error "ClawdBot 安装失败" + log_error "OpenClaw 安装失败" exit 1 fi } -# 初始化 ClawdBot 配置 -init_clawdbot_config() { - log_step "初始化 ClawdBot 配置..." +# 初始化 OpenClaw 配置 +init_openclaw_config() { + log_step "初始化 OpenClaw 配置..." - local CLAWDBOT_DIR="$HOME/.clawdbot" + local OPENCLAW_DIR="$HOME/.openclaw" # 创建必要的目录 - mkdir -p "$CLAWDBOT_DIR/agents/main/sessions" - mkdir -p "$CLAWDBOT_DIR/agents/main/agent" - mkdir -p "$CLAWDBOT_DIR/credentials" + mkdir -p "$OPENCLAW_DIR/agents/main/sessions" + mkdir -p "$OPENCLAW_DIR/agents/main/agent" + mkdir -p "$OPENCLAW_DIR/credentials" # 修复权限 - chmod 700 "$CLAWDBOT_DIR" 2>/dev/null || true + chmod 700 "$OPENCLAW_DIR" 2>/dev/null || true # 设置 gateway.mode 为 local - if check_command clawdbot; then - clawdbot config set gateway.mode local 2>/dev/null || true + if check_command openclaw; then + openclaw config set gateway.mode local 2>/dev/null || true log_info "Gateway 模式已设置为 local" fi } -# 配置 ClawdBot 使用的 AI 模型和 API Key -configure_clawdbot_model() { - log_step "配置 ClawdBot AI 模型..." +# 配置 OpenClaw 使用的 AI 模型和 API Key +configure_openclaw_model() { + log_step "配置 OpenClaw AI 模型..." - local env_file="$HOME/.clawdbot/env" - local clawdbot_json="$HOME/.clawdbot/clawdbot.json" + local env_file="$HOME/.openclaw/env" + local openclaw_json="$HOME/.openclaw/openclaw.json" # 创建环境变量文件 cat > "$env_file" << EOF -# ClawdBot 环境变量配置 +# OpenClaw 环境变量配置 # 由安装脚本自动生成: $(date '+%Y-%m-%d %H:%M:%S') EOF @@ -378,58 +384,58 @@ EOF log_info "环境变量配置已保存到: $env_file" # 设置默认模型 - if check_command clawdbot; then - local clawdbot_model="" + if check_command openclaw; then + local openclaw_model="" local use_custom_provider=false # 如果使用自定义 BASE_URL,需要配置自定义 provider if [ -n "$BASE_URL" ] && [ "$AI_PROVIDER" = "anthropic" ]; then use_custom_provider=true - configure_custom_provider "$AI_PROVIDER" "$AI_KEY" "$AI_MODEL" "$BASE_URL" "$clawdbot_json" - clawdbot_model="anthropic-custom/$AI_MODEL" + configure_custom_provider "$AI_PROVIDER" "$AI_KEY" "$AI_MODEL" "$BASE_URL" "$openclaw_json" + openclaw_model="anthropic-custom/$AI_MODEL" elif [ -n "$BASE_URL" ] && [ "$AI_PROVIDER" = "openai" ]; then use_custom_provider=true - configure_custom_provider "$AI_PROVIDER" "$AI_KEY" "$AI_MODEL" "$BASE_URL" "$clawdbot_json" - clawdbot_model="openai-custom/$AI_MODEL" + configure_custom_provider "$AI_PROVIDER" "$AI_KEY" "$AI_MODEL" "$BASE_URL" "$openclaw_json" + openclaw_model="openai-custom/$AI_MODEL" else case "$AI_PROVIDER" in anthropic) - clawdbot_model="anthropic/$AI_MODEL" + openclaw_model="anthropic/$AI_MODEL" ;; openai|groq|mistral) - clawdbot_model="openai/$AI_MODEL" + openclaw_model="openai/$AI_MODEL" ;; openrouter) - clawdbot_model="openrouter/$AI_MODEL" + openclaw_model="openrouter/$AI_MODEL" ;; google) - clawdbot_model="google/$AI_MODEL" + openclaw_model="google/$AI_MODEL" ;; ollama) - clawdbot_model="ollama/$AI_MODEL" + openclaw_model="ollama/$AI_MODEL" ;; esac fi - if [ -n "$clawdbot_model" ]; then + if [ -n "$openclaw_model" ]; then # 加载环境变量 source "$env_file" # 设置默认模型(显示错误信息以便调试) # 添加 || true 防止 set -e 导致脚本退出 local set_result - set_result=$(clawdbot models set "$clawdbot_model" 2>&1) || true + set_result=$(openclaw models set "$openclaw_model" 2>&1) || true local set_exit=$? if [ $set_exit -eq 0 ]; then - log_info "默认模型已设置为: $clawdbot_model" + log_info "默认模型已设置为: $openclaw_model" else - log_warn "模型设置可能失败: $clawdbot_model" + log_warn "模型设置可能失败: $openclaw_model" echo -e " ${GRAY}$set_result${NC}" | head -3 # 尝试直接使用 config set log_info "尝试使用 config set 设置模型..." - clawdbot config set models.default "$clawdbot_model" 2>/dev/null || true + openclaw config set models.default "$openclaw_model" 2>/dev/null || true fi fi fi @@ -529,7 +535,7 @@ try { log_info "使用 node 配置自定义 Provider..." # 将变量写入临时文件,避免 shell 转义问题 - local tmp_vars="/tmp/clawdbot_provider_vars_$$.json" + local tmp_vars="/tmp/openclaw_provider_vars_$$.json" cat > "$tmp_vars" << EOFVARS { "config_file": "$config_file", @@ -609,7 +615,7 @@ console.log('Custom provider configured: ' + vars.provider_id); log_info "使用 python3 配置自定义 Provider..." # 将变量写入临时文件,避免 shell 转义问题 - local tmp_vars="/tmp/clawdbot_provider_vars_$$.json" + local tmp_vars="/tmp/openclaw_provider_vars_$$.json" cat > "$tmp_vars" << EOFVARS { "config_file": "$config_file", @@ -717,9 +723,9 @@ add_env_to_shell() { if [ -n "$shell_rc" ]; then # 检查是否已添加 - if ! grep -q "source.*clawdbot/env" "$shell_rc" 2>/dev/null; then + if ! grep -q "source ~/.openclaw/env" "$shell_rc" 2>/dev/null; then echo "" >> "$shell_rc" - echo "# ClawdBot 环境变量" >> "$shell_rc" + echo "# OpenClaw 环境变量" >> "$shell_rc" echo "[ -f \"$env_file\" ] && source \"$env_file\"" >> "$shell_rc" log_info "环境变量已添加到: $shell_rc" fi @@ -728,30 +734,30 @@ add_env_to_shell() { # ================================ 配置向导 ================================ -# create_default_config 已移除 - ClawdBot 使用 clawdbot.json 和环境变量 +# create_default_config 已移除 - OpenClaw 使用 openclaw.json 和环境变量 run_onboard_wizard() { log_step "运行配置向导..." echo "" echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" - echo -e "${WHITE} 🧙 ClawdBot 核心配置向导${NC}" + echo -e "${WHITE} 🧙 OpenClaw 核心配置向导${NC}" echo -e "${PURPLE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo "" # 检查是否已有配置 local skip_ai_config=false local skip_identity_config=false - local env_file="$HOME/.clawdbot/env" + local env_file="$HOME/.openclaw/env" if [ -f "$env_file" ]; then echo -e "${YELLOW}检测到已有配置!${NC}" echo "" # 显示当前模型配置 - if check_command clawdbot; then - echo -e "${CYAN}当前 ClawdBot 配置:${NC}" - clawdbot models status 2>/dev/null | head -10 || true + if check_command openclaw; then + echo -e "${CYAN}当前 OpenClaw 配置:${NC}" + openclaw models status 2>/dev/null | head -10 || true echo "" fi @@ -764,7 +770,7 @@ run_onboard_wizard() { # 从 env 文件读取配置进行测试 source "$env_file" # 获取当前模型 - AI_MODEL=$(clawdbot config get models.default 2>/dev/null | sed 's|.*/||') + AI_MODEL=$(openclaw config get models.default 2>/dev/null | sed 's|.*/||') if [ -n "$ANTHROPIC_API_KEY" ]; then AI_PROVIDER="anthropic" AI_KEY="$ANTHROPIC_API_KEY" @@ -794,8 +800,8 @@ run_onboard_wizard() { # AI 配置 if [ "$skip_ai_config" = false ]; then setup_ai_provider - # 先配置 ClawdBot(设置环境变量和自定义 provider),然后再测试 - configure_clawdbot_model + # 先配置 OpenClaw(设置环境变量和自定义 provider),然后再测试 + configure_openclaw_model test_api_connection else # 即使跳过配置,也可选择测试连接 @@ -834,7 +840,7 @@ setup_ai_provider() { echo " 6) ⚡ Groq (超快推理)" echo " 7) 🌬️ Mistral AI" echo "" - echo -e "${GRAY}提示: Anthropic 支持自定义 API 地址(通过 clawdbot.json 配置自定义 Provider)${NC}" + echo -e "${GRAY}提示: Anthropic 支持自定义 API 地址(通过 openclaw.json 配置自定义 Provider)${NC}" echo "" echo -en "${YELLOW}请选择 AI 提供商 [1-7] (默认: 1): ${NC}"; read ai_choice < "$TTY_INPUT" ai_choice=${ai_choice:-1} @@ -1037,31 +1043,31 @@ test_api_connection() { local retry_count=0 # 确保环境变量已加载 - local env_file="$HOME/.clawdbot/env" + local env_file="$HOME/.openclaw/env" [ -f "$env_file" ] && source "$env_file" - if ! check_command clawdbot; then - echo -e "${YELLOW}ClawdBot 未安装,跳过测试${NC}" + if ! check_command openclaw; then + echo -e "${YELLOW}OpenClaw 未安装,跳过测试${NC}" return 0 fi # 显示当前模型配置 echo -e "${CYAN}当前模型配置:${NC}" - clawdbot models status 2>&1 | grep -E "Default|Auth|effective" | head -5 + openclaw models status 2>&1 | grep -E "Default|Auth|effective" | head -5 echo "" while [ "$test_passed" = false ] && [ $retry_count -lt $max_retries ]; do - echo -e "${YELLOW}运行 clawdbot agent --local 测试...${NC}" + echo -e "${YELLOW}运行 openclaw agent --local 测试...${NC}" echo "" - # 使用 clawdbot agent --local 测试(添加超时) + # 使用 openclaw agent --local 测试(添加超时) local result local exit_code # 使用 timeout 命令(如果可用),否则直接运行 # 注意:添加 || true 防止 set -e 导致脚本退出 if command -v timeout &> /dev/null; then - result=$(timeout 30 clawdbot agent --local --to "+1234567890" --message "回复 OK" 2>&1) || true + result=$(timeout 30 openclaw agent --local --to "+1234567890" --message "回复 OK" 2>&1) || true exit_code=${PIPESTATUS[0]} # 如果 exit_code 为空,从 $? 获取(兼容不同 shell) [ -z "$exit_code" ] && exit_code=$? @@ -1069,7 +1075,7 @@ test_api_connection() { result="测试超时(30秒)" fi else - result=$(clawdbot agent --local --to "+1234567890" --message "回复 OK" 2>&1) || true + result=$(openclaw agent --local --to "+1234567890" --message "回复 OK" 2>&1) || true exit_code=$? fi @@ -1084,7 +1090,7 @@ test_api_connection() { if [ $exit_code -eq 0 ] && ! echo "$result" | grep -qiE "error|failed|401|403|Unknown model|超时"; then test_passed=true - echo -e "${GREEN}✓ ClawdBot AI 测试成功!${NC}" + echo -e "${GREEN}✓ OpenClaw AI 测试成功!${NC}" echo "" # 显示 AI 响应(过滤掉空行) local ai_response=$(echo "$result" | grep -v "^$" | head -5) @@ -1094,7 +1100,7 @@ test_api_connection() { fi else retry_count=$((retry_count + 1)) - echo -e "${RED}✗ ClawdBot AI 测试失败 (退出码: $exit_code)${NC}" + echo -e "${RED}✗ OpenClaw AI 测试失败 (退出码: $exit_code)${NC}" echo "" echo -e " ${RED}错误:${NC}" echo "$result" | head -5 | sed 's/^/ /' @@ -1106,7 +1112,7 @@ test_api_connection() { # 提供修复建议 if echo "$result" | grep -q "Unknown model"; then - echo -e "${YELLOW}提示: 模型不被识别,建议运行: clawdbot configure --section model${NC}" + echo -e "${YELLOW}提示: 模型不被识别,建议运行: openclaw onboard --section model${NC}" elif echo "$result" | grep -q "401\|Incorrect API key"; then echo -e "${YELLOW}提示: API 配置可能不正确${NC}" fi @@ -1114,7 +1120,7 @@ test_api_connection() { if confirm "是否重新配置 AI Provider?" "y"; then setup_ai_provider - configure_clawdbot_model + configure_openclaw_model else echo -e "${YELLOW}继续使用当前配置...${NC}" test_passed=true # 允许跳过 @@ -1127,8 +1133,8 @@ test_api_connection() { echo -e "${RED}API 连接测试失败${NC}" echo "" echo "建议运行以下命令手动配置:" - echo " clawdbot configure --section model" - echo " clawdbot doctor" + echo " openclaw onboard --section model" + echo " openclaw doctor" echo "" if confirm "是否仍然继续安装?" "y"; then log_warn "跳过连接测试,继续安装..." @@ -1255,15 +1261,15 @@ setup_daemon() { } setup_systemd() { - cat > /tmp/clawdbot.service << EOF + cat > /tmp/openclaw.service << EOF [Unit] -Description=ClawdBot AI Assistant +Description=OpenClaw AI Assistant After=network.target [Service] Type=simple User=$USER -ExecStart=$(which clawdbot) start --daemon +ExecStart=$(which openclaw) start --daemon Restart=on-failure RestartSec=10 @@ -1271,9 +1277,9 @@ RestartSec=10 WantedBy=multi-user.target EOF - sudo mv /tmp/clawdbot.service /etc/systemd/system/ + sudo mv /tmp/openclaw.service /etc/systemd/system/ sudo systemctl daemon-reload - sudo systemctl enable clawdbot + sudo systemctl enable openclaw log_info "Systemd 服务已配置" } @@ -1281,16 +1287,16 @@ EOF setup_launchd() { mkdir -p "$HOME/Library/LaunchAgents" - cat > "$HOME/Library/LaunchAgents/com.clawdbot.agent.plist" << EOF + cat > "$HOME/Library/LaunchAgents/com.openclaw.agent.plist" << EOF Label - com.clawdbot.agent + com.openclaw.agent ProgramArguments - $(which clawdbot) + $(which openclaw) start --daemon @@ -1306,7 +1312,7 @@ setup_launchd() { EOF - launchctl load "$HOME/Library/LaunchAgents/com.clawdbot.agent.plist" 2>/dev/null || true + launchctl load "$HOME/Library/LaunchAgents/com.openclaw.agent.plist" 2>/dev/null || true log_info "LaunchAgent 已配置" } @@ -1320,44 +1326,44 @@ print_success() { echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo "" echo -e "${WHITE}配置目录:${NC}" - echo " ClawdBot 配置: ~/.clawdbot/" - echo " 环境变量配置: ~/.clawdbot/env" + echo " OpenClaw 配置: ~/.openclaw/" + echo " 环境变量配置: ~/.openclaw/env" echo "" echo -e "${CYAN}常用命令:${NC}" - echo " clawdbot gateway start # 后台启动服务" - echo " clawdbot gateway stop # 停止服务" - echo " clawdbot gateway status # 查看状态" - echo " clawdbot models status # 查看模型配置" - echo " clawdbot channels list # 查看渠道列表" - echo " clawdbot doctor # 诊断问题" + echo " openclaw gateway start # 后台启动服务" + echo " openclaw gateway stop # 停止服务" + echo " openclaw gateway status # 查看状态" + echo " openclaw models status # 查看模型配置" + echo " openclaw channels list # 查看渠道列表" + echo " openclaw doctor # 诊断问题" echo "" echo -e "${PURPLE}📚 官方文档: https://clawd.bot/docs${NC}" echo -e "${PURPLE}💬 社区支持: https://github.com/$GITHUB_REPO/discussions${NC}" echo "" } -# 启动 ClawdBot Gateway 服务 -start_clawdbot_service() { +# 启动 OpenClaw Gateway 服务 +start_openclaw_service() { echo "" echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" - echo -e "${WHITE} 🚀 启动 ClawdBot 服务${NC}" + echo -e "${WHITE} 🚀 启动 OpenClaw 服务${NC}" echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo "" # 加载环境变量 - local env_file="$HOME/.clawdbot/env" + local env_file="$HOME/.openclaw/env" if [ -f "$env_file" ]; then source "$env_file" log_info "已加载环境变量" fi # 检查是否已有服务在运行 - if pgrep -f "clawdbot.*gateway" > /dev/null 2>&1; then - log_warn "ClawdBot Gateway 已在运行" + if pgrep -f "openclaw.*gateway" > /dev/null 2>&1; then + log_warn "OpenClaw Gateway 已在运行" echo "" if confirm "是否重启服务?" "y"; then - clawdbot gateway stop 2>/dev/null || true - pkill -f "clawdbot.*gateway" 2>/dev/null || true + openclaw gateway stop 2>/dev/null || true + pkill -f "openclaw.*gateway" 2>/dev/null || true sleep 2 else return 0 @@ -1369,16 +1375,16 @@ start_clawdbot_service() { if command -v setsid &> /dev/null; then if [ -f "$env_file" ]; then - setsid bash -c "source $env_file && exec clawdbot gateway --port 18789" > /tmp/clawdbot-gateway.log 2>&1 & + setsid bash -c "source $env_file && exec openclaw gateway --port 18789" > /tmp/openclaw-gateway.log 2>&1 & else - setsid clawdbot gateway --port 18789 > /tmp/clawdbot-gateway.log 2>&1 & + setsid openclaw gateway --port 18789 > /tmp/openclaw-gateway.log 2>&1 & fi else # 备用方案:nohup + disown if [ -f "$env_file" ]; then - nohup bash -c "source $env_file && exec clawdbot gateway --port 18789" > /tmp/clawdbot-gateway.log 2>&1 & + nohup bash -c "source $env_file && exec openclaw gateway --port 18789" > /tmp/openclaw-gateway.log 2>&1 & else - nohup clawdbot gateway --port 18789 > /tmp/clawdbot-gateway.log 2>&1 & + nohup openclaw gateway --port 18789 > /tmp/openclaw-gateway.log 2>&1 & fi disown 2>/dev/null || true fi @@ -1386,22 +1392,22 @@ start_clawdbot_service() { sleep 3 # 检查启动状态 - if pgrep -f "clawdbot.*gateway" > /dev/null 2>&1; then + if pgrep -f "openclaw.*gateway" > /dev/null 2>&1; then echo "" echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" - echo -e "${GREEN} ✓ ClawdBot Gateway 已启动!${NC}" + echo -e "${GREEN} ✓ OpenClaw Gateway 已启动!${NC}" echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo "" - echo -e " ${CYAN}日志文件:${NC} /tmp/clawdbot-gateway.log" - echo -e " ${CYAN}查看日志:${NC} tail -f /tmp/clawdbot-gateway.log" - echo -e " ${CYAN}停止服务:${NC} clawdbot gateway stop" + echo -e " ${CYAN}日志文件:${NC} /tmp/openclaw-gateway.log" + echo -e " ${CYAN}查看日志:${NC} tail -f /tmp/openclaw-gateway.log" + echo -e " ${CYAN}停止服务:${NC} openclaw gateway stop" echo "" - log_info "ClawdBot 现在可以接收消息了!" + log_info "OpenClaw 现在可以接收消息了!" else log_error "Gateway 启动失败" echo "" - echo -e "${YELLOW}请查看日志: tail -f /tmp/clawdbot-gateway.log${NC}" - echo -e "${YELLOW}或手动启动: source ~/.clawdbot/env && clawdbot gateway${NC}" + echo -e "${YELLOW}请查看日志: tail -f /tmp/openclaw-gateway.log${NC}" + echo -e "${YELLOW}或手动启动: source ~/.openclaw/env && openclaw gateway${NC}" fi } @@ -1459,7 +1465,7 @@ run_config_menu() { main() { print_banner - echo -e "${YELLOW}⚠️ 警告: ClawdBot 需要完全的计算机权限${NC}" + echo -e "${YELLOW}⚠️ 警告: OpenClaw 需要完全的计算机权限${NC}" echo -e "${YELLOW} 不建议在主要工作电脑上安装,建议使用专用服务器或虚拟机${NC}" echo "" @@ -1473,18 +1479,18 @@ main() { check_root install_dependencies create_directories - install_clawdbot + install_openclaw run_onboard_wizard setup_daemon print_success # 询问是否启动服务 - if confirm "是否现在启动 ClawdBot 服务?" "y"; then - start_clawdbot_service + if confirm "是否现在启动 OpenClaw 服务?" "y"; then + start_openclaw_service else echo "" echo -e "${CYAN}稍后可以通过以下命令启动服务:${NC}" - echo " source ~/.clawdbot/env && clawdbot gateway" + echo " source ~/.openclaw/env && openclaw gateway" echo "" fi @@ -1509,7 +1515,7 @@ main() { fi echo "" - echo -e "${GREEN}🦞 ClawdBot 安装完成!祝你使用愉快!${NC}" + echo -e "${GREEN}🦞 OpenClaw 安装完成!祝你使用愉快!${NC}" echo "" }