1
0
mirror of https://github.com/ijaric/voice_assistant.git synced 2025-05-24 14:33:26 +00:00

fix: add message and get sid

This commit is contained in:
Artem Litvinov 2023-10-12 02:42:14 +01:00
parent 2db4a87bf4
commit 3306025640

View File

@ -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)