Adjust behavior when display_model_names is null

This commit is contained in:
Weves
2025-02-18 16:14:49 -08:00
committed by Chris Weaver
parent 466276161c
commit 2013beb9e0

View File

@@ -5,7 +5,7 @@ import {
PopoverTrigger, PopoverTrigger,
} from "@/components/ui/popover"; } from "@/components/ui/popover";
import { ChatInputOption } from "./ChatInputOption"; import { ChatInputOption } from "./ChatInputOption";
import { defaultModelsByProvider, getDisplayNameForModel } from "@/lib/hooks"; import { getDisplayNameForModel } from "@/lib/hooks";
import { import {
checkLLMSupportsImageInput, checkLLMSupportsImageInput,
destructureValue, destructureValue,
@@ -61,23 +61,22 @@ export default function LLMPopover({
llmOptionsByProvider[llmProvider.provider] = []; llmOptionsByProvider[llmProvider.provider] = [];
} }
( (llmProvider.display_model_names || llmProvider.model_names).forEach(
llmProvider.display_model_names || (modelName) => {
defaultModelsByProvider[llmProvider.provider] if (!uniqueModelNames.has(modelName)) {
).forEach((modelName) => { uniqueModelNames.add(modelName);
if (!uniqueModelNames.has(modelName)) { llmOptionsByProvider[llmProvider.provider].push({
uniqueModelNames.add(modelName); name: modelName,
llmOptionsByProvider[llmProvider.provider].push({ value: structureValue(
name: modelName, llmProvider.name,
value: structureValue( llmProvider.provider,
llmProvider.name, modelName
llmProvider.provider, ),
modelName icon: getProviderIcon(llmProvider.provider, modelName),
), });
icon: getProviderIcon(llmProvider.provider, modelName), }
});
} }
}); );
}); });
const llmOptions = Object.entries(llmOptionsByProvider).flatMap( const llmOptions = Object.entries(llmOptionsByProvider).flatMap(