From 96474e914849d130dc85d53c0a4a558db9dc9a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=8E=E5=A4=A9?= <460342015@qq.com> Date: Thu, 28 Dec 2023 14:26:22 +0800 Subject: [PATCH] fix(chat_history): chat_history_db mysql message query bug (#989) --- dbgpt/storage/chat_history/chat_history_db.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dbgpt/storage/chat_history/chat_history_db.py b/dbgpt/storage/chat_history/chat_history_db.py index e304d7aa0..080ee7492 100644 --- a/dbgpt/storage/chat_history/chat_history_db.py +++ b/dbgpt/storage/chat_history/chat_history_db.py @@ -106,4 +106,11 @@ def raw_delete(self, conv_uid: int): chat_history.delete() def get_by_uid(self, conv_uid: str) -> ChatHistoryEntity: - return ChatHistoryEntity.query.filter_by(conv_uid=conv_uid).first() + # return ChatHistoryEntity.query.filter_by(conv_uid=conv_uid).first() + + session = self.get_raw_session() + chat_history = session.query(ChatHistoryEntity) + chat_history = chat_history.filter(ChatHistoryEntity.conv_uid == conv_uid) + result = chat_history.first() + session.close() + return result