-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: improve VS Code LM API model name display #8444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,7 +154,7 @@ export interface ExtensionMessage { | |
| openAiModels?: string[] | ||
| ollamaModels?: ModelRecord | ||
| lmStudioModels?: ModelRecord | ||
| vsCodeLmModels?: { vendor?: string; family?: string; version?: string; id?: string }[] | ||
| vsCodeLmModels?: { vendor?: string; family?: string; version?: string; id?: string; name?: string }[] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Reuse the exported LanguageModelChatSelector to avoid duplicate shapes and drift.\n\n |
||
| huggingFaceModels?: Array<{ | ||
| id: string | ||
| object: string | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| import { useState, useCallback } from "react" | ||
| import { useEvent } from "react-use" | ||
| import { LanguageModelChatSelector } from "vscode" | ||
|
|
||
| import type { ProviderSettings } from "@roo-code/types" | ||
|
|
||
| import { ExtensionMessage } from "@roo/ExtensionMessage" | ||
| import { ExtensionMessage, LanguageModelChatSelector } from "@roo/ExtensionMessage" | ||
|
|
||
| import { useAppTranslation } from "@src/i18n/TranslationContext" | ||
| import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@src/components/ui" | ||
|
|
@@ -19,7 +18,7 @@ type VSCodeLMProps = { | |
| export const VSCodeLM = ({ apiConfiguration, setApiConfigurationField }: VSCodeLMProps) => { | ||
| const { t } = useAppTranslation() | ||
|
|
||
| const [vsCodeLmModels, setVsCodeLmModels] = useState<LanguageModelChatSelector[]>([]) | ||
| const [vsCodeLmModels, setVsCodeLmModels] = useState<Array<LanguageModelChatSelector & { name?: string }>>([]) | ||
|
|
||
| const handleInputChange = useCallback( | ||
| <K extends keyof ProviderSettings, E>( | ||
|
|
@@ -66,13 +65,23 @@ export const VSCodeLM = ({ apiConfiguration, setApiConfigurationField }: VSCodeL | |
| <SelectValue placeholder={t("settings:common.select")} /> | ||
| </SelectTrigger> | ||
| <SelectContent> | ||
| {vsCodeLmModels.map((model) => ( | ||
| <SelectItem | ||
| key={`${model.vendor}/${model.family}`} | ||
| value={`${model.vendor}/${model.family}`}> | ||
| {`${model.vendor} - ${model.family}`} | ||
| </SelectItem> | ||
| ))} | ||
| {vsCodeLmModels.map((model) => { | ||
| // Create a more user-friendly display name | ||
| // Use the model's name property if available, otherwise fall back to vendor/family | ||
| const displayName = | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Optional: disambiguate human-friendly names by appending version when present, e.g., "name (version)" to distinguish similarly named models. |
||
| model.name || | ||
| (model.vendor && model.family | ||
| ? `${model.vendor} - ${model.family}` | ||
| : model.id || "Unknown Model") | ||
|
|
||
| return ( | ||
| <SelectItem | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Selection key/value rely on vendor/family even when displayName may fall back to id. If a model lacks vendor/family, the selector value becomes "undefined/undefined" and breaks parsing. Recommend using model.id as the primary key/value when available and adjusting onValueChange to resolve vendor/family by lookup when given an id. |
||
| key={`${model.vendor}/${model.family}`} | ||
| value={`${model.vendor}/${model.family}`}> | ||
| {displayName} | ||
| </SelectItem> | ||
| ) | ||
| })} | ||
| </SelectContent> | ||
| </Select> | ||
| ) : ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P3] Preserve future selector fields via spread to reduce maintenance.\n\n
suggestion\n const mappedModels = vsCodeLmModels.map((model) => ({ ...model, name: model.name }))\n