diff --git a/dsLightRag/Routes/QA.py b/dsLightRag/Routes/QA.py index 356a46f5..411ce01b 100644 --- a/dsLightRag/Routes/QA.py +++ b/dsLightRag/Routes/QA.py @@ -169,7 +169,7 @@ async def chat(request: fastapi.Request): async for chunk in stream: if chunk.choices[0].delta.content: full_answer.append(chunk.choices[0].delta.content) - yield f"data: {json.dumps({'reply': chunk.choices[0].delta.content}, ensure_ascii=False)}\n\n" + yield f"data: {json.dumps({'reply': chunk.choices[0].delta.content.replace('$ ', '$').replace(' $', '$'), 'session_id': session_id}, ensure_ascii=False)}\n\n" # 保存回答到ES和对话历史 if full_answer: