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: allow users to delete brains #1596

Merged
merged 2 commits into from
Nov 6, 2023
Merged

fix: allow users to delete brains #1596

merged 2 commits into from
Nov 6, 2023

Conversation

mamadoudicko
Copy link
Contributor

@mamadoudicko mamadoudicko commented Nov 6, 2023

Issue: #1362

Demo:

Screen.Recording.2023-11-06.at.16.53.02.mp4

Copy link

vercel bot commented Nov 6, 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 Nov 6, 2023 3:53pm
quivr-strapi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2023 3:53pm
quivrapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2023 3:53pm

@dosubot dosubot bot added the area: backend Related to backend functionality or under the /backend directory label Nov 6, 2023
Copy link
Contributor

github-actions bot commented Nov 6, 2023

Risk Level 2 - /home/runner/work/quivr/quivr/backend/models/databases/supabase/knowledge.py

The changes in this file are mostly additions of new methods and classes. However, there is a potential issue in the remove_brain_all_knowledge method. It seems to be deleting all knowledge associated with a brain, but there is no error handling or checks to ensure that the brain_id provided is valid and exists in the database. This could potentially lead to unexpected behavior or errors. Consider adding error handling or checks to ensure the brain_id is valid. For example:

if not self.db.from_(\"knowledge\").filter(\"brain_id\", \"eq\", str(brain_id)).execute().data:
    raise ValueError(\"Invalid brain_id\")

This will raise an error if the brain_id does not exist in the database, preventing further execution of the method.


Risk Level 2 - /home/runner/work/quivr/quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/usePrompt.ts

The code changes in this pull request are generally well written and follow good practices. However, there are a few areas that could be improved for better readability and maintainability:

  1. Use of console.log: There is a console.log statement in the submitPrompt function. This should be removed as it can lead to potential security risks and performance issues if the logged data is large. It's also not a good practice to have console logs in production code.
- console.log(\"OTHER CONFIGS\", otherConfigs);
  1. Error handling: In the catch block of the submitPrompt function, the error is being stringified and published. It would be better to provide a more user-friendly error message instead of stringifying the error object. Also, it's a good practice to log the error for debugging purposes.

  2. Use of void operator: The void operator is used before calling updateFormValues and fetchAllBrains functions. This operator is used to disregard a promise that is returned and not handled. If these functions return a promise, it would be better to handle these promises properly to catch any potential errors.

  3. Use of any type: The any type is used in several places. Using any defeats the purpose of using TypeScript, which is to provide static types. It would be better to replace any with more specific types if possible.


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

The changes in this file are minimal and do not introduce any potential bugs, readability issues, or performance problems. However, there is a potential issue with the delete_endpoint function. It seems to be deleting a knowledge from a brain, but there is no error handling or checks to ensure that the knowledge_id provided is valid and exists in the database. This could potentially lead to unexpected behavior or errors. Consider adding error handling or checks to ensure the knowledge_id is valid. For example:

if not get_knowledge(knowledge_id):
    raise ValueError(\"Invalid knowledge_id\")

This will raise an error if the knowledge_id does not exist in the database, preventing further execution of the function.


🔍🐛🔧


Powered by Code Review GPT

Copy link
Contributor

@gozineb gozineb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted ! Thanks mamadz

@mamadoudicko mamadoudicko merged commit 3c0819d into main Nov 6, 2023
12 of 13 checks passed
mamadoudicko pushed a commit that referenced this pull request Nov 7, 2023
🤖 I have created a release *beep* *boop*
---


## 0.0.107 (2023-11-06)

## What's Changed
* fix: allow to change model bro brain settings tab by @mamadoudicko in
#1590
* fix: fix notification banner display when too much items in chat list
by @mamadoudicko in #1593
* docs: add auth modes config by @mamadoudicko in
#1595
* fix: allow users to delete brains by @mamadoudicko in
#1596
* feat: 🎸 source documents by @StanGirard in
#1598


**Full Changelog**:
v0.0.106...v0.0.107

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Copy link

sentry-io bot commented Nov 9, 2023

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ StorageException: {'statusCode': 400, 'error': 'Error', 'message': 'body/prefixes must NOT have fewer than 1 items'} /brains/{brain_id}/subscription View Issue

Did you find this useful? React with a 👍 or 👎

coolCatalyst added a commit to coolCatalyst/quivr that referenced this pull request Jun 1, 2024
🤖 I have created a release *beep* *boop*
---


## 0.0.107 (2023-11-06)

## What's Changed
* fix: allow to change model bro brain settings tab by @mamadoudicko in
QuivrHQ/quivr#1590
* fix: fix notification banner display when too much items in chat list
by @mamadoudicko in QuivrHQ/quivr#1593
* docs: add auth modes config by @mamadoudicko in
QuivrHQ/quivr#1595
* fix: allow users to delete brains by @mamadoudicko in
QuivrHQ/quivr#1596
* feat: 🎸 source documents by @StanGirard in
QuivrHQ/quivr#1598


**Full Changelog**:
QuivrHQ/quivr@v0.0.106...v0.0.107

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

2 participants