fix(openAiKey): handle nullish values (#1080)

This commit is contained in:
Mamadou DICKO 2023-08-31 16:28:26 +02:00 committed by GitHub
parent aaf841136c
commit 47b8d697c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,