Fix xtts separator
This commit is contained in:
parent
56b63c0e02
commit
f802fe1797
|
@ -502,6 +502,10 @@ async function processTtsQueue() {
|
|||
const partJoiner = (ttsProvider?.separator || ' ... ');
|
||||
text = matches ? matches.join(partJoiner) : text;
|
||||
}
|
||||
|
||||
// Collapse newlines and spaces into single space
|
||||
text = text.replace(/\s+/g, ' ');
|
||||
|
||||
console.log(`TTS: ${text}`)
|
||||
const char = currentTtsJob.name
|
||||
|
||||
|
|
|
@ -11,25 +11,25 @@ class XTTSTtsProvider {
|
|||
settings
|
||||
ready = false
|
||||
voices = []
|
||||
separator = ' .. '
|
||||
separator = '. '
|
||||
|
||||
languageLabels = {
|
||||
"Arabic": "ar",
|
||||
"Brazilian Portuguese": "pt",
|
||||
"Chinese": "zh-cn",
|
||||
"Czech": "cs",
|
||||
"Dutch": "nl",
|
||||
"English": "en",
|
||||
"French": "fr",
|
||||
"German": "de",
|
||||
"Italian": "it",
|
||||
"Polish": "pl",
|
||||
"Russian": "ru",
|
||||
"Spanish": "es",
|
||||
"Turkish": "tr",
|
||||
"Japanese": "ja",
|
||||
"Korean": "ko",
|
||||
"Hungarian": "hu"
|
||||
"Arabic": "ar",
|
||||
"Brazilian Portuguese": "pt",
|
||||
"Chinese": "zh-cn",
|
||||
"Czech": "cs",
|
||||
"Dutch": "nl",
|
||||
"English": "en",
|
||||
"French": "fr",
|
||||
"German": "de",
|
||||
"Italian": "it",
|
||||
"Polish": "pl",
|
||||
"Russian": "ru",
|
||||
"Spanish": "es",
|
||||
"Turkish": "tr",
|
||||
"Japanese": "ja",
|
||||
"Korean": "ko",
|
||||
"Hungarian": "hu"
|
||||
}
|
||||
|
||||
defaultSettings = {
|
||||
|
@ -46,7 +46,7 @@ class XTTSTtsProvider {
|
|||
|
||||
for (let language in this.languageLabels) {
|
||||
|
||||
if(this.languageLabels[language] == this.settings?.language){
|
||||
if (this.languageLabels[language] == this.settings?.language) {
|
||||
html += `<option value="${this.languageLabels[language]}" selected="selected">${language}</option>`;
|
||||
continue
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ class XTTSTtsProvider {
|
|||
// Only accept keys defined in defaultSettings
|
||||
this.settings = this.defaultSettings
|
||||
|
||||
for (const key in settings){
|
||||
if (key in this.settings){
|
||||
for (const key in settings) {
|
||||
if (key in this.settings) {
|
||||
this.settings[key] = settings[key]
|
||||
} else {
|
||||
throw `Invalid setting passed to TTS Provider: ${key}`
|
||||
|
@ -106,9 +106,9 @@ class XTTSTtsProvider {
|
|||
}, 2000);
|
||||
|
||||
$('#xtts_tts_endpoint').val(this.settings.provider_endpoint)
|
||||
$('#xtts_tts_endpoint').on("input", () => {this.onSettingsChange()})
|
||||
$('#xtts_tts_endpoint').on("input", () => { this.onSettingsChange() })
|
||||
$('#xtts_api_language').val(this.settings.language)
|
||||
$('#xtts_api_language').on("change", () => {this.onSettingsChange()})
|
||||
$('#xtts_api_language').on("change", () => { this.onSettingsChange() })
|
||||
|
||||
await this.checkReady()
|
||||
|
||||
|
@ -116,7 +116,7 @@ class XTTSTtsProvider {
|
|||
}
|
||||
|
||||
// Perform a simple readiness check by trying to fetch voiceIds
|
||||
async checkReady(){
|
||||
async checkReady() {
|
||||
|
||||
const response = await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ class XTTSTtsProvider {
|
|||
return match
|
||||
}
|
||||
|
||||
async generateTts(text, voiceId){
|
||||
async generateTts(text, voiceId) {
|
||||
const response = await this.fetchTtsGeneration(text, voiceId)
|
||||
return response
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ class XTTSTtsProvider {
|
|||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Cache-Control': 'no-cache' // Added this line to disable caching of file so new files are always played - Rolyat 7/7/23
|
||||
'Cache-Control': 'no-cache' // Added this line to disable caching of file so new files are always played - Rolyat 7/7/23
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"text": inputText,
|
||||
|
|
Loading…
Reference in New Issue