在国内部署开源 AI 助手 Clawdbot,网络问题能卡住一半人。PyPI 源连不上、Docker 镜像拉半天超时、模型文件下载到中途就断。项目本身的设计思路不错,轻量、可扩展,但想在国内顺畅跑起来,必须手动加速几个关键环节。下面是实际配通过一遍的流程,供参考。
先把两个源切到国内
pip 要换源,不然装依赖能急死。在 ~/.pip/pip.conf(Linux/macOS)或 %USERPROFILE%\pip\pip.ini(Windows)里写:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
Docker 镜像加速也是必须的。去阿里云容器镜像服务搞一个免费加速器地址,填到 /etc/docker/daemon.json 里:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://<你的加速器ID>.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
记得替换掉尖括号里的 ID。
源码和模型下载
GitHub 经常连不上,直接走 Gitee 镜像 clone:
git clone https://gitee.com/mirrors/clawdbot.git
cd clawdbot
模型文件比较大,docker-compose 里设置了 MODEL_SOURCE=modelscope 可以自动拉,但万一卡住就手动下载:
pip install modelscope
modelscope download --model Qwen/Qwen2-7B-Instruct --local_dir ./models/qwen2-7b-instruct
sudo chmod -R 755 ./models
部署:docker-compose 一把梭
项目自带的 docker-compose.yml 已经指向了国内镜像 registry.cn-hangzhou.aliyuncs.com/clawdbot/clawdbot:latest。如果还拉不动,先 docker pull 一下这个地址。
version: '3.8'
services:
clawdbot:
image: registry.cn-hangzhou.aliyuncs.com/clawdbot/clawdbot:latest


