Fix pricing category possibly crashing model picker (#328263)

This commit is contained in:
Logan Ramos
2026-07-30 19:37:58 +00:00
committed by GitHub
parent 609a4f1fb2
commit d81b554dff
@@ -15,10 +15,11 @@ export function isMultiplierPricing(model: ILanguageModelChatMetadataAndIdentifi
}
export function getPriceCategoryLabel(priceCategory: string | undefined): string | undefined {
// The value originates from extension provided metadata, so it may not be a string at runtime
if (typeof priceCategory !== 'string' || priceCategory.length === 0) {
return undefined;
}
switch (priceCategory) {
case undefined:
case '':
return undefined;
case 'low':
return localize('chat.priceCategory.low', "Low cost");
case 'medium':