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

feat(brainSettings): rework knowledge tab #1534

Merged
merged 8 commits into from
Oct 31, 2023
Merged

Conversation

mamadoudicko
Copy link
Contributor

@mamadoudicko mamadoudicko commented Oct 31, 2023

Issue: #1435

  • feat(knowledgeTab): update structure
  • refactor: change AddKnowledge structure
  • feat: change AddKnowledge component structure
  • feat: rework sources logic
  • feat: change knowledge tab upload process
  • fix: change knowledge tab fetch, create, update logic
  • feat: improve added knowledge ui
  • style: improve responsivity

Fix:

Screen.Recording.2023-10-31.at.18.49.44.mov

@mamadoudicko mamadoudicko temporarily deployed to preview October 31, 2023 17:38 — with GitHub Actions Inactive
Copy link

vercel bot commented Oct 31, 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 Oct 31, 2023 5:41pm
quivr-strapi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2023 5:41pm
quivrapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2023 5:41pm

Copy link
Contributor

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

The code changes seem to be safe, but there are some improvements that can be made for readability and error handling:

  1. The handleUnsubscribeOrDeleteBrain function has a lot of responsibilities. Consider breaking it into smaller functions.

  2. The error handling in the handleUnsubscribeOrDeleteBrain function could be improved. Currently, it just logs the error to the console. Consider adding user-friendly error messages or handling specific error types differently.


Risk Level 3 - /home/runner/work/quivr/quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/KnowledgeTab/components/KnowledgeTable/components/KnowledgeItem/hooks/useKnowledgeItem.ts

The onDeleteKnowledge function has a high risk score due to the lack of error handling. If the deleteKnowledge function throws an error, the invalidateKnowledgeDataKey function will not be called, potentially leading to stale data.

try {
  if (brainId === undefined) {
    throw new Error(t(\"noBrain\", { ns: \"explore\" }));
  }
  await deleteKnowledge({
    brainId,
    knowledgeId: knowledge.id,
  });
  invalidateKnowledgeDataKey();
  publish({
    variant: \"success\",
    text: t(\"deleted\", {
      fileName: knowledge_name,
      brain: brain?.name,
      ns: \"explore\",
    }),
  });
} catch (error) {
  publish({
    variant: \"warning\",
    text: t(\"errorDeleting\", { fileName: knowledge_name, ns: \"explore\" }),
  });
  console.error(\"Error deleting\", error);
}

Consider wrapping the deleteKnowledge function in a try-catch block and handle the error properly.


Risk Level 3 - /home/runner/work/quivr/quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/KnowledgeTab/components/AddKnowledge/hooks/useFeedBrain.ts

The feedBrain function has a high risk score due to the lack of error handling. If the createChat or handleFeedBrain functions throw an error, the deleteChat function will not be called, potentially leading to memory leaks.

const currentChatId = (await createChat(\"New Chat\")).chat_id;
try {
  dispatchHasPendingRequests?.();
  closeFeedInput?.();
  setHasPendingRequests(true);
  await handleFeedBrain({
    brainId,
    chatId: currentChatId,
  });
  setKnowledgeToFeed([]);
} catch (e) {
  publish({
    variant: \"danger\",
    text: JSON.stringify(e),
  });
} finally {
  setHasPendingRequests(false);
  await deleteChat(currentChatId);
}

Consider wrapping the createChat function in a try-catch block and handle the error properly.


🔨🔧🚨


Powered by Code Review GPT

@StanGirard
Copy link
Collaborator

Very Nice !!!!

@mamadoudicko mamadoudicko merged commit e3925bc into main Oct 31, 2023
17 checks passed
mamadoudicko pushed a commit that referenced this pull request Nov 1, 2023
🤖 I have created a release *beep* *boop*
---


## 0.0.102 (2023-11-01)

## What's Changed
* docs: update Quivr doc by @mamadoudicko in
#1531
* docs: ✏️ search by @StanGirard in
#1535
* feat(brainSettings): rework knowledge tab by @mamadoudicko in
#1534
* docs: ✏️ schema by @StanGirard in
#1537
* feat: 🎸 max-token by @StanGirard in
#1538


**Full Changelog**:
v0.0.101...v0.0.102

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
coolCatalyst added a commit to coolCatalyst/quivr that referenced this pull request Jun 1, 2024
🤖 I have created a release *beep* *boop*
---


## 0.0.102 (2023-11-01)

## What's Changed
* docs: update Quivr doc by @mamadoudicko in
QuivrHQ/quivr#1531
* docs: ✏️ search by @StanGirard in
QuivrHQ/quivr#1535
* feat(brainSettings): rework knowledge tab by @mamadoudicko in
QuivrHQ/quivr#1534
* docs: ✏️ schema by @StanGirard in
QuivrHQ/quivr#1537
* feat: 🎸 max-token by @StanGirard in
QuivrHQ/quivr#1538


**Full Changelog**:
QuivrHQ/quivr@v0.0.101...v0.0.102

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Dream528 added a commit to Dream528/quivr that referenced this pull request Jul 28, 2024
🤖 I have created a release *beep* *boop*
---


## 0.0.102 (2023-11-01)

## What's Changed
* docs: update Quivr doc by @mamadoudicko in
QuivrHQ/quivr#1531
* docs: ✏️ search by @StanGirard in
QuivrHQ/quivr#1535
* feat(brainSettings): rework knowledge tab by @mamadoudicko in
QuivrHQ/quivr#1534
* docs: ✏️ schema by @StanGirard in
QuivrHQ/quivr#1537
* feat: 🎸 max-token by @StanGirard in
QuivrHQ/quivr#1538


**Full Changelog**:
QuivrHQ/quivr@v0.0.101...v0.0.102

---
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: frontend Related to frontend functionality or under the /frontend directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants