-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(daemon): expose visionModelId in workspace provider status and web-shell model dialog #6262
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
c4c8116
e053581
d0af634
71101ba
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 |
|---|---|---|
|
|
@@ -380,6 +380,33 @@ describe('createWorkspaceProvidersStatusProvider', () => { | |
| expect(withEmptyFastModel.current).not.toHaveProperty('fastModelId'); | ||
| }); | ||
|
|
||
| it('includes only non-empty vision model settings in current selection', async () => { | ||
| const provider = createWorkspaceProvidersStatusProvider({ env: {} }); | ||
| await writeUserSettings({ | ||
| security: { auth: { selectedType: 'openai' } }, | ||
| model: { name: 'main-model' }, | ||
| visionModel: 'vision-model', | ||
|
Collaborator
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. [Suggestion] Test uses a plain string — qwen3.7-max via Qwen Code /review |
||
| modelProviders: { | ||
| openai: [{ id: 'main-model', name: 'Main Model' }], | ||
| }, | ||
| }); | ||
|
|
||
| const withVisionModel = await provider(workspace, false); | ||
| expect(withVisionModel.current?.visionModelId).toBe('vision-model'); | ||
|
|
||
| await writeUserSettings({ | ||
| security: { auth: { selectedType: 'openai' } }, | ||
| model: { name: 'main-model' }, | ||
| visionModel: '', | ||
| modelProviders: { | ||
| openai: [{ id: 'main-model', name: 'Main Model' }], | ||
| }, | ||
| }); | ||
|
|
||
| const withEmptyVisionModel = await provider(workspace, false); | ||
| expect(withEmptyVisionModel.current).not.toHaveProperty('visionModelId'); | ||
| }); | ||
|
|
||
| it('does not include runtime models in the workspace provider catalog', async () => { | ||
| const provider = createWorkspaceProvidersStatusProvider({ | ||
| argv: { model: 'runtime-only-model' }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -102,6 +102,11 @@ function buildWorkspaceProvidersStatus( | |||||||||||||||
| typeof settings.fastModel === 'string' && settings.fastModel.length > 0 | ||||||||||||||||
| ? settings.fastModel | ||||||||||||||||
| : undefined; | ||||||||||||||||
| const visionModelId = | ||||||||||||||||
|
Collaborator
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. [Critical] Raw Contrast with Impact: Internal endpoint URLs leak to status API consumers;
Suggested change
— qwen3.7-max via Qwen Code /review |
||||||||||||||||
| typeof settings.visionModel === 'string' && | ||||||||||||||||
| settings.visionModel.length > 0 | ||||||||||||||||
| ? settings.visionModel | ||||||||||||||||
| : undefined; | ||||||||||||||||
| const approvalMode = resolveApprovalMode(settings); | ||||||||||||||||
| const providers = new Map<string, ServeWorkspaceProviderStatus>(); | ||||||||||||||||
| const explicitModelBaseUrls = buildExplicitModelBaseUrls( | ||||||||||||||||
|
|
@@ -167,6 +172,7 @@ function buildWorkspaceProvidersStatus( | |||||||||||||||
| currentAcpModelId, | ||||||||||||||||
| currentBaseUrl, | ||||||||||||||||
| fastModelId, | ||||||||||||||||
| visionModelId, | ||||||||||||||||
| ); | ||||||||||||||||
|
|
||||||||||||||||
| return { | ||||||||||||||||
|
|
@@ -391,12 +397,15 @@ function buildCurrent( | |||||||||||||||
| modelId: string | undefined, | ||||||||||||||||
| baseUrl: string | undefined, | ||||||||||||||||
| fastModelId: string | undefined, | ||||||||||||||||
| visionModelId: string | undefined, | ||||||||||||||||
| ): ServeWorkspaceProviderCurrent | undefined { | ||||||||||||||||
| if (!authType && !modelId && !baseUrl && !fastModelId) return undefined; | ||||||||||||||||
| if (!authType && !modelId && !baseUrl && !fastModelId && !visionModelId) | ||||||||||||||||
| return undefined; | ||||||||||||||||
| return { | ||||||||||||||||
| ...(authType ? { authType: String(authType) } : {}), | ||||||||||||||||
| ...(modelId ? { modelId } : {}), | ||||||||||||||||
| ...(baseUrl ? { baseUrl: sanitizeProviderBaseUrl(baseUrl) } : {}), | ||||||||||||||||
| ...(fastModelId ? { fastModelId } : {}), | ||||||||||||||||
| ...(visionModelId ? { visionModelId } : {}), | ||||||||||||||||
| }; | ||||||||||||||||
| } | ||||||||||||||||
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.
[Suggestion] The new test always sets
authType: 'openai'andmodel.name: 'main-model', sobuildCurrentalways has truthyauthTypeandmodelId. The guard clause change (!visionModelIdadded to the early-return check) is never exercised — no test verifies thatvisionModelIdalone (all other fields falsy) produces a definedcurrentobject. Consider adding a test case where onlyvisionModelis configured.— qwen3.7-max via Qwen Code /review