Merge pull request #24 from ollama-webui/dev

fix: make sure settings model exists
This commit is contained in:
Timothy Jaeryang Baek 2023-10-23 00:33:12 -05:00 committed by GitHub
commit 5ec20c1a32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,7 +39,10 @@
settings = JSON.parse(settings); settings = JSON.parse(settings);
console.log(settings); console.log(settings);
selectedModel = settings.model ?? ''; selectedModel =
settings.model && models.map((model) => model.name).includes(settings.model)
? settings.model
: '';
system = settings.system ?? null; system = settings.system ?? null;
temperature = settings.temperature ?? null; temperature = settings.temperature ?? null;
} }
@ -233,8 +236,8 @@
return { models: [] }; return { models: [] };
}); });
const data = res; console.log(res);
models = data.models; models = res.models ?? [];
}; };
const submitPrompt = async (user_prompt) => { const submitPrompt = async (user_prompt) => {