do not include slackbot sessions when fetching chat sessions

do not include slackbot sessions when fetching `chat sessions`
This commit is contained in:
pablonyx 2024-12-15 16:35:19 -08:00 committed by GitHub
commit 3f3d4da611
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -141,14 +141,20 @@ def get_valid_messages_from_query_sessions(
return {row.chat_session_id: row.message for row in first_messages}
# Retrieves chat sessions by user
# Chat sessions do not include onyxbot flows
def get_chat_sessions_by_user(
user_id: UUID | None,
deleted: bool | None,
db_session: Session,
include_onyxbot_flows: bool = False,
limit: int = 50,
) -> list[ChatSession]:
stmt = select(ChatSession).where(ChatSession.user_id == user_id)
if not include_onyxbot_flows:
stmt = stmt.where(ChatSession.onyxbot_flow.is_(False))
stmt = stmt.order_by(desc(ChatSession.time_created))
if deleted is not None: