Skip to content

Commit

Permalink
typing
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Nov 23, 2024
1 parent 1a009c6 commit b47626b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions backend/ee/danswer/db/query_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from sqlalchemy.orm import contains_eager
from sqlalchemy.orm import joinedload
from sqlalchemy.orm import Session
from sqlalchemy.sql.expression import UnaryExpression

from danswer.db.models import ChatMessage
from danswer.db.models import ChatSession
Expand All @@ -22,8 +23,8 @@ def fetch_chat_sessions_eagerly_by_time(
limit: int | None = 500,
initial_time: datetime.datetime | None = None,
) -> list[ChatSession]:
time_order = desc(ChatSession.time_created)
message_order = asc(ChatMessage.id)
time_order: UnaryExpression = desc(ChatSession.time_created)
message_order: UnaryExpression = asc(ChatMessage.id)

filters: list[ColumnElement | BinaryExpression] = [
ChatSession.time_created.between(start, end)
Expand Down
5 changes: 3 additions & 2 deletions backend/ee/danswer/db/usage_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections.abc import Generator
from datetime import datetime
from typing import IO
from typing import Optional

from fastapi_users_db_sqlalchemy import UUID_ID
from sqlalchemy.orm import Session
Expand All @@ -21,7 +22,7 @@ def get_empty_chat_messages_entries__paginated(
period: tuple[datetime, datetime],
limit: int | None = 500,
initial_time: datetime | None = None,
) -> tuple[int, list[ChatMessageSkeleton]]:
) -> tuple[Optional[datetime], list[ChatMessageSkeleton]]:
chat_sessions = fetch_chat_sessions_eagerly_by_time(
start=period[0],
end=period[1],
Expand Down Expand Up @@ -63,7 +64,7 @@ def get_all_empty_chat_message_entries(
db_session: Session,
period: tuple[datetime, datetime],
) -> Generator[list[ChatMessageSkeleton], None, None]:
initial_time = period[0]
initial_time: Optional[datetime] = period[0]
ind = 0
while True:
ind += 1
Expand Down

0 comments on commit b47626b

Please sign in to comment.