Enable thinking mode in full chat view, keep disabled in widget/panel
stream_chat_with_tools now accepts a think parameter. run_generation forwards it to Ollama. The message POST route reads think from the request body. ChatView passes think=true so qwen3 uses chain-of-thought reasoning for full conversations; the dashboard widget and ChatPanel omit it, staying fast. Dashboard button updated to "Think it through in Chat →" to signal the deeper capability. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -114,12 +114,17 @@ async def stream_chat_with_tools(
|
||||
messages: list[dict],
|
||||
model: str,
|
||||
tools: list[dict] | None = None,
|
||||
think: bool = False,
|
||||
) -> AsyncGenerator[ChatChunk, None]:
|
||||
"""Stream chat completion from Ollama with tool support.
|
||||
|
||||
Yields ChatChunk objects. If the model returns tool_calls, a
|
||||
ChatChunk(type="tool_calls") is yielded. Always ends with
|
||||
ChatChunk(type="done").
|
||||
|
||||
Set think=True to enable the model's chain-of-thought reasoning (qwen3+).
|
||||
Thinking tokens are consumed by Ollama and not forwarded to the caller;
|
||||
only the final response content is yielded. Expect higher TTFT when enabled.
|
||||
"""
|
||||
options: dict = {"num_ctx": 32768}
|
||||
if tools:
|
||||
@@ -129,7 +134,7 @@ async def stream_chat_with_tools(
|
||||
"messages": messages,
|
||||
"stream": True,
|
||||
"options": options,
|
||||
"think": False,
|
||||
"think": think,
|
||||
}
|
||||
if tools:
|
||||
payload["tools"] = tools
|
||||
|
||||
Reference in New Issue
Block a user