Skip to content

opencode+Ollama 配置本地模型,使用时opencode生成的prompt特别大,导致本地模型卡死 #17304

Closed as not planned

Description

@sky7725805

Question

我使用opencode+Ollama 配置本地模型
,在配置文件opencode.json中增加本地模型配置项:
"ollama": {
"name": "Ollama本地模型",
"npm": "@ai-sdk/openai-compatible",
"models": {
"kamekichi128/qwen3-4b-instruct-2507:latest": {
"name": "Qwen3-4B-Instruct (kamekichi128)",
"parameters": {"temperature": 0.2}
},
"qwen2.5-coder:3b": {
"name": "qwen2.5-coder:3b",
"promptTemplate": "{{content}}" ,
"parameters": {"temperature": 0.2}
}
},
"options": {"baseURL": "http://localhost:11434/v1","systemPrompt": "","promptTemplate": "{{content}}"}
}
使用时启动Ollama服务,在Ollama客户端验证服务可用,并且反应速度很快。而在opencode中加载本地模型qwen2.5-coder:3b使用时,对话仅仅是输入“你好”,都需要40S时间才有回应,
Ollama日志显示prompt=9641,太大了,导致模型处理速度太慢。
Ollama日志:
llama_context: n_ctx_seq (2048) < n_ctx_train (32768) -- the full capacity of the model will not be utilized
llama_context: CPU output buffer size = 0.59 MiB
llama_kv_cache: CPU KV buffer size = 72.00 MiB
llama_kv_cache: size = 72.00 MiB ( 2048 cells, 36 layers, 1/1 seqs), K (f16): 36.00 MiB, V (f16): 36.00 MiB
llama_context: Flash Attention was auto, set to enabled
llama_context: CPU compute buffer size = 300.75 MiB
llama_context: graph nodes = 1231
llama_context: graph splits = 1
time=2026-03-09T09:44:38.187+08:00 level=INFO source=server.go:1388 msg="llama runner started in 1.34 seconds"
time=2026-03-09T09:44:38.188+08:00 level=INFO source=sched.go:567 msg="loaded runners" count=1
time=2026-03-09T09:44:38.188+08:00 level=INFO source=server.go:1350 msg="waiting for llama runner to start responding"
time=2026-03-09T09:44:38.188+08:00 level=INFO source=server.go:1388 msg="llama runner started in 1.35 seconds"
time=2026-03-09T09:44:38.477+08:00 level=WARN source=runner.go:153 msg="truncating input prompt" limit=2048 prompt=9641 keep=4 new=2048
[GIN] 2026/03/09 - 09:44:48 | 200 | 4.2154ms | 127.0.0.1 | GET "/api/tags"
[GIN] 2026/03/09 - 09:45:04 | 500 | 28.0329633s | 127.0.0.1 | POST "/v1/chat/completions"

是什么原因导致prompt那么大?

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 13, 2026
  2. github-actions commented on Mar 13, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. rekram1-node commented on Jun 23, 2026

    @rekram1-node
    Contributor

    Automated: closing question issues.

    GitHub Issues are for bug reports and feature requests only — questions / support are no longer tracked here.

    If this is a bug or feature request, please open a new issue with the appropriate template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions