mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-06 01:40:32 +02:00
do not include slackbot sessions when fetching chat sessions
do not include slackbot sessions when fetching `chat sessions`
This commit is contained in:
commit
3f3d4da611
@ -141,14 +141,20 @@ def get_valid_messages_from_query_sessions(
|
|||||||
return {row.chat_session_id: row.message for row in first_messages}
|
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(
|
def get_chat_sessions_by_user(
|
||||||
user_id: UUID | None,
|
user_id: UUID | None,
|
||||||
deleted: bool | None,
|
deleted: bool | None,
|
||||||
db_session: Session,
|
db_session: Session,
|
||||||
|
include_onyxbot_flows: bool = False,
|
||||||
limit: int = 50,
|
limit: int = 50,
|
||||||
) -> list[ChatSession]:
|
) -> list[ChatSession]:
|
||||||
stmt = select(ChatSession).where(ChatSession.user_id == user_id)
|
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))
|
stmt = stmt.order_by(desc(ChatSession.time_created))
|
||||||
|
|
||||||
if deleted is not None:
|
if deleted is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user