🐛 fix possible undefined
This commit is contained in:
parent
281079aaa1
commit
2e248b9389
2 changed files with 4 additions and 2 deletions
|
|
@ -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"}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue