fix: Capture shows for models without Vision (#32969)

"Capture" in the "+" menu showed when no selected model supports images, and after picking a screen the user only got "Selected model(s) do not support image inputs". It now shows only when at least one selected model has "Vision", which is also what attaching an image requires.

Refs #32830
This commit is contained in:
Classic298 2026-10-23 03:44:51 +02:00 • committed by GitHub
parent 2ea6bf4369
commit 9e5a355fd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 32 deletions

View file

@ -2358,6 +2358,7 @@
)
? selectedModelIds
: fileUploadCapableModels}
{visionCapableModels}
{toolApprovalMode}
{onToolApprovalModeChange}
{screenCaptureHandler}

View file

@ -34,6 +34,7 @@
export let selectedModels: string[] = [];
export let fileUploadCapableModels: string[] = [];
export let visionCapableModels: string[] = [];
export let screenCaptureHandler: Function;
export let uploadFilesHandler: Function;
@ -213,39 +214,41 @@
</button>
</Tooltip>
<Tooltip
content={fileUploadCapableModels.length !== selectedModels.length
? $i18n.t('Model(s) do not support file upload')
: !fileUploadEnabled
? $i18n.t('You do not have permission to upload files.')
: ''}
className="w-full"
>
<button
role="menuitem"
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal select-none cursor-pointer hover:bg-gray-50/40 dark:hover:bg-gray-800/40 rounded-xl text-left {!fileUploadEnabled
? 'opacity-50'
: ''}"
type="button"
on:click={() => {
if (fileUploadEnabled) {
if (!detectMobile()) {
screenCaptureHandler();
} else {
const cameraInputElement = document.getElementById('camera-input');
if (cameraInputElement) {
cameraInputElement.click();
}
}
show = false;
}
}}
{#if visionCapableModels.length > 0}
<Tooltip
content={fileUploadCapableModels.length !== selectedModels.length
? $i18n.t('Model(s) do not support file upload')
: !fileUploadEnabled
? $i18n.t('You do not have permission to upload files.')
: ''}
className="w-full"
>
<Camera />
<div class=" line-clamp-1">{$i18n.t('Capture')}</div>
</button>
</Tooltip>
<button
role="menuitem"
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal select-none cursor-pointer hover:bg-gray-50/40 dark:hover:bg-gray-800/40 rounded-xl text-left {!fileUploadEnabled
? 'opacity-50'
: ''}"
type="button"
on:click={() => {
if (fileUploadEnabled) {
if (!detectMobile()) {
screenCaptureHandler();
} else {
const cameraInputElement = document.getElementById('camera-input');
if (cameraInputElement) {
cameraInputElement.click();
}
}
show = false;
}
}}
>
<Camera />
<div class=" line-clamp-1">{$i18n.t('Capture')}</div>
</button>
</Tooltip>
{/if}
<button
role="menuitem"