Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Show model vision capability in WebGPU settings

Barack Sokullu545a0ab13210
diff --git a/src/chrome/src/ui/settings.js b/src/chrome/src/ui/settings.js
index edf8787b5..1b28c8fd4 100644
--- a/src/chrome/src/ui/settings.js
+++ b/src/chrome/src/ui/settings.js
@@ -78,6 +78,7 @@ import {
WEBGPU_VISION_CONSENT_VERSION_KEY,
WEBGPU_VISION_ENABLED_KEY,
normalizeWebgpuModelId,
+ webgpuModelSupportsVision,
} from '../providers/webgpu.js';
import { AUTO_GROUP_TABS_KEY } from '../tab-group-preference.js';
@@ -2977,6 +2978,11 @@ function renderWebgpuDownloadControl(id, state) {
}
}
+function refreshWebgpuVisionCheckbox(model) {
+ const checkbox = document.querySelector('input[data-provider="webgpu"][data-key="supportsVision"]');
+ if (checkbox) checkbox.checked = webgpuModelSupportsVision(model);
+}
+
function getDisplayedWebgpuModel(id = 'webgpu') {
const input = document.querySelector(`input[data-provider="${id}"][data-key="model"]`);
try {
@@ -3295,6 +3301,8 @@ function renderProviders() {
])),
},
WEBGPU_CONTEXT_WINDOW_FIELD,
+ // Vision support is fixed by the selected WebGPU model's graph files.
+ { key: 'supportsVision', labelKey: 'st.provider.field.supports_vision', type: 'checkbox', disabled: true },
PROMPT_TIER_FIELD,
],
},
@@ -3629,13 +3637,15 @@ function renderProviders() {
fieldHTML += `<div class="field-hint" ${statusAttribute}${current === 'auto' ? '' : ' hidden'} style="margin:-4px 0 10px;font-size:12px;color:var(--text2);">${escapeHtml(t(visionStatusKey(id, config)))}</div>`;
}
} else if (field.type === 'checkbox') {
- const isChecked = !!config[field.key];
+ const isChecked = definitionId === 'webgpu' && field.key === 'supportsVision'
+ ? webgpuModelSupportsVision(config.model)
+ : !!config[field.key];
const checked = isChecked ? 'checked' : '';
fieldHTML += `
<div class="field" style="display:flex;align-items:center;gap:8px;flex-direction:row;">
- <input type="checkbox" data-provider="${id}" data-key="${field.key}" data-type="checkbox" ${checked}
- style="width:auto;cursor:pointer;">
- <label style="margin:0;cursor:pointer;">${escapeHtml(label)}</label>
+ <input type="checkbox" id="provider-${id}-${field.key}" data-provider="${id}" data-key="${field.key}" data-type="checkbox" ${checked} ${field.disabled ? 'disabled' : ''}
+ style="width:auto;cursor:${field.disabled ? 'default' : 'pointer'};">
+ <label for="provider-${id}-${field.key}" style="margin:0;cursor:${field.disabled ? 'default' : 'pointer'};">${escapeHtml(label)}</label>
</div>
`;
if (field.hintKey) {
@@ -3870,7 +3880,10 @@ function renderProviders() {
markProviderDirty(providerId);
refreshProviderCompatibilitySummary(providerId);
refreshVisionStatus(providerId);
- if (providerId === 'webgpu') refreshWebgpuDownloadControls();
+ if (providerId === 'webgpu') {
+ refreshWebgpuVisionCheckbox(input.value);
+ refreshWebgpuDownloadControls();
+ }
});
});
document.querySelectorAll('select[data-key="visionMode"]').forEach((select) => {
@@ -3893,7 +3906,10 @@ function renderProviders() {
refreshProviderCompatibilitySummary(input.dataset.provider);
refreshVisionStatus(input.dataset.provider);
if (providerDefinitionId(input.dataset.provider) === 'ollama') refreshVisionStatus(input.dataset.provider);
- if (input.dataset.provider === 'webgpu' && input.dataset.key === 'model') refreshWebgpuDownloadControls();
+ if (input.dataset.provider === 'webgpu' && input.dataset.key === 'model') {
+ refreshWebgpuVisionCheckbox(input.value);
+ refreshWebgpuDownloadControls();
+ }
});
});
document.querySelectorAll('.btn-reset-compatibility').forEach((button) => {