Hermes-Agent 本地模型(Qwen2.5:7B)与 Minimax 在线模型配置及切换操作指南
前置说明
Hermes 使用 ~/.hermes/config.yaml 作为主配置文件,不支持 --config 参数指定配置文件,也不支持通过环境变量覆盖主模型。正确的多模型切换方式是使用 Profile(配置档案) 功能,每个 Profile 拥有独立的 config.yaml。
一、前置验证(确认环境就绪)
# 启动 Ollama 服务
start-ai
# 查看已安装模型,确 认 qwen2.5:7b 存在
ollama list
# 验证 Ollama API 服务正常(出现包含模型信息的 JSON 即正常)
curl http://localhost:11434/api/tags
# 检查端口监听状态(显示 LISTEN 即正常)
netstat -tunlp | grep 11434
二、确认主配置文件(在线模型 Minimax)
Hermes 默认主配置文件位于 ~/.hermes/config.yaml,顶部 model 部 分应为 Minimax 配置:
model:
default: MiniMax-M2.7
provider: minimax-cn
base_url: https://api.minimaxi.com/anthropic
这个文件不需要修改,hermes chat 默认走此配置即为在线模型。
三、创建本地模型 Profile
1. 创建 local profile
hermes profile create local
成功后输出类似:
Profile 'local' created at /home/<用户名>/.hermes/profiles/local
Wrapper created: /home/<用户名>/.local/bin/local
2. 用主配置文件作为基础,覆盖 local profile 的配置
cp ~/.hermes/config.yaml ~/.hermes/profiles/local/config.yaml
3. 编辑 local profile 的配置文件,只修改顶部 model 部分
nano ~/.hermes/profiles/local/config.yaml
将文件顶部的 model: 块替换为:
model:
default: qwen2.5:7b
provider: openai
base_url: http://127.0.0.1:11434/v1
其余内容保持不变,保存退出(Ctrl+O → Enter → Ctrl+X)。
四、配置别名(快速切换)
⚠️ 注意:
local是 bash 保留关键字,不能直接用作命令,必须通过别名调用。
nano ~/.bashrc
添加以下内容:
alias hermes-local='hermes chat --profile local'
alias hermes-online='hermes chat'
使别名生效:
source ~/.bashrc
五、验证切换效果
启动本地模型
hermes-local
进入后输入 /config,确认以下字段:
Model: qwen2.5:7b
Base URL: http://127.0.0.1:11434/v1
Config File: ~/.hermes/profiles/local/config.yaml
启动在线模型
hermes-online
进入后输入 /config,确认以下字段:
Model: MiniMax-M2.7
Base URL: https://api.minimaxi.com/anthropic
Config File: ~/.hermes/config.yaml