Migrate backend jobs to Redis Streams
This commit is contained in:
@@ -260,15 +260,18 @@ def register_pro_completion_routes(app: FastAPI, get_api_key):
|
||||
enable_thinking=True,
|
||||
timeout=PRO_COMPLETION_TIMEOUT,
|
||||
):
|
||||
# Handle 'thinking' event - just update state, don't accumulate
|
||||
if event_type == "thinking":
|
||||
await _send_sse_event(event_queue, "thinking", {"request_id": request_id})
|
||||
continue
|
||||
|
||||
# Handle 'chunk' event - accumulate content
|
||||
if not payload:
|
||||
continue
|
||||
chunks.append(payload)
|
||||
await _send_sse_event(event_queue, "chunk", {"delta": payload, "request_id": request_id})
|
||||
|
||||
# Handle 'done' event - return full content
|
||||
content = "".join(chunks)
|
||||
async with PRO_STATES_LOCK:
|
||||
if state.cancel_requested:
|
||||
|
||||
Reference in New Issue
Block a user