Fix writing assist: disable thinking mode, drop stuck-buffer 409
- stream_chat: add think=False parameter passed through to Ollama payload. qwen3 models have thinking enabled by default; without this flag the model spends minutes generating internal thinking tokens that stream_chat silently discards, leaving the frontend spinner blank until the SSE connection times out and the widget disappears. - create_assist_buffer: orphan (overwrite) a still-running buffer instead of raising. The old asyncio task holds a direct reference and completes harmlessly against the stale buffer. New requests always win. - assist_route: remove the 409 guard that blocked new requests when a previous generation got stuck. create_assist_buffer now handles this transparently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -100,7 +100,9 @@ def create_assist_buffer(user_id: int) -> GenerationBuffer:
|
||||
key = f"assist:{user_id}"
|
||||
existing = _buffers.get(key)
|
||||
if existing and existing.state == GenerationState.RUNNING:
|
||||
raise RuntimeError(f"Assist generation already running for user {user_id}")
|
||||
# Orphan the old buffer — the background task holds a direct reference
|
||||
# and will complete against it harmlessly. A new request always wins.
|
||||
logger.warning("Assist generation still running for user %d; orphaning old buffer", user_id)
|
||||
buf = GenerationBuffer(conversation_id=0, assistant_message_id=0)
|
||||
_buffers[key] = buf
|
||||
return buf
|
||||
|
||||
Reference in New Issue
Block a user