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:
parent
2db4a87bf4
commit
3306025640
|
@ -23,7 +23,7 @@ class ChatHistoryRepository:
|
||||||
sa.select(orm_models.ChatHistory)
|
sa.select(orm_models.ChatHistory)
|
||||||
.filter_by(channel=request.channel, user_id=request.user_id)
|
.filter_by(channel=request.channel, user_id=request.user_id)
|
||||||
.filter(
|
.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
|
<= request.minutes_ago
|
||||||
)
|
)
|
||||||
.order_by(orm_models.ChatHistory.created.desc())
|
.order_by(orm_models.ChatHistory.created.desc())
|
||||||
|
@ -33,7 +33,7 @@ class ChatHistoryRepository:
|
||||||
|
|
||||||
chat_session = result.scalars().first()
|
chat_session = result.scalars().first()
|
||||||
if chat_session:
|
if chat_session:
|
||||||
return chat_session.id
|
return chat_session.session_id
|
||||||
except sqlalchemy.exc.SQLAlchemyError as error:
|
except sqlalchemy.exc.SQLAlchemyError as error:
|
||||||
self.logger.exception("Error: %s", error)
|
self.logger.exception("Error: %s", error)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user