mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Change all TTS providers loading to async
This commit is contained in:
@ -54,7 +54,7 @@ function resetModelSettings() {
|
|||||||
$("#coqui_api_model_settings_language").val("none");
|
$("#coqui_api_model_settings_language").val("none");
|
||||||
$("#coqui_api_model_settings_speaker").val("none");
|
$("#coqui_api_model_settings_speaker").val("none");
|
||||||
}
|
}
|
||||||
|
|
||||||
class CoquiTtsProvider {
|
class CoquiTtsProvider {
|
||||||
//#############################//
|
//#############################//
|
||||||
// Extension UI and Settings //
|
// Extension UI and Settings //
|
||||||
@ -111,7 +111,7 @@ class CoquiTtsProvider {
|
|||||||
<span id="coqui_api_model_install_status">Model installed on extras server</span>
|
<span id="coqui_api_model_install_status">Model installed on extras server</span>
|
||||||
<input id="coqui_api_model_install_button" class="menu_button" type="button" value="Install" />
|
<input id="coqui_api_model_install_button" class="menu_button" type="button" value="Install" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="coqui_local_model_div">
|
<div id="coqui_local_model_div">
|
||||||
<select id="coqui_local_model_name">
|
<select id="coqui_local_model_name">
|
||||||
<!-- Populated by JS and request -->
|
<!-- Populated by JS and request -->
|
||||||
@ -125,7 +125,7 @@ class CoquiTtsProvider {
|
|||||||
return html
|
return html
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(settings) {
|
async loadSettings(settings) {
|
||||||
// Only accept keys defined in defaultSettings
|
// Only accept keys defined in defaultSettings
|
||||||
this.settings = this.defaultSettings
|
this.settings = this.defaultSettings
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ class CoquiTtsProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initLocalModels();
|
await initLocalModels();
|
||||||
this.updateCustomVoices(); // Overide any manual modification
|
this.updateCustomVoices(); // Overide any manual modification
|
||||||
|
|
||||||
$("#coqui_api_model_div").hide();
|
$("#coqui_api_model_div").hide();
|
||||||
@ -158,7 +158,7 @@ class CoquiTtsProvider {
|
|||||||
$("#coqui_add_voiceId_mapping").on("click", function () { that.onAddClick() });
|
$("#coqui_add_voiceId_mapping").on("click", function () { that.onAddClick() });
|
||||||
|
|
||||||
// Load coqui-api settings from json file
|
// Load coqui-api settings from json file
|
||||||
fetch("/scripts/extensions/tts/coqui_api_models_settings.json")
|
await fetch("/scripts/extensions/tts/coqui_api_models_settings.json")
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
coquiApiModels = json;
|
coquiApiModels = json;
|
||||||
@ -178,7 +178,7 @@ class CoquiTtsProvider {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Load coqui-api FULL settings from json file
|
// Load coqui-api FULL settings from json file
|
||||||
fetch("/scripts/extensions/tts/coqui_api_models_settings_full.json")
|
await fetch("/scripts/extensions/tts/coqui_api_models_settings_full.json")
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
coquiApiModelsFull = json;
|
coquiApiModelsFull = json;
|
||||||
@ -229,7 +229,7 @@ class CoquiTtsProvider {
|
|||||||
for (const voiceName in this.settings.voiceMapDict) {
|
for (const voiceName in this.settings.voiceMapDict) {
|
||||||
$("#coqui_voicename_select").append(new Option(voiceName, voiceName));
|
$("#coqui_voicename_select").append(new Option(voiceName, voiceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onSettingsChange()
|
this.onSettingsChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ class CoquiTtsProvider {
|
|||||||
if (inApiCall) {
|
if (inApiCall) {
|
||||||
return; //TODO: block dropdown
|
return; //TODO: block dropdown
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask user for voiceId name to save voice
|
// Ask user for voiceId name to save voice
|
||||||
const voiceName = await callPopup('<h3>Name of Coqui voice to add to voice select dropdown:</h3>', 'input')
|
const voiceName = await callPopup('<h3>Name of Coqui voice to add to voice select dropdown:</h3>', 'input')
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ class CoquiTtsProvider {
|
|||||||
$("#coqui_local_model_div").hide();
|
$("#coqui_local_model_div").hide();
|
||||||
$("#coqui_api_model_div").hide();
|
$("#coqui_api_model_div").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// show coqui model selected list (SAFE)
|
// show coqui model selected list (SAFE)
|
||||||
if (model_origin == "coqui-api") {
|
if (model_origin == "coqui-api") {
|
||||||
$("#coqui_local_model_div").hide();
|
$("#coqui_local_model_div").hide();
|
||||||
@ -770,4 +770,4 @@ async function initLocalModels() {
|
|||||||
|
|
||||||
coquiLocalModelsReceived = true;
|
coquiLocalModelsReceived = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class EdgeTtsProvider {
|
|||||||
saveTtsProviderSettings()
|
saveTtsProviderSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(settings) {
|
async loadSettings(settings) {
|
||||||
// Pupulate Provider UI given input settings
|
// Pupulate Provider UI given input settings
|
||||||
if (Object.keys(settings).length == 0) {
|
if (Object.keys(settings).length == 0) {
|
||||||
console.info("Using default TTS Provider settings")
|
console.info("Using default TTS Provider settings")
|
||||||
@ -54,7 +54,7 @@ class EdgeTtsProvider {
|
|||||||
$('#edge_tts_rate').val(this.settings.rate || 0);
|
$('#edge_tts_rate').val(this.settings.rate || 0);
|
||||||
$('#edge_tts_rate_output').text(this.settings.rate || 0);
|
$('#edge_tts_rate_output').text(this.settings.rate || 0);
|
||||||
$('#edge_tts_rate').on("input", () => {this.onSettingsChange()})
|
$('#edge_tts_rate').on("input", () => {this.onSettingsChange()})
|
||||||
this.checkReady()
|
await this.checkReady()
|
||||||
|
|
||||||
console.info("Settings loaded")
|
console.info("Settings loaded")
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class ElevenLabsTtsProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
loadSettings(settings) {
|
async loadSettings(settings) {
|
||||||
// Pupulate Provider UI given input settings
|
// Pupulate Provider UI given input settings
|
||||||
if (Object.keys(settings).length == 0) {
|
if (Object.keys(settings).length == 0) {
|
||||||
console.info("Using default TTS Provider settings")
|
console.info("Using default TTS Provider settings")
|
||||||
@ -72,8 +72,8 @@ class ElevenLabsTtsProvider {
|
|||||||
$('#tts_auto_generation').prop('checked', this.settings.multilingual)
|
$('#tts_auto_generation').prop('checked', this.settings.multilingual)
|
||||||
$('#eleven_labs_connect').on('click', () => {this.onConnectClick()})
|
$('#eleven_labs_connect').on('click', () => {this.onConnectClick()})
|
||||||
$('#elevenlabs_tts_settings').on('input',this.onSettingsChange)
|
$('#elevenlabs_tts_settings').on('input',this.onSettingsChange)
|
||||||
|
|
||||||
this.checkReady()
|
await this.checkReady()
|
||||||
console.info("Settings loaded")
|
console.info("Settings loaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,8 +592,8 @@ async function loadTtsProvider(provider) {
|
|||||||
console.warn(`Provider ${ttsProviderName} not in Extension Settings, initiatilizing provider in settings`)
|
console.warn(`Provider ${ttsProviderName} not in Extension Settings, initiatilizing provider in settings`)
|
||||||
extension_settings.tts[ttsProviderName] = {}
|
extension_settings.tts[ttsProviderName] = {}
|
||||||
}
|
}
|
||||||
ttsProvider.loadSettings(extension_settings.tts[ttsProviderName])
|
await ttsProvider.loadSettings(extension_settings.tts[ttsProviderName])
|
||||||
initVoiceMap()
|
await initVoiceMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTtsProviderChange() {
|
function onTtsProviderChange() {
|
||||||
|
@ -71,7 +71,7 @@ class NovelTtsProvider {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(settings) {
|
async loadSettings(settings) {
|
||||||
// Populate Provider UI given input settings
|
// Populate Provider UI given input settings
|
||||||
if (Object.keys(settings).length == 0) {
|
if (Object.keys(settings).length == 0) {
|
||||||
console.info("Using default TTS Provider settings")
|
console.info("Using default TTS Provider settings")
|
||||||
@ -91,7 +91,7 @@ class NovelTtsProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.populateCustomVoices()
|
this.populateCustomVoices()
|
||||||
this.checkReady()
|
await this.checkReady()
|
||||||
console.info("Settings loaded")
|
console.info("Settings loaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class SileroTtsProvider {
|
|||||||
saveTtsProviderSettings()
|
saveTtsProviderSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(settings) {
|
async loadSettings(settings) {
|
||||||
// Pupulate Provider UI given input settings
|
// Pupulate Provider UI given input settings
|
||||||
if (Object.keys(settings).length == 0) {
|
if (Object.keys(settings).length == 0) {
|
||||||
console.info("Using default TTS Provider settings")
|
console.info("Using default TTS Provider settings")
|
||||||
@ -65,7 +65,7 @@ class SileroTtsProvider {
|
|||||||
$('#silero_tts_endpoint').val(this.settings.provider_endpoint)
|
$('#silero_tts_endpoint').val(this.settings.provider_endpoint)
|
||||||
$('#silero_tts_endpoint').on("input", () => {this.onSettingsChange()})
|
$('#silero_tts_endpoint').on("input", () => {this.onSettingsChange()})
|
||||||
|
|
||||||
this.checkReady()
|
await this.checkReady()
|
||||||
|
|
||||||
console.info("Settings loaded")
|
console.info("Settings loaded")
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ class SystemTtsProvider {
|
|||||||
saveTtsProviderSettings()
|
saveTtsProviderSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(settings) {
|
async loadSettings(settings) {
|
||||||
// Populate Provider UI given input settings
|
// Populate Provider UI given input settings
|
||||||
if (Object.keys(settings).length == 0) {
|
if (Object.keys(settings).length == 0) {
|
||||||
console.info("Using default TTS Provider settings");
|
console.info("Using default TTS Provider settings");
|
||||||
|
Reference in New Issue
Block a user