From 6b57e4e0ff8bab223d33f33057a865bb4c96a913 Mon Sep 17 00:00:00 2001 From: "Charlie.Wei" Date: Sat, 23 Dec 2023 10:05:17 +0800 Subject: [PATCH] Fix chitchat lost context (#1828) Co-authored-by: luowei Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> --- .../read_only_conversation_token_db_buffer_shared_memory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/core/memory/read_only_conversation_token_db_buffer_shared_memory.py b/api/core/memory/read_only_conversation_token_db_buffer_shared_memory.py index 4123521ae3fae9..9840c5c22da5c3 100644 --- a/api/core/memory/read_only_conversation_token_db_buffer_shared_memory.py +++ b/api/core/memory/read_only_conversation_token_db_buffer_shared_memory.py @@ -27,7 +27,7 @@ def buffer(self) -> List[BaseMessage]: # fetch limited messages desc, and return reversed messages = db.session.query(Message).filter( Message.conversation_id == self.conversation.id, - Message.answer_tokens > 0 + Message.answer != '' ).order_by(Message.created_at.desc()).limit(self.message_limit).all() messages = list(reversed(messages))