feat(open-webui): tag chats per user, harden error/voice states, add tests
- persistence: tag created/updated Open WebUI chats with a homarr-user:<id> tag (via chat meta.tags) so conversations can be found back per Homarr user even when an integration/account is shared - voice recording: distinguish a denied/dismissed microphone permission from a generic mic failure and show an actionable message - widget: surface the models query loading and connection-error states in the chat empty state instead of silently showing 'no models' - tests: cover the final-SSE-frame flush, the default request timeout (and the streaming opt-out), and multimodal chat parsing round-trip
This commit is contained in:
6 files changed
+122
-8
No files matched your search
@@ -9,6 +9,7 @@ interface UseVoiceRecordingOptions {
|
||||
onError: (message: string) => void;
|
||||
onTranscribed: (text: string) => void;
|
||||
micErrorMessage: string;
|
||||
micPermissionErrorMessage: string;
|
||||
transcribeErrorMessage: string;
|
||||
}
|
||||
|
||||
@@ -22,6 +23,7 @@ export function useVoiceRecording({
|
||||
onError,
|
||||
onTranscribed,
|
||||
micErrorMessage,
|
||||
micPermissionErrorMessage,
|
||||
transcribeErrorMessage,
|
||||
}: UseVoiceRecordingOptions) {
|
||||
const [isRecording, setIsRecording] = useState(false);
|
||||
@@ -106,14 +108,18 @@ export function useVoiceRecording({
|
||||
setRecordingSeconds(0);
|
||||
recordingTimerRef.current = window.setInterval(() => setRecordingSeconds((value) => value + 1), 1000);
|
||||
setIsRecording(true);
|
||||
} catch {
|
||||
} catch (error) {
|
||||
// getUserMedia may have succeeded before AudioContext/MediaRecorder setup
|
||||
// threw; release the mic stream and context so it isn't left running.
|
||||
releaseAudioResources();
|
||||
mediaRecorderRef.current = null;
|
||||
setAnalyser(null);
|
||||
setIsRecording(false);
|
||||
onError(micErrorMessage);
|
||||
// Distinguish a denied/dismissed permission prompt from other mic failures
|
||||
// so the user gets an actionable message.
|
||||
const denied =
|
||||
error instanceof DOMException && (error.name === "NotAllowedError" || error.name === "SecurityError");
|
||||
onError(denied ? micPermissionErrorMessage : micErrorMessage);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user