From 9f0650407c20676e6d348fcee794909433d80c41 Mon Sep 17 00:00:00 2001 From: langxm Date: Wed, 14 Oct 2026 04:46:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(M4.3):=20=E7=BB=A7=E6=89=BF=E9=A6=96?= =?UTF-8?q?=E8=BD=AE=E5=88=A4=E5=AE=9A=E4=BF=AE=E6=AD=A3=E2=80=94=E2=80=94?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B6=88=E6=81=AF=E5=85=88=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=20=5Fnew=3D=3D0=20=E6=B0=B8=E4=B8=8D?= =?UTF-8?q?=E6=88=90=E7=AB=8B=EF=BC=8C=E6=94=B9=20<=3D1(=E5=90=AB=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E8=BD=AE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/routes/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/api/routes/chat.py b/backend/app/api/routes/chat.py index ff71ec9..a401cd2 100644 --- a/backend/app/api/routes/chat.py +++ b/backend/app/api/routes/chat.py @@ -115,7 +115,7 @@ async def chat(body: ChatBody, authorization: str | None = Header(None), session c = ConversationRepo(session).get(conv_id) if c and c.inherit_from: _new = MessageRepo(session).count_since_sep(user["id"], conversation_id=conv_id) - if _new == 0: # 首轮 + if _new <= 1: # 首轮(当前轮刚入库,<=1 即此前无对话) tail = MessageRepo(session).list_since_sep(user["id"], conversation_id=c.inherit_from) pairs = [m for m in tail if m.role in ("user", "assistant")][-6:] if pairs: