修复OpenClaw的Gemma服务器问题 | AI生成和翻译

Home 2026.04

问题经过

OpenClaw在openclaw.json中配置了指向http://192.168.1.36:8081/v1llama-server提供程序,使用模型gemma-4-26B-A4B-it-UD-IQ3_S.gguf。当您通过OpenClaw发送“hi”时,由于两个问题导致失败:

问题一:llama-server未运行

进程未启动。旧的~/llama.sh脚本在端口8000上启动的是不同模型(DeepSeek-R1-Distill-Llama-8B),而非端口8081上的Gemma。因此虽然配置已更新为切换至Gemma,但实际服务器并未启动。

问题二:Gemma 4的思考模式

即使启动llama-server后,Gemma 4内置“思考”模式。默认情况下(--reasoning auto),llama-server根据模型模板检测并将输出拆分为:

采用默认auto设置时,content字段返回为空,所有文本都进入reasoning_content。而OpenClaw读取content字段,因此看起来模型未返回任何内容。

使用--reasoning-format none时,思考标记会以原始<|channel>thought标记形式泄露到content中——仍然存在问题。

解决方案

使用--reasoning off启动llama-server,完全禁用思考功能:

nohup /home/lzw/projects/llama.cpp/build/bin/llama-server \
  -m /home/lzw/projects/llama.cpp/models/gemma-4-26B-A4B-it-UD-IQ3_S.gguf \
  --port 8081 -c 32768 --reasoning off \
  >> /home/lzw/llama-server.log 2>&1 &

这将在content中生成干净的响应,不含思考痕迹。

注意事项


Back Donate