fix(webui): explain HTTPS requirement for voice input (#5304)

This commit is contained in:
chengyongru
2026-08-09 21:17:57 +08:00
committed by GitHub
parent af52fbcbc4
commit 411d6061ae
14 changed files with 70 additions and 1 deletions
+5
View File
@@ -28,6 +28,7 @@ const VOICE_MIME_CANDIDATES = [
export type VoiceRecorderState = "idle" | "recording" | "transcribing";
export type VoiceRecorderErrorKey =
| "failed"
| "insecureContext"
| "noDevice"
| "notConfigured"
| "permission"
@@ -163,6 +164,10 @@ export function useVoiceRecorder({
const startRecording = useCallback(async () => {
if (!onTranscribeAudio || state !== "idle" || startPendingRef.current) return;
onClearError();
if (window.isSecureContext === false) {
onError("insecureContext");
return;
}
const mediaDevices = navigator.mediaDevices;
const MediaRecorderCtor = mediaRecorderConstructor();
if (!mediaDevices?.getUserMedia || !MediaRecorderCtor) {