Skip to content

Commit

Permalink
update typing
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Nov 4, 2024
1 parent a286f13 commit f160ce1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions backend/danswer/server/manage/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ class RecentAssistantsRequest(BaseModel):


def update_recent_assistants(
recent_assistants: list[int] | None, current_assistant
recent_assistants: list[int] | None, current_assistant: int
) -> list[int]:
if recent_assistants is None:
recent_assistants = []
Expand Down Expand Up @@ -559,15 +559,10 @@ def update_user_recent_assistants(
else:
raise RuntimeError("This should never happen")

# Get current recent assistants list
current_user = db_session.query(User).filter(User.id == user.id).first()

# Remove the current assistant if it exists in the list
recent_assistants = current_user.recent_assistants
recent_assistants = UserInfo.from_model(user).preferences.recent_assistants
updated_recent_assistants = update_recent_assistants(
recent_assistants, request.current_assistant
)

db_session.execute(
update(User)
.where(User.id == user.id) # type: ignore
Expand Down

0 comments on commit f160ce1

Please sign in to comment.