Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Nov 11, 2024
1 parent d835de1 commit e8cd263
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/ee/danswer/db/query_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def fetch_chat_sessions_eagerly_by_time(
initial_time: datetime.datetime | None = None,
) -> list[ChatSession]:
time_order = desc(ChatSession.time_created)
message_order = asc(ChatMessage.time_sent) # Changed from ChatMessage.id
message_order = asc(ChatMessage.id)

filters: list[ColumnElement | BinaryExpression] = [
ChatSession.time_created.between(start, end)
Expand All @@ -35,7 +35,7 @@ def fetch_chat_sessions_eagerly_by_time(
subquery = (
db_session.query(ChatSession.id, ChatSession.time_created)
.filter(*filters)
.order_by(ChatSession.id, time_order)
.order_by(time_order, ChatSession.id)
.distinct(ChatSession.id)
.limit(limit)
.subquery()
Expand Down
1 change: 1 addition & 0 deletions backend/ee/danswer/db/usage_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def get_empty_chat_messages_entries__paginated(
)
if len(chat_sessions) == 0:
return None, []

return chat_sessions[0].time_created, message_skeletons


Expand Down

0 comments on commit e8cd263

Please sign in to comment.