diff --git a/src/lib/SideBars/CharConfig.svelte b/src/lib/SideBars/CharConfig.svelte
index 2da312a0..a35b1b5f 100644
--- a/src/lib/SideBars/CharConfig.svelte
+++ b/src/lib/SideBars/CharConfig.svelte
@@ -112,6 +112,13 @@
if (!(currentChar.data as character).gptSoVitsConfig.use_prompt) {
(currentChar.data as character).gptSoVitsConfig.prompt = undefined
}
+ if((currentChar.data as character).gptSoVitsConfig.use_auto_path){
+ (currentChar.data as character).gptSoVitsConfig.ref_audio_path = undefined;
+
+ (currentChar.data as character).gptSoVitsConfig.use_prompt = false;
+ (currentChar.data as character).gptSoVitsConfig.prompt = undefined;
+
+ }
}
})
@@ -160,7 +167,9 @@
$: 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',
+ use_auto_path: false,
+ ref_audio_path: '',
+ use_long_audio: false,
ref_audio_data: {
fileName: '',
assetId: ''
@@ -835,15 +844,24 @@
URL
- Reference Audio Path (e.g. C:/Users/user/Downloads/GPT-SoVITS-v2-240821)
-
+ Use Auto Path
+
+
+ {#if !currentChar.data.gptSoVitsConfig.use_auto_path}
+ Reference Audio Path (e.g. C:/Users/user/Downloads/GPT-SoVITS-v2-240821)
+
+ {/if}
+
+ Use Long Audio
+
Reference Audio Data (3~10s audio file)
Text Language
- Auto
- Auto (Cantonese)
+ Multi-language Mixed
+ Multi-language Mixed (Cantonese)
English
- Chinese
- Japanese
- Cantonese
- Korean
- All Chinese
- All Japanese
- All Cantonese
- All Korean
+ Chinese-English Mixed
+ Japanese-English Mixed
+ Cantonese-English Mixed
+ Korean-English Mixed
+ Chinese
+ Japanese
+ Cantonese
+ Korean
- Use Reference Audio Script
-
+ {#if !currentChar.data.gptSoVitsConfig.use_long_audio}
+ Use Reference Audio Script
+
+ {/if}
- {#if currentChar.data.gptSoVitsConfig.use_prompt}
+ {#if currentChar.data.gptSoVitsConfig.use_prompt && !currentChar.data.gptSoVitsConfig.use_long_audio}
Reference Audio Script
{/if}
Reference Audio Language
- Auto
- Auto (Cantonese)
+ Multi-language Mixed
+ Multi-language Mixed (Cantonese)
English
- Chinese
- Japanese
- Cantonese
- Korean
- English And Chinese
- English And Japanese
- English And Cantonese
- English And Korean
+ Chinese-English Mixed
+ Japanese-English Mixed
+ Cantonese-English Mixed
+ Korean-English Mixed
+ Chinese
+ Japanese
+ Cantonese
+ Korean
Top P
diff --git a/src/ts/process/tts.ts b/src/ts/process/tts.ts
index 6ecbb755..57a4dbfe 100644
--- a/src/ts/process/tts.ts
+++ b/src/ts/process/tts.ts
@@ -235,12 +235,12 @@ export async function sayTTS(character:character,text:string) {
const audioContext = new AudioContext();
const audio: Uint8Array = await loadAsset(character.gptSoVitsConfig.ref_audio_data.assetId);
- const base64Audio = btoa(new Uint8Array(audio).reduce((data, byte) => data + String.fromCharCode(byte), ''));
+ const base64Audio = btoa(new Uint8Array(audio).reduce((data, byte) => data + String.fromCharCode(byte), ''));
const body = {
text: text,
text_lang: character.gptSoVitsConfig.text_lang,
- ref_audio_path: character.gptSoVitsConfig.ref_audio_path + '/public/audio/' + character.gptSoVitsConfig.ref_audio_data.fileName,
+ ref_audio_path: undefined,
ref_audio_name: character.gptSoVitsConfig.ref_audio_data.fileName,
ref_audio_data: base64Audio,
prompt_text: undefined,
@@ -250,18 +250,41 @@ export async function sayTTS(character:character,text:string) {
speed_factor: character.gptSoVitsConfig.speed,
top_k: character.gptSoVitsConfig.top_k,
text_split_method: character.gptSoVitsConfig.text_split_method,
- parallel_infer: false,
+ parallel_infer: true,
+ // media_type: character.gptSoVitsConfig.ref_audio_data.fileName.split('.')[1],
+ ref_free: character.gptSoVitsConfig.use_long_audio || !character.gptSoVitsConfig.use_prompt,
}
if (character.gptSoVitsConfig.use_prompt){
body.prompt_text = character.gptSoVitsConfig.prompt
}
+
+ if (character.gptSoVitsConfig.use_auto_path){
+ console.log('auto')
+ const path = await globalFetch(`${character.gptSoVitsConfig.url}/get_path`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ rawResponse: false,
+
+ })
+ console.log(path)
+ if(path.ok){
+ body.ref_audio_path = path.data.message + '/public/audio/' + character.gptSoVitsConfig.ref_audio_data.fileName
+ }
+ else{
+ throw new Error('Failed to Auto get path')
+ }
+ } else {
+ body.ref_audio_path = character.gptSoVitsConfig.ref_audio_path + '/public/audio/' + character.gptSoVitsConfig.ref_audio_data.fileName
+ }
console.log(body)
const response = await globalFetch(`${character.gptSoVitsConfig.url}/tts`, {
method: 'POST',
headers: {
- "Content-Type": "application/json",
+ 'Content-Type': 'application/json'
},
body: body,
rawResponse: true,