确保流式响应

This commit is contained in:
Tian jianyong 2025-12-24 20:32:53 +08:00
parent 57406f922e
commit 0272372b44

View File

@ -251,6 +251,9 @@ async def stream_ragflow_response(result: Generator, chat_id: str, start_time: f
chunk_time = time.time()
chunk_count += 1
# 让出控制权,确保流式响应
await asyncio.sleep(0)
# 检查第一个token的延迟
if not first_token_received:
first_token_received = True