fix: speech store loadSettings uses raw fetchApi causing persistent error popup#1393
Closed
gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
Closed
fix: speech store loadSettings uses raw fetchApi causing persistent error popup#1393gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
Conversation
…ings load error The speech store used raw fetchApi() to load settings which lacks proper CSRF token handling and response validation. When the server returns a non-JSON response (e.g. HTML redirect to /login), response.json() fails and shows a persistent "Failed to load speech settings" error popup. This aligns the speech store with the main settings store pattern which already uses API.callJsonApi() with proper error handling.
Contributor
Author
|
Closing this PR to resubmit cleanly from a synced fork (v1.7). The fork was 578 commits behind upstream. Will resubmit with a fresh branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Summary
The speech store (
webui/components/chat/speech/speech-store.js) shows a persistent "Failed to load speech settings" error popup when the app loads. This happens becauseloadSettings()uses the rawfetchApi()function to call/settings_get, which lacks proper CSRF token handling and response validation.Root Cause
The speech store calls the settings API like this:
When the server returns a non-JSON response (e.g. an HTML redirect to
/loginduring session initialization),response.json()throws a SyntaxError on the HTML content. This triggers the catch block which calls:The result is a visible, confusing error popup that appears every time the app loads under certain conditions.
The Fix
The main settings store (
webui/components/settings/settings-store.js) already handles this correctly using the proper API wrapper:The
API.callJsonApi()wrapper (defined inwebui/js/api.js) properly handles:okcheckingThis PR aligns the speech store with the established pattern.
Changes
File:
webui/components/chat/speech/speech-store.js1. Add API module import
+import * as API from "/js/api.js";2. Replace raw fetchApi with API.callJsonApi in loadSettings()
3. Downgrade error handling (speech settings have sensible defaults)
Why This Is Safe
API.callJsonApi()for the same endpointTesting
Stats