-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: resolve VS Code LM API model selection issue #8992
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
Conversation
- Updated UI to use model.id instead of vendor/family for model selection - Modified VsCodeLmHandler to select models by ID when available - Added proper error handling for model approval failures - Improved error messages for better user experience - Added test coverage for ID-based model selection Fixes #8991
|
Review completed. Found 1 issue that should be addressed.
Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request. |
| console.warn( | ||
| `Roo Code <Language Model API>: Model with ID '${selector.id}' not found, falling back to selector`, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| // Fallback to selector-based selection | ||
| const models = await vscode.lm.selectChatModels(selector) |
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.
The fallback logic here doesn't work as intended. When a model with the specified ID is not found in allModels, the code attempts to fall back by calling selectChatModels(selector), but selector still contains the unfound ID. This means the fallback will return an empty array (since we already confirmed the ID doesn't exist), making the fallback ineffective. To fix this, create a new selector without the ID for the fallback: const { id, ...fallbackSelector } = selector and then use selectChatModels(fallbackSelector) to search by vendor/family only.
This PR attempts to address Issue #8991. Feedback and guidance are welcome.
Problem
All models in VS Code LM API return a 400 error "Model is not supported for this request" when users try to use them.
Root Cause
The VS Code Language Model API requires exact model IDs for selection, but the implementation was using vendor/family pairs instead.
Solution
Changes
Testing
Fixes #8991
Important
Fixes VS Code LM API model selection by using model IDs, updates UI and error handling, and adds tests.
VsCodeLmHandlerby usingmodel.idinstead of vendor/family pairs.vscode-lm.ts.VSCodeLM.tsxto usemodel.idas value.vscode-lm.spec.ts.getVsCodeLmModelsto filter and map models correctly invscode-lm.ts.This description was created by
for 2da41b4. You can customize this summary. It will automatically update as commits are pushed.