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