Skip to content

Commit

Permalink
fix: remove user dependent for recommend questions api (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
Icemap authored Oct 18, 2024
1 parent 1d0ecf1 commit 48f3a20
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions backend/app/api/routes/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,12 @@ def get_chat_subgraph(session: SessionDep, user: OptionalUserDep, chat_message_i


@router.get("/chat-messages/{chat_message_id}/recommend-questions", response_model=List[str])
def get_recommend_questions(session: SessionDep, user: CurrentUserDep, chat_message_id: int):
def get_recommend_questions(session: SessionDep, chat_message_id: int):
chat_message = chat_repo.get_message(session, chat_message_id)
if not chat_message:
if not chat_message or len(chat_message.content) == 0:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="Chat message not found"
)

if not user_can_view_chat(chat_message.chat, user):
raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Access denied")

return get_chat_message_recommend_questions(session, chat_message, user)
return get_chat_message_recommend_questions(session, chat_message)

0 comments on commit 48f3a20

Please sign in to comment.