AI创想

标题: openclaw的docker安装过程 [打印本页]

作者: 米落枫    时间: 昨天 07:29
标题: openclaw的docker安装过程
作者:CSDN博客
因官网的docker镜像下载很慢,这里可以选择国内镜像下载:
ghcr.io/openclaw/openclaw:latest - 镜像下载 | ghcr.io
拉取镜像:
  1. docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/openclaw/openclaw:latest
复制代码
克隆openclaw官方仓库:
  1. git clone https://github.com/openclaw/openclaw.git
  2. cd openclaw
复制代码
为了使用刚下载的本地镜像,在openclaw目录下执行:
  1. export OPENCLAW_IMAGE="swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/phioranex/openclaw-docker:latest"
复制代码
这里OPENCLAW_IMAGE=后面的镜像名称必须使用原始镜像名,否则在执行安装脚本时会从远程下载新镜像,官方文档有此说明:Docker | Docs | OpenClaw
执行安装脚本:
  1. ./docker-setup.sh
复制代码
会出现提示,model选择和channel选择部分可先跳过,稍后配置。
安装完成,可在浏览器中输入 http://机器IP:18789?token=<your_token>来访问web ui界面。
<your_token>会在安装完成时提示,用于认证。
无https加密时远程访问,会提示设备未认证,配置/root/.openclaw/openclaw.json:
  1. "gateway": {
  2.     "port": 18789,
  3.     "mode": "local",
  4.     "bind": "lan",
  5.     "controlUi": {
  6.       "allowedOrigins": [
  7.         "http://127.0.0.1:18789",
  8.         "http://localhost:18789",
  9.         "http://0.0.0.0:18789"
  10.       ],
  11.       "allowInsecureAuth": true
  12.     },
复制代码
在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:
  1. "models": {
  2.     "mode": "merge",
  3.     "providers": {
  4.       "zai": {
  5.         "baseUrl": "https://open.bigmodel.cn/api/paas/v4",
  6.         "api": "openai-completions",
  7.         "models": [
  8.           {
  9.             "id": "glm-4.6v-flash",
  10.             "name": "GLM-4.6V-Flash",
  11.             "api": "openai-completions",
  12.             "reasoning": true,
  13.             "input": [
  14.               "text"
  15.             ],
  16.             "cost": {
  17.               "input": 0,
  18.               "output": 0,
  19.               "cacheRead": 0,
  20.               "cacheWrite": 0
  21.             },
  22.             "contextWindow": 204800,
  23.             "maxTokens": 131072
  24.           },
  25.           {
  26.             "id": "glm-4.7-flash",
  27.             "name": "GLM-4.7 Flash",
  28.             "api": "openai-completions",
  29.             "reasoning": true,
  30.             "input": [
  31.               "text"
  32.             ],
  33.             "cost": {
  34.               "input": 0,
  35.               "output": 0,
  36.               "cacheRead": 0,
  37.               "cacheWrite": 0
  38.             },
  39.             "contextWindow": 204800,
  40.             "maxTokens": 131072
  41.           },
  42.           {
  43.             "id": "glm-image",
  44.             "name": "CogView-3-Flash",
  45.             "api": "openai-completions",
  46.             "reasoning": true,
  47.             "input": [
  48.               "text"
  49.             ],
  50.             "cost": {
  51.               "input": 0,
  52.               "output": 0,
  53.               "cacheRead": 0,
  54.               "cacheWrite": 0
  55.             },
  56.             "contextWindow": 204800,
  57.             "maxTokens": 131072
  58.           }
  59.         ]
  60.       }
  61.     }
  62.   },
  63.   "agents": {
  64.     "defaults": {
  65.       "model": {
  66.         "primary": "zai/glm-4.7-flash"
  67.       },
  68.       "models": {
  69.         "zai/glm-4.7-flash": {},
  70.         "zai/glm-4.6v-flash": {},
  71.             "zai/glm-image": {}
  72.       }
  73.     }
  74.   },
复制代码
主要将provider.zai.models中的模型替换为可调用的GLM模型,然后将agents.defaults.model.primary替换为默认使用的模型。

原文地址:https://blog.csdn.net/qq_62592592/article/details/159476877




欢迎光临 AI创想 (https://llms-ai.com/) Powered by Discuz! X3.4