From af51aae4b48b42271ea0a17402ee4b10cc2b5043 Mon Sep 17 00:00:00 2001 From: goulustis Date: Mon, 1 Dec 2025 18:08:45 +0800 Subject: [PATCH] bug fix --- fastapi_server/server_dashscope.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fastapi_server/server_dashscope.py b/fastapi_server/server_dashscope.py index 8f0132c..27bef2d 100644 --- a/fastapi_server/server_dashscope.py +++ b/fastapi_server/server_dashscope.py @@ -52,6 +52,7 @@ def sse_chunks_from_stream(chunk_generator, response_id: str, model: str = "qwen """ Stream chunks from pipeline and format as SSE. Accumulates text and sends incremental updates. + DashScope SDK expects accumulated text in each chunk (not deltas). """ created_time = int(time.time()) accumulated_text = "" @@ -64,8 +65,8 @@ def sse_chunks_from_stream(chunk_generator, response_id: str, model: str = "qwen "code": 200, "message": "OK", "output": { - # Send empty during stream; many SDKs only expose output_text on final - "text": "", + # DashScope SDK expects accumulated text, not empty or delta + "text": accumulated_text, "created": created_time, "model": model, },