feat(settings): fetch localStorage at state change
This commit is contained in:
parent
9b088cd161
commit
f28257b480
|
@ -53,6 +53,14 @@ const SettingsDialog = ({
|
||||||
});
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setConfig(data);
|
setConfig(data);
|
||||||
|
setSelectedChatModelProvider(localStorage.getItem('chatModelProvider'));
|
||||||
|
setSelectedChatModel(localStorage.getItem('chatModel'));
|
||||||
|
setSelectedEmbeddingModelProvider(
|
||||||
|
localStorage.getItem('embeddingModelProvider'),
|
||||||
|
);
|
||||||
|
setSelectedEmbeddingModel(localStorage.getItem('embeddingModel'));
|
||||||
|
setCustomOpenAIApiKey(localStorage.getItem('openAIApiKey'));
|
||||||
|
setCustomOpenAIBaseURL(localStorage.getItem('openAIBaseUrl'));
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,17 +69,6 @@ const SettingsDialog = ({
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [isOpen]);
|
}, [isOpen]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setSelectedChatModelProvider(localStorage.getItem('chatModelProvider'));
|
|
||||||
setSelectedChatModel(localStorage.getItem('chatModel'));
|
|
||||||
setSelectedEmbeddingModelProvider(
|
|
||||||
localStorage.getItem('embeddingModelProvider'),
|
|
||||||
);
|
|
||||||
setSelectedEmbeddingModel(localStorage.getItem('embeddingModel'));
|
|
||||||
setCustomOpenAIApiKey(localStorage.getItem('openAIApiKey'));
|
|
||||||
setCustomOpenAIBaseURL(localStorage.getItem('openAIBaseUrl'));
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
setIsUpdating(true);
|
setIsUpdating(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue