Files
magpie/internal
yetone cd6ab61370 provider: a local Ollama model's window is its Modelfile's num_ctx (maohy915 on X)
An Ollama provider's list (/v1/models) names no window, so every model
took models.dev's guess or the agent's default and had to be set by hand.
The list now asks each model's /api/show (8 at a time, 6s in all) and
takes the window from the Modelfile's `num_ctx` in "parameters", else the
architecture's model_info.*.context_length. The reply limit is a quarter
of the window up to 32K when neither models.dev nor the user says one.
Compaction follows the window, which Codex and Claude Code already hold
their threshold under. A window or Max output the user typed still wins
(windowIn, replyLimit); a model whose show fails keeps the list as it was.
Scoped to the "ollama" preset; Ollama Cloud is unchanged.

Run on mote: go test ./internal/provider ./internal/catalog ./internal/agent
ok; go vet darwin, GOOS=windows, GOOS=linux -tags nogui on internal/provider;
gofmt clean. New TestOllamaListGivesModelfileWindow (fake Ollama, user-set
window present) fails with the list hook commented out (Context:0).
Not run: full ./... suite before the tag, a real Ollama, Windows/Linux runs.
2026-11-12 21:09:26 +08:00
..
…
…
…
…
…
2026-11-11 08:14:28 +08:00
…
…
…