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