🐛 fix possible undefined

This commit is contained in:
Nate Sesti 2023-11-29 18:59:28 -08:00
parent 281079aaa1
commit 2e248b9389
2 changed files with 4 additions and 2 deletions

View file

@ -232,7 +232,7 @@ function ModelSelect(props: {}) {
<StyledListbox
value={"GPT-4"}
onChange={(val: string) => {
if (val === defaultModel.title) return;
if (val === defaultModel?.title) return;
client?.setModelForRoleFromTitle("*", val);
}}
defaultValue={"GPT-4"}

View file

@ -14,5 +14,7 @@ export const contextLengthSelector = (state: RootStore) => {
export const defaultModelSelector = (state: RootStore) => {
const title = state.serverState.config.model_roles?.default;
return state.serverState.config.models.find((model) => model.title === title);
return state.serverState.config.models?.find(
(model) => model.title === title
);
};