Skip to content

Commit

Permalink
Fix disabled OpenAI models Niek#243
Browse files Browse the repository at this point in the history
  • Loading branch information
Webifi committed Jul 26, 2023
1 parent 58afe8f commit f223f4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/Models.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ export async function getModelOptions (): Promise<SelectOption[]> {
// }
// })
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)
Expand All @@ -283,7 +288,7 @@ export async function getModelOptions (): Promise<SelectOption[]> {
break
case 'OpenAIChat':
default:
disabled = !(openAiModels.data && openAiModels.data.find((m) => m.id === m))
disabled = !(openAiModelsLookup[m])
}
const o:SelectOption = {
value: m,
Expand All @@ -296,6 +301,8 @@ export async function getModelOptions (): Promise<SelectOption[]> {
if (allowCache) modelOptionCache.set(modelOptions)
// console.log('openAiModels', openAiModels, openAiModelsLookup)
return modelOptions
}
Expand Down

0 comments on commit f223f4e

Please sign in to comment.