作者:CSDN博客
因官网的docker镜像下载很慢,这里可以选择国内镜像下载:
ghcr.io/openclaw/openclaw:latest - 镜像下载 | ghcr.io
拉取镜像:
- docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/openclaw/openclaw:latest
复制代码 克隆openclaw官方仓库:
- git clone https://github.com/openclaw/openclaw.git
- cd openclaw
复制代码 为了使用刚下载的本地镜像,在openclaw目录下执行:- export OPENCLAW_IMAGE="swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/phioranex/openclaw-docker:latest"
复制代码这里OPENCLAW_IMAGE=后面的镜像名称必须使用原始镜像名,否则在执行安装脚本时会从远程下载新镜像,官方文档有此说明:Docker | Docs | OpenClaw
执行安装脚本:
会出现提示,model选择和channel选择部分可先跳过,稍后配置。
安装完成,可在浏览器中输入 http://机器IP:18789?token=<your_token>来访问web ui界面。
<your_token>会在安装完成时提示,用于认证。
无https加密时远程访问,会提示设备未认证,配置/root/.openclaw/openclaw.json:- "gateway": {
- "port": 18789,
- "mode": "local",
- "bind": "lan",
- "controlUi": {
- "allowedOrigins": [
- "http://127.0.0.1:18789",
- "http://localhost:18789",
- "http://0.0.0.0:18789"
- ],
- "allowInsecureAuth": true
- },
复制代码 在allowedOrigins中添加你的远程访问地址和"allowInsecureAuth": true,然后重启容器,携带token访问url(即访问http://机器IP:18789?token=<your_token>)。
配置模型
因为是docker部署,所以要进入openclaw gateway容器,在容器内执行openclaw config命令,然后选择模型配置免费glm模型。参考:OpenClaw接入智谱GLM-4.7-Flash免费模型教程,打造零成本AI助手-腾讯云开发者社区-腾讯云
根据引导选择好模型后,再修改openclaw.json:- "models": {
- "mode": "merge",
- "providers": {
- "zai": {
- "baseUrl": "https://open.bigmodel.cn/api/paas/v4",
- "api": "openai-completions",
- "models": [
- {
- "id": "glm-4.6v-flash",
- "name": "GLM-4.6V-Flash",
- "api": "openai-completions",
- "reasoning": true,
- "input": [
- "text"
- ],
- "cost": {
- "input": 0,
- "output": 0,
- "cacheRead": 0,
- "cacheWrite": 0
- },
- "contextWindow": 204800,
- "maxTokens": 131072
- },
- {
- "id": "glm-4.7-flash",
- "name": "GLM-4.7 Flash",
- "api": "openai-completions",
- "reasoning": true,
- "input": [
- "text"
- ],
- "cost": {
- "input": 0,
- "output": 0,
- "cacheRead": 0,
- "cacheWrite": 0
- },
- "contextWindow": 204800,
- "maxTokens": 131072
- },
- {
- "id": "glm-image",
- "name": "CogView-3-Flash",
- "api": "openai-completions",
- "reasoning": true,
- "input": [
- "text"
- ],
- "cost": {
- "input": 0,
- "output": 0,
- "cacheRead": 0,
- "cacheWrite": 0
- },
- "contextWindow": 204800,
- "maxTokens": 131072
- }
- ]
- }
- }
- },
- "agents": {
- "defaults": {
- "model": {
- "primary": "zai/glm-4.7-flash"
- },
- "models": {
- "zai/glm-4.7-flash": {},
- "zai/glm-4.6v-flash": {},
- "zai/glm-image": {}
- }
- }
- },
复制代码 主要将provider.zai.models中的模型替换为可调用的GLM模型,然后将agents.defaults.model.primary替换为默认使用的模型。
原文地址:https://blog.csdn.net/qq_62592592/article/details/159476877 |