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: gpt4 is not available for brains if there is no given openAiKey #850

Merged
merged 3 commits into from
Aug 7, 2023

Conversation

ChloeMouret
Copy link
Contributor

@ChloeMouret ChloeMouret commented Aug 4, 2023

Description

Checklist before requesting a review

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented hard-to-understand areas
  • I have ideally added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Screenshots (if appropriate):

Capture d’écran 2023-08-04 à 12 18 13 Capture d’écran 2023-08-04 à 12 18 55

@ChloeMouret ChloeMouret temporarily deployed to preview August 4, 2023 10:20 — with GitHub Actions Inactive
@vercel
Copy link

vercel bot commented Aug 4, 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 Aug 4, 2023 10:23am
quivrapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 4, 2023 10:23am

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

LOGAF Level 2 - /home/runner/work/quivr/quivr/frontend/lib/context/BrainConfigProvider/brain-config-provider.tsx

  1. The updateConfig function could be simplified. Instead of creating a new updatedConfig object, you could directly update the config state.

Example:

const updateConfig = (newConfig: Partial<BrainConfig>) => {
  setBrainConfig((config) => {
    const updatedConfig = { ...config, ...removeUndefined(newConfig) };
    saveBrainConfigInLocalStorage(updatedConfig);
    return updatedConfig;
  });
};
  1. The resetConfig function could be simplified. Instead of calling updateConfig(defaultBrainConfig), you could directly set the brainConfig state to defaultBrainConfig.

Example:

const resetConfig = () => {
  setBrainConfig(defaultBrainConfig);
};

LOGAF Level 3 - /home/runner/work/quivr/quivr/frontend/app/chat/[chatId]/components/ChatInput/components/ConfigModal/ConfigModal.tsx

  1. Consider using a more descriptive placeholder than <div /> when chatId is undefined. This could be a loading spinner or a message to the user.
  2. The Modal component seems to be doing a lot. Consider breaking it down into smaller, more manageable components.
  3. Avoid using inline functions in your JSX. This can lead to unnecessary re-renders. Instead, define your functions outside of your JSX and reference them inside your JSX.

Example:

const onSubmit = (e) => {
  void handleSubmit(e);
  setIsConfigModalOpen(false);
};

// In your JSX
<form onSubmit={onSubmit} className="mt-10 flex flex-col items-center gap-2">

LOGAF Level 2 - /home/runner/work/quivr/quivr/backend/core/models/brains.py

1. Exposed API Key: The openai_api_key is exposed in the Brain class. This is a security risk and should be removed or securely stored.

2. Code Duplication: The get_brain_users and delete_user_from_brain methods have similar code for querying the brains_users table. Consider creating a helper method to reduce code duplication.

3. TODO Comments: There are TODO comments indicating that some methods should be moved to a new BrainService. Plan to refactor this soon to improve code organization.

4. Magic Strings: There are several magic strings (e.g., "brains_users", "private", "gpt-3.5-turbo"). Consider moving these to constants or configuration files for easier management.

5. Error Handling: There is no error handling in the delete_brain method. If the delete_brain_user_by_id method does not return any results, the method continues to execute the remaining delete operations which may lead to unexpected behavior.


🔒🔧🔄


Powered by Code Review GPT

@StanGirard StanGirard merged commit e9ebeef into main Aug 7, 2023
8 of 9 checks passed
StanGirard pushed a commit that referenced this pull request Sep 12, 2023
…#850)

* rename defineMaxToken

* use gpt-3.5-turbo instead of gpt-3.5-turbo-0613

* gpt4 not available if no open ai key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants