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:
2026-02-18 21:06:54 -05:00
parent 815eed2574
commit 24d3c5bc68
6 changed files with 14 additions and 3 deletions
@@ -166,6 +166,7 @@ async def run_generation(
user_content: str,
context_note_id: int | None = None,
exclude_note_ids: list[int] | None = None,
think: bool = False,
) -> None:
"""Stream LLM response into buffer with periodic DB flushes."""
MAX_TOOL_ROUNDS = 5
@@ -349,7 +350,7 @@ async def run_generation(
buf.append_event("status", {"status": "Generating response..." if _round == 0 else "Composing response..."})
t_stream = time.monotonic()
async for chunk in stream_chat_with_tools(messages, model, tools=tools):
async for chunk in stream_chat_with_tools(messages, model, tools=tools, think=think):
if buf.cancel_event.is_set():
cancelled = True
break