mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[PR #21816] [CLOSED] fix: detect WebGPU availability via requestAdapter() and surface Kokoro.js load errors in UI #65148
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21816
Author: @silentoplayz
Created: 2/24/2026
Status: ❌ Closed
Base:
dev← Head:fix/kokoro-webgpu-detection📝 Commits (2)
217d2b9fix(audio): detect WebGPU availability via requestAdapter() and surface Kokoro.js load errors in UIceb8c0efix(audio): correct Kokoro.js WebGPU toast — WASM fallback works fine📊 Changes
1 file changed (+46 additions, -12 deletions)
View changed files
📝
src/lib/components/chat/Settings/Audio.svelte(+46 -12)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. PRs targetingmainwill be immediately closed.devto ensure no unrelated commits (e.g. frommain) are included. Push updates to the existing PR branch instead of closing and reopening.fix(audio): detect WebGPU availability via requestAdapter() and surface Kokoro.js load errors in UIChangelog Entry
Description
Selecting Kokoro.js (Browser) as the Text-to-Speech engine in the Audio settings had two silent failure modes:
False-positive WebGPU detection — The code checked
!!navigator?.gputo decide whether to use'webgpu'as the inference device. In Firefox and other browsers with partial WebGPU support,navigator.gpucan exist butrequestAdapter()returnsnull. Kokoro.js then throws"no available backend found. ERR: [webgpu] Error: Failed to get GPU adapter"with no feedback to the user.Stuck loading state — If
KokoroTTS.from_pretrainedthrew for any reason,TTSModelLoadingwas never reset and the loading spinner stayed visible indefinitely with no error message shown.Reproduction (before this fix):
Uncaught (in promise) Error: no available backend foundwith no toast or UI updateAdded
isWebGPUAvailable()— async helper that callsnavigator.gpu.requestAdapter()and returnsfalseif the adapter isnullor the call throws. Used to reliably distinguish browsers where WebGPU is present but non-functional.Changed
onTTSEngineChange: when Kokoro.js is selected,isWebGPUAvailable()is now awaited beforeloadKokoro(). If it returnsfalse, atoast.warningfires immediately advising the user to enable WebGPU or switch to a Chromium-based browser.loadKokoro: device selection now uses the result ofisWebGPUAvailable()instead of!!navigator?.gpu.loadKokoro:KokoroTTS.from_pretrainedis now wrapped in try/catch. On failure:TTSModel,TTSModelProgress, andTTSModelLoadingare all reset and atoast.errorshows the error message.{:else if TTSModelLoading}(template): the loading spinner branch now only renders whenTTSModelLoadingistrue. Previously the{:else}branch would render the spinner wheneverTTSModelwasnull, including after a failed load.Fixed
Additional Information
navigator.gpuTypeScript type error is a pre-existing issue in the codebase (WebGPU types are not included in the project'slib.dom.d.ts). It does not affect runtime behaviour.Screenshots or Videos
Before: silent spinner.
After: immediate
toast.warningon engine selection,toast.errorwith the thrown message if load fails regardless of browser.)*Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.