fix(M4.3): 继承首轮判定修正——用户消息先入库导致 _new==0 永不成立,改 <=1(含当前轮)
这个提交包含在:
@@ -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:
|
||||
|
||||
在新工单中引用
屏蔽一个用户