-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: validate api key before saving #1057
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Risk Level 2 - /home/runner/work/quivr/quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/useSettingsTab.ts The code seems to be well written and follows good practices. However, there are a few areas that could be improved for better readability and maintainability:
const MODEL_SET_DELAY = 50;
// ...
setTimeout(() => {
if (brain.model !== undefined) {
setValue(\"model\", brain.model);
}
}, MODEL_SET_DELAY);
try {
const brain = await getBrain(brainId);
// ...
} catch (error) {
// Handle error
}
const isDefaultBrain = defaultBrainId === brainId;
// becomes
const isDefaultBrain = defaultBrainId?. === brainId; Risk Level 2 - /home/runner/work/quivr/quivr/frontend/app/user/components/ApiKeyConfig/hooks/useApiKeyConfig.ts The code is generally well written, but there are a few areas that could be improved:
try {
const createdApiKey = await createApiKey();
setApiKey(createdApiKey);
} catch (error) {
// Replace console.error with a secure logging service
}
try {
await updateUserIdentity({
openai_api_key: null,
});
// ...
} catch (error) {
// Handle error
} 🔢🔍🔐 Powered by Code Review GPT |
93b3fb3
to
db0011a
Compare
Screen.Recording.2023-08-29.at.17.42.40.mov