mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-22 21:50:16 +09:00
fix: #236
This commit is contained in:
parent
70690f64c5
commit
bd1a8dcc3a
@ -68,6 +68,7 @@ import {
|
||||
getMessageImages,
|
||||
isVisionModel,
|
||||
compressImage,
|
||||
isFirefox,
|
||||
} from "../utils";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
@ -92,6 +93,7 @@ import { useNavigate } from "react-router-dom";
|
||||
import {
|
||||
CHAT_PAGE_SIZE,
|
||||
DEFAULT_STT_ENGINE,
|
||||
FIREFOX_DEFAULT_STT_ENGINE,
|
||||
LAST_INPUT_KEY,
|
||||
ModelProvider,
|
||||
Path,
|
||||
@ -903,6 +905,7 @@ function _Chat() {
|
||||
}
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
if (isFirefox()) config.sttConfig.engine = FIREFOX_DEFAULT_STT_ENGINE;
|
||||
setSpeechApi(
|
||||
config.sttConfig.engine === DEFAULT_STT_ENGINE
|
||||
? new WebTranscriptionApi((transcription) =>
|
||||
|
@ -3,6 +3,7 @@ import { STTConfig, STTConfigValidator } from "../store";
|
||||
import Locale from "../locales";
|
||||
import { ListItem, Select } from "./ui-lib";
|
||||
import { DEFAULT_STT_ENGINES } from "../constant";
|
||||
import { isFirefox } from "../utils";
|
||||
|
||||
export function STTConfigList(props: {
|
||||
sttConfig: STTConfig;
|
||||
@ -24,6 +25,7 @@ export function STTConfigList(props: {
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
{!isFirefox() && (
|
||||
<ListItem title={Locale.Settings.STT.Engine.Title}>
|
||||
<Select
|
||||
value={props.sttConfig.engine}
|
||||
@ -43,6 +45,7 @@ export function STTConfigList(props: {
|
||||
))}
|
||||
</Select>
|
||||
</ListItem>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -136,6 +136,7 @@ export const DEFAULT_TTS_VOICES = [
|
||||
|
||||
export const DEFAULT_STT_ENGINE = "WebAPI";
|
||||
export const DEFAULT_STT_ENGINES = ["WebAPI", "OpenAI Whisper"];
|
||||
export const FIREFOX_DEFAULT_STT_ENGINE = "OpenAI Whisper";
|
||||
|
||||
export const DEFAULT_MODELS = [
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { ChatGPTApi } from "../client/platforms/openai";
|
||||
import { getSTTLang } from "../locales";
|
||||
import { isFirefox } from "../utils";
|
||||
|
||||
export type TranscriptionCallback = (transcription: string) => void;
|
||||
|
||||
@ -94,6 +95,7 @@ export class WebTranscriptionApi extends SpeechApi {
|
||||
|
||||
constructor(transcriptionCallback?: TranscriptionCallback) {
|
||||
super();
|
||||
if (isFirefox()) return;
|
||||
const SpeechRecognition =
|
||||
(window as any).SpeechRecognition ||
|
||||
(window as any).webkitSpeechRecognition;
|
||||
|
Loading…
Reference in New Issue
Block a user