# PicoBot 常用命令 ```bash # 编译 cargo build # 启动网关 (默认 127.0.0.1:19876) cargo run -- gateway # 覆盖监听地址和端口 cargo run -- gateway --host 0.0.0.0 --port 19876 # Docker Compose 默认监听并发布 0.0.0.0:19876;也可分别覆盖 PICOBOT_GATEWAY_HOST=0.0.0.0 PICOBOT_PUBLISH_HOST=192.168.1.10 PICOBOT_GATEWAY_PORT=19876 docker compose up -d # WebUI 随 Gateway 提供,浏览器打开 # http://127.0.0.1:19876/ # 为新浏览器生成 5 分钟有效的一次性配对码 picobot pair # 撤销全部设备并生成新配对码 picobot pair --revoke-all # 修改 WebUI 后独立检查(Node.js 20+) cd webui npm ci npm run check npm run build # cargo build 会增量生成并嵌入正式 WebUI 资源 cd .. cargo build # 首次配对并启动 CLI 客户端;后续可直接运行 chat cargo run -- chat --pair-code cargo run -- chat # 安装并启动 Linux systemd 用户服务 picobot service install picobot service start # 查看、重启或停止服务 picobot service status picobot service restart picobot service stop # 停止、禁用并删除服务 picobot service uninstall # 运行单元测试 cargo test --lib # 运行离线集成/协议测试 cargo test --test test_scheduler cargo test --test test_request_format # 运行代码检查(Rust 修改必跑) cargo clippy --all-targets --all-features -- -D warnings # 运行模型 API 集成测试(需配置 tests/test.env) cargo test --test test_integration -- --ignored cargo test --test test_tool_calling -- --ignored ``` `test_scheduler` 和 `test_request_format` 不需要 API Key,也没有标记 `#[ignore]`。只有会真实调用 Provider 的测试需要从 `tests/test.env.example` 创建 `tests/test.env` 后使用 `-- --ignored`。 最终用户使用 WebUI 不需要单独构建;开发源码采用 Svelte 5、Vite 和 Bits UI,`cargo build` 会增量生成前端到 Cargo `OUT_DIR` 并嵌入二进制,生成产物不提交。WebUI 支持在线聊天、动态斜杠命令补全、日志、任务、记忆以及 `config.json`、`USER.md`、`AGENTS.md` 编辑。新设备默认必须配对,管理 API 与 WebSocket 共用设备鉴权;非回环部署仍需要 TLS。