feat: support edge tts

This commit is contained in:
Hk-Gosuto
2024-05-27 21:25:25 +08:00
parent b1e91ca5cd
commit e759631ba3
14 changed files with 537 additions and 56 deletions

View File

@@ -51,6 +51,9 @@ const DEFAULT_ACCESS_STATE = {
customModels: "",
isEnableRAG: false,
defaultModel: "",
// tts config
edgeTTSVoiceName: "zh-CN-YunxiNeural",
};
export const useAccessStore = createPersistStore(
@@ -63,6 +66,12 @@ export const useAccessStore = createPersistStore(
return get().needCode;
},
edgeVoiceName() {
this.fetch();
return get().edgeTTSVoiceName;
},
enableRAG() {
this.fetch();

View File

@@ -6,6 +6,8 @@ import {
DEFAULT_SIDEBAR_WIDTH,
DEFAULT_STT_ENGINE,
DEFAULT_STT_ENGINES,
DEFAULT_TTS_ENGINE,
DEFAULT_TTS_ENGINES,
DEFAULT_TTS_MODEL,
DEFAULT_TTS_MODELS,
DEFAULT_TTS_VOICE,
@@ -17,6 +19,7 @@ import { createPersistStore } from "../utils/store";
export type ModelType = (typeof DEFAULT_MODELS)[number]["name"];
export type TTSModelType = (typeof DEFAULT_TTS_MODELS)[number];
export type TTSVoiceType = (typeof DEFAULT_TTS_VOICES)[number];
export type TTSEngineType = (typeof DEFAULT_TTS_ENGINES)[number];
export type STTEngineType = (typeof DEFAULT_STT_ENGINES)[number];
@@ -79,6 +82,7 @@ export const DEFAULT_CONFIG = {
ttsConfig: {
enable: false,
autoplay: false,
engine: DEFAULT_TTS_ENGINE,
model: DEFAULT_TTS_MODEL,
voice: DEFAULT_TTS_VOICE,
speed: 1.0,
@@ -111,6 +115,9 @@ export function limitNumber(
}
export const TTSConfigValidator = {
engine(x: string) {
return x as TTSEngineType;
},
model(x: string) {
return x as TTSModelType;
},