Skip to content

Commit

Permalink
do not include slackbot sessions when fetching chat sessions (#3418)
Browse files Browse the repository at this point in the history
* k

* k
  • Loading branch information
pablonyx authored Dec 12, 2024
1 parent 4ae3b48 commit 1e7d9d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/danswer/db/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ 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 danswerbot flows
def get_chat_sessions_by_user(
user_id: UUID | None,
deleted: bool | None,
Expand All @@ -149,6 +151,8 @@ def get_chat_sessions_by_user(
) -> list[ChatSession]:
stmt = select(ChatSession).where(ChatSession.user_id == user_id)

stmt = stmt.where(ChatSession.danswerbot_flow.is_(False))

stmt = stmt.order_by(desc(ChatSession.time_created))

if deleted is not None:
Expand Down

0 comments on commit 1e7d9d1

Please sign in to comment.