Title: [Bug] Hardcoded 8192 max_tokens limit overrides model's 32K context window, causing "no completion capacity" error #22141
Replies: 2 comments 2 replies
|
The 8192 comes from the model entry, not from the chat settings. RAGFlow stores its own context length per model, and a model picked from the Ollama list is saved with 0 there (Ollama's model list doesn't report a context size). The chat pipeline treats 0 as 8192. Fix: Settings > Model providers > your Ollama instance, click the pencil (Edit model) next to What I found in the v1.0.0-rc3 code:
Caveat: a retrieval that fills the whole 32k window can still overflow by the citation rules (32853 vs 32768). That's #21887, with an open fix in #21915. |
|
@liyunpeng1216 The max_token you configured in the chat model setting is the model max_token which is the model max generated token. |



The 8192 comes from the model entry, not from the chat settings. RAGFlow stores its own context length per model, and a model picked from the Ollama list is saved with 0 there (Ollama's model list doesn't report a context size). The chat pipeline treats 0 as 8192.
Fix: Settings > Model providers > your Ollama instance, click the pencil (Edit model) next to
qwen3.5-nothink-32kand set "Max context length" to 32768.What I found in the v1.0.0-rc3 code:
clampChatConfigMaxTokens. The window it checks is the model'sextra.max_tokens(model_factory.go), with 8192 when that's 0 (chat_pipeline.go).