Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(RBAC): skip validation for unplug #1264

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Conversation

mamadoudicko
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Sep 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2023 1:10pm
quivr-strapi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2023 1:10pm
quivrapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2023 1:10pm

@dosubot dosubot bot added the area: backend Related to backend functionality or under the /backend directory label Sep 26, 2023
@StanGirard StanGirard merged commit df03ee6 into main Sep 26, 2023
5 of 9 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Sep 26, 2023

Risk Level 2 - /home/runner/work/quivr/quivr/backend/routes/chat_routes.py

The code changes in the pull request are generally good, but there are a few areas that could be improved for better readability and maintainability.

  1. Exception Handling: The delete_chat_from_db function catches all exceptions and simply prints them. This is not a good practice as it can make debugging difficult. It would be better to log the exceptions with more context or re-raise them after logging. For example:

    try:
        supabase_db.delete_chat_history(chat_id)
    except Exception as e:
        logger.error(f'Error deleting chat history for chat_id {chat_id}: {e}')
        raise
  2. Code Duplication: There is a lot of duplicated code in the create_question_handler and create_stream_question_handler functions. Consider refactoring the common code into a separate function.

  3. Error Messages: The error messages in the HTTPException instances could be more descriptive. For example, instead of 'You should be the owner of the chat to update it.', consider 'User {current_user.id} is not the owner of chat {chat_id} and cannot update it.'

  4. Code Comments: There are several TODO comments in the code. These should be addressed or removed if they are no longer relevant.

  5. Print Statements: There are print statements used for debugging (e.g., print(\"streaming\")). These should be replaced with proper logging.

  6. Variable Naming: The variable userDailyUsage does not follow the Python naming conventions (PEP 8). It should be in snake_case, i.e., user_daily_usage.

  7. Type Annotations: There are some lines where the type is ignored (e.g., # type: ignore). It would be better to fix the underlying issue causing the type checker to complain, if possible.


🐛🔄🔍


Powered by Code Review GPT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: backend Related to backend functionality or under the /backend directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants