skylankong
skylankong
  • 发布:2026-03-18 22:52
  • 更新:2026-03-18 23:02
  • 阅读:16

如何使用本地的ollama模型?

分类:HBuilderX

本地使用ollama运行了模型,ollama run qwen3-coder:30b,在chrome插件和ollama工具都能正常访问,如何在IDE中配置使用?
配置文件如下
UNI_AGENT_BASE_URL=http://127.0.0.1:11434
UNI_AGENT_API_KEY=any_value
UNI_AGENT_PROVIDER=ollama
UNI_AGENT_MODEL=qwen3-coder:30b
UNI_AGENT_SMALL_FAST_MODEL=qwen3-coder:30b

报错信息如下
❌ 错误: Model not found: ollama/qwen3-coder:30b.
Model not found: ollama/qwen3-coder:30b.

2026-03-18 22:52 负责人:无 分享
已邀请:
Ask小助手

Ask小助手

欢迎到专业群( HBuilderX技术交流群 ) 咨询,群中有相关专业的管理员和群友。

根据知识库中的配置规范,uni-agent 的环境变量配置中,UNI_AGENT_MODEL 需要包含 provider 前缀,格式为 provider/model-name

参考知识库中的配置示例:

UNI_AGENT_MODEL=anthropic/claude-sonnet-4-5  
UNI_AGENT_SMALL_FAST_MODEL=anthropic/claude-haiku-4-5

对于 Ollama 本地模型,你需要将模型名称改为包含 ollama/ 前缀的完整格式:

UNI_AGENT_BASE_URL=http://127.0.0.1:11434  
UNI_AGENT_API_KEY=any_value  
UNI_AGENT_PROVIDER=ollama  
UNI_AGENT_MODEL=ollama/qwen3-coder:30b  
UNI_AGENT_SMALL_FAST_MODEL=ollama/qwen3-coder:30b

修改配置后,在 uni-agent 的聊天界面中点击设置按钮保存环境变量,配置会自动生效。详细配置步骤请参考 uni-agent 环境变量配置文档

如果修改后仍然报错,请确认 Ollama 服务已正常运行且模型已正确加载(可通过 ollama list 命令查看本地可用的模型列表)。

内容为 AI 生成,仅供参考
skylankong

skylankong (作者)

❌ 错误: Model not found: ollama/qwen3-coder:30b.

Model not found: ollama/qwen3-coder:30b.
还是报错,配置文件已做修改

请使用 KEY=VALUE 格式填入 API Keys,示例:ANTHROPIC_API_KEY=sk-ant-xxx

以 # 开头的行为注释,会被忽略

UNI_AGENT_BASE_URL=http://127.0.0.1:11434
UNI_AGENT_API_KEY=any_value
UNI_AGENT_PROVIDER=ollama
UNI_AGENT_MODEL=ollama/qwen3-coder:30b
UNI_AGENT_SMALL_FAST_MODEL=ollama/qwen3-coder:30b

要回复问题请先登录注册