From 3306025640f98649973a65852bde2566bf99cbbb Mon Sep 17 00:00:00 2001 From: Artem Litvinov Date: Thu, 12 Oct 2023 02:42:14 +0100 Subject: [PATCH] fix: add message and get sid --- src/assistant/lib/agent/chat_repository.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assistant/lib/agent/chat_repository.py b/src/assistant/lib/agent/chat_repository.py index 959a1f6..1bcc5dc 100644 --- a/src/assistant/lib/agent/chat_repository.py +++ b/src/assistant/lib/agent/chat_repository.py @@ -23,7 +23,7 @@ class ChatHistoryRepository: sa.select(orm_models.ChatHistory) .filter_by(channel=request.channel, user_id=request.user_id) .filter( - (sa.text("NOW()") - sa.func.extract("epoch", orm_models.ChatHistory.created)) / 60 + (sa.func.extract("epoch", sa.text("NOW()")) - sa.func.extract("epoch", orm_models.ChatHistory.created)) / 60 <= request.minutes_ago ) .order_by(orm_models.ChatHistory.created.desc()) @@ -33,7 +33,7 @@ class ChatHistoryRepository: chat_session = result.scalars().first() if chat_session: - return chat_session.id + return chat_session.session_id except sqlalchemy.exc.SQLAlchemyError as error: self.logger.exception("Error: %s", error)