Add Gpt-SoVITS TTS, change google translate lang to auto (#600)
# PR Checklist - [ v ] Did you check if it works normally in all models? *ignore this when it dosen't uses models* - [ v ] Did you check if it works normally in all of web, local and node hosted versions? if it dosen't, did you blocked it in those versions? - [ v ] Did you added a type def? # Description Add connection Gpt-SoVITS Api to ngrok turnel. ttsReadOnlyQuoted support to japan Quote (「」) and change google translate api language to auto (experiment)
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
import LoreBook from "./LoreBook/LoreBookSetting.svelte";
|
||||
import { alertConfirm, alertMd, alertNormal, alertSelectChar, alertTOS, showHypaV2Alert } from "../../ts/alert";
|
||||
import BarIcon from "./BarIcon.svelte";
|
||||
import { findCharacterbyId, getAuthorNoteDefaultText, parseKeyValue, selectMultipleFile } from "../../ts/util";
|
||||
import { findCharacterbyId, getAuthorNoteDefaultText, parseKeyValue, selectMultipleFile, selectSingleFile } from "../../ts/util";
|
||||
import { onDestroy } from "svelte";
|
||||
import {isEqual} from 'lodash'
|
||||
import Help from "../Others/Help.svelte";
|
||||
@@ -29,9 +29,11 @@
|
||||
import { updateInlayScreen } from "src/ts/process/inlayScreen";
|
||||
import { registerOnnxModel } from "src/ts/process/transformers";
|
||||
import MultiLangInput from "../UI/GUI/MultiLangInput.svelte";
|
||||
import { applyModule } from "src/ts/process/modules";
|
||||
import { exportRegex, importRegex } from "src/ts/process/scripts";
|
||||
import Arcodion from "../UI/Arcodion.svelte";
|
||||
import { applyModule } from "src/ts/process/modules";
|
||||
import { exportRegex, importRegex } from "src/ts/process/scripts";
|
||||
import Arcodion from "../UI/Arcodion.svelte";
|
||||
import SliderInput from "../UI/GUI/SliderInput.svelte";
|
||||
|
||||
|
||||
|
||||
let subMenu = 0
|
||||
@@ -105,6 +107,12 @@
|
||||
}
|
||||
emos = currentChar.data.emotionImages
|
||||
currentChar = currentChar
|
||||
|
||||
if (currentChar.data.ttsMode === 'gptsovits' && (currentChar.data as character).gptSoVitsConfig) {
|
||||
if (!(currentChar.data as character).gptSoVitsConfig.use_prompt) {
|
||||
(currentChar.data as character).gptSoVitsConfig.prompt = undefined
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let assetFileExtensions:string[] = []
|
||||
@@ -149,6 +157,27 @@
|
||||
version: 'v2'
|
||||
};
|
||||
}
|
||||
$: if (currentChar.data.ttsMode === 'gptsovits' && (currentChar.data as character).gptSoVitsConfig === undefined) {
|
||||
(currentChar.data as character).gptSoVitsConfig = {
|
||||
url: '',
|
||||
ref_audio_path: 'C:/Users/user/Downloads/GPT-SoVITS-v2-240821',
|
||||
ref_audio_data: {
|
||||
fileName: '',
|
||||
assetId: ''
|
||||
},
|
||||
volume: 1.0,
|
||||
text_lang: 'auto',
|
||||
text: 'en',
|
||||
use_prompt: false,
|
||||
prompt_lang: 'en',
|
||||
top_p: 1,
|
||||
temperature: 0.7,
|
||||
speed: 1,
|
||||
top_k: 5,
|
||||
text_split_method: 'cut0',
|
||||
};
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{#if licensed !== 'private'}
|
||||
@@ -678,7 +707,7 @@
|
||||
{#if currentChar.type === 'character'}
|
||||
<h2 class="mb-2 text-2xl font-bold mt-2">TTS</h2>
|
||||
<span class="text-textcolor">{language.provider}</span>
|
||||
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.ttsMode} on:change={() => {
|
||||
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.ttsMode} on:change={(e) => {
|
||||
if(currentChar.type === 'character'){
|
||||
currentChar.data.ttsSpeech = ''
|
||||
}
|
||||
@@ -691,6 +720,7 @@
|
||||
<OptionInput value="novelai">NovelAI</OptionInput>
|
||||
<OptionInput value="huggingface">Huggingface</OptionInput>
|
||||
<OptionInput value="vits">VITS</OptionInput>
|
||||
<OptionInput value="gptsovits">GPT-SoVITS</OptionInput>
|
||||
</SelectInput>
|
||||
|
||||
|
||||
@@ -774,23 +804,20 @@
|
||||
<OptionInput value="v1">v1</OptionInput>
|
||||
<OptionInput value="v2">v2</OptionInput>
|
||||
</SelectInput>
|
||||
{/if}
|
||||
{#if currentChar.data.ttsMode === 'openai'}
|
||||
{:else if currentChar.data.ttsMode === 'openai'}
|
||||
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.oaiVoice}>
|
||||
<OptionInput value="">Unset</OptionInput>
|
||||
{#each oaiVoices as voice}
|
||||
<OptionInput value={voice}>{voice}</OptionInput>
|
||||
{/each}
|
||||
</SelectInput>
|
||||
{/if}
|
||||
{#if currentChar.data.ttsMode === 'huggingface'}
|
||||
{:else if currentChar.data.ttsMode === 'huggingface'}
|
||||
<span class="text-textcolor">Model</span>
|
||||
<TextInput className="mb-4 mt-2" bind:value={currentChar.data.hfTTS.model} />
|
||||
|
||||
<span class="text-textcolor">Language</span>
|
||||
<TextInput className="mb-4 mt-2" bind:value={currentChar.data.hfTTS.language} placeholder="en" />
|
||||
{/if}
|
||||
{#if currentChar.data.ttsMode === 'vits'}
|
||||
{:else if currentChar.data.ttsMode === 'vits'}
|
||||
{#if currentChar.data.vits}
|
||||
<span class="text-textcolor">{currentChar.data.vits.name ?? 'Unnamed VitsModel'}</span>
|
||||
{:else}
|
||||
@@ -802,6 +829,99 @@
|
||||
currentChar.data.vits = model
|
||||
}
|
||||
}}>{language.selectModel}</Button>
|
||||
{:else if currentChar.data.ttsMode === 'gptsovits'}
|
||||
<span class="text-textcolor">Volume</span>
|
||||
<SliderInput min={0.0} max={1.0} step={0.01} fixed={2} bind:value={currentChar.data.gptSoVitsConfig.volume}/>
|
||||
<span class="text-textcolor">URL</span>
|
||||
<TextInput className="mb-4 mt-2" bind:value={currentChar.data.gptSoVitsConfig.url}/>
|
||||
|
||||
<span class="text-textcolor">Reference Audio Path (e.g. C:/Users/user/Downloads/GPT-SoVITS-v2-240821)</span>
|
||||
<TextInput className="mb-4 mt-2" bind:value={currentChar.data.gptSoVitsConfig.ref_audio_path}/>
|
||||
|
||||
<span class="text-textcolor">Reference Audio Data (3~10s audio file)</span>
|
||||
<Button on:click={async () => {
|
||||
const audio = await selectSingleFile([
|
||||
'wav',
|
||||
'ogg',
|
||||
'aac'
|
||||
])
|
||||
if(!audio){
|
||||
return null
|
||||
}
|
||||
const saveId = await saveAsset(audio.data)
|
||||
// @ts-expect-error not groupChat
|
||||
currentChar.data.gptSoVitsConfig.ref_audio_data = {
|
||||
fileName: audio.name,
|
||||
assetId: saveId
|
||||
}
|
||||
|
||||
}}
|
||||
className="h-10">
|
||||
|
||||
{#if currentChar.data.gptSoVitsConfig.ref_audio_data.assetId === '' || currentChar.data.gptSoVitsConfig.ref_audio_data.assetId === undefined}
|
||||
Select File
|
||||
{:else}
|
||||
{currentChar.data.gptSoVitsConfig.ref_audio_data.fileName}
|
||||
{/if}
|
||||
</Button>
|
||||
<span class="text-textcolor">Text Language</span>
|
||||
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.gptSoVitsConfig.text_lang}>
|
||||
<OptionInput value="auto">Auto</OptionInput>
|
||||
<OptionInput value="auto_yue">Auto (Cantonese)</OptionInput>
|
||||
<OptionInput value="en">English</OptionInput>
|
||||
<OptionInput value="zh">Chinese</OptionInput>
|
||||
<OptionInput value="ja">Japanese</OptionInput>
|
||||
<OptionInput value="yue">Cantonese</OptionInput>
|
||||
<OptionInput value="ko">Korean</OptionInput>
|
||||
<OptionInput value="all_zh">All Chinese</OptionInput>
|
||||
<OptionInput value="all_ja">All Japanese</OptionInput>
|
||||
<OptionInput value="all_yue">All Cantonese</OptionInput>
|
||||
<OptionInput value="all_ko">All Korean</OptionInput>
|
||||
</SelectInput>
|
||||
|
||||
<span class="text-textcolor">Use Reference Audio Script</span>
|
||||
<Check bind:check={currentChar.data.gptSoVitsConfig.use_prompt}/>
|
||||
|
||||
{#if currentChar.data.gptSoVitsConfig.use_prompt}
|
||||
<span class="text-textcolor">Reference Audio Script</span>
|
||||
<TextAreaInput className="mb-4 mt-2" bind:value={currentChar.data.gptSoVitsConfig.prompt}/>
|
||||
{/if}
|
||||
|
||||
<span class="text-textcolor">Reference Audio Language</span>
|
||||
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.gptSoVitsConfig.prompt_lang}>
|
||||
<OptionInput value="auto">Auto</OptionInput>
|
||||
<OptionInput value="auto_yue">Auto (Cantonese)</OptionInput>
|
||||
<OptionInput value="en">English</OptionInput>
|
||||
<OptionInput value="zh">Chinese</OptionInput>
|
||||
<OptionInput value="ja">Japanese</OptionInput>
|
||||
<OptionInput value="yue">Cantonese</OptionInput>
|
||||
<OptionInput value="ko">Korean</OptionInput>
|
||||
<OptionInput value="all_zh">English And Chinese</OptionInput>
|
||||
<OptionInput value="all_ja">English And Japanese</OptionInput>
|
||||
<OptionInput value="all_yue">English And Cantonese</OptionInput>
|
||||
<OptionInput value="all_ko">English And Korean</OptionInput>
|
||||
</SelectInput>
|
||||
<span class="text-textcolor">Top P</span>
|
||||
<SliderInput min={0.0} max={1.0} step={0.05} fixed={2} bind:value={currentChar.data.gptSoVitsConfig.top_p}/>
|
||||
|
||||
<span class="text-textcolor">Temperature</span>
|
||||
<SliderInput min={0.0} max={1.0} step={0.05} fixed={2} bind:value={currentChar.data.gptSoVitsConfig.temperature}/>
|
||||
|
||||
<span class="text-textcolor">Speed</span>
|
||||
<SliderInput min={0.6} max={1.65} step={0.05} fixed={2} bind:value={currentChar.data.gptSoVitsConfig.speed}/>
|
||||
|
||||
<span class="text-textcolor">Top K</span>
|
||||
<SliderInput min={1} max={100} step={1} bind:value={currentChar.data.gptSoVitsConfig.top_k}/>
|
||||
|
||||
<span class="text-textcolor">Text Split Method</span>
|
||||
<SelectInput className="mb-4 mt-2" bind:value={currentChar.data.gptSoVitsConfig.text_split_method}>
|
||||
<OptionInput value="cut0">Cut 0 (No splitting)</OptionInput>
|
||||
<OptionInput value="cut1">Cut 1 (Split every 4 sentences)</OptionInput>
|
||||
<OptionInput value="cut2">Cut 2 (Split every 50 characters)</OptionInput>
|
||||
<OptionInput value="cut3">Cut 3 (Split by Chinese periods)</OptionInput>
|
||||
<OptionInput value="cut4">Cut 4 (Split by English periods)</OptionInput>
|
||||
<OptionInput value="cut5">Cut 5 (Split by various punctuation marks)</OptionInput>
|
||||
</SelectInput>
|
||||
{/if}
|
||||
{#if currentChar.data.ttsMode}
|
||||
<div class="flex items-center mt-2">
|
||||
|
||||
Reference in New Issue
Block a user