From bd99dbae83b1f5bff9f584dee80387e416ca766e Mon Sep 17 00:00:00 2001 From: mamadoudicko Date: Thu, 31 Aug 2023 16:13:43 +0200 Subject: [PATCH] fix(openAiKey): handle nullish values --- .../components/SettingsTab/hooks/useSettingsTab.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/useSettingsTab.ts b/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/useSettingsTab.ts index dd9381a099b5..59d7a6bc3dae 100644 --- a/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/useSettingsTab.ts +++ b/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/useSettingsTab.ts @@ -80,11 +80,8 @@ export const useSettingsTab = ({ brainId }: UseSettingsTabProps) => { continue; } - if ( - brainKey === "openai_api_key" && - brain["openai_api_key"] !== undefined - ) { - setValue("openAiKey", brain["openai_api_key"]); + if (brainKey === "openai_api_key") { + setValue("openAiKey", brain["openai_api_key"] ?? ""); continue; } @@ -333,7 +330,7 @@ export const useSettingsTab = ({ brainId }: UseSettingsTabProps) => { return { handleSubmit, register, - openAiKey: openAiKey === "" ? undefined : openAiKey, + openAiKey, model, temperature, maxTokens,