diff --git a/src/lib/Models.svelte b/src/lib/Models.svelte index 80192593..a1c25a82 100644 --- a/src/lib/Models.svelte +++ b/src/lib/Models.svelte @@ -274,6 +274,11 @@ export async function getModelOptions (): Promise { // } // }) + const openAiModelsLookup = openAiModels.data.reduce((a, v) => { + a[v.id] = v + return a + }, {}) + const modelOptions:SelectOption[] = Object.keys(supportedModels).reduce((a, m) => { let disabled const modelDetail = getModelDetail(m) @@ -283,7 +288,7 @@ export async function getModelOptions (): Promise { break case 'OpenAIChat': default: - disabled = !(openAiModels.data && openAiModels.data.find((m) => m.id === m)) + disabled = !(openAiModelsLookup[m]) } const o:SelectOption = { value: m, @@ -296,6 +301,8 @@ export async function getModelOptions (): Promise { if (allowCache) modelOptionCache.set(modelOptions) + // console.log('openAiModels', openAiModels, openAiModelsLookup) + return modelOptions }