mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Update TTS extension to use new popup
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
import { callPopup, getRequestHeaders } from '../../../script.js';
|
import { getRequestHeaders } from '../../../script.js';
|
||||||
|
import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||||
import { SECRET_KEYS, findSecret, secret_state, writeSecret } from '../../secrets.js';
|
import { SECRET_KEYS, findSecret, secret_state, writeSecret } from '../../secrets.js';
|
||||||
import { getPreviewString, saveTtsProviderSettings } from './index.js';
|
import { getPreviewString, saveTtsProviderSettings } from './index.js';
|
||||||
export { AzureTtsProvider };
|
export { AzureTtsProvider };
|
||||||
@ -69,13 +70,13 @@ class AzureTtsProvider {
|
|||||||
const popupText = 'Azure TTS API Key';
|
const popupText = 'Azure TTS API Key';
|
||||||
const savedKey = secret_state[SECRET_KEYS.AZURE_TTS] ? await findSecret(SECRET_KEYS.AZURE_TTS) : '';
|
const savedKey = secret_state[SECRET_KEYS.AZURE_TTS] ? await findSecret(SECRET_KEYS.AZURE_TTS) : '';
|
||||||
|
|
||||||
const key = await callPopup(popupText, 'input', savedKey);
|
const key = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedKey);
|
||||||
|
|
||||||
if (key == false || key == '') {
|
if (key == false || key == '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await writeSecret(SECRET_KEYS.AZURE_TTS, key);
|
await writeSecret(SECRET_KEYS.AZURE_TTS, String(key));
|
||||||
|
|
||||||
toastr.success('API Key saved');
|
toastr.success('API Key saved');
|
||||||
$('#azure_tts_key').addClass('success');
|
$('#azure_tts_key').addClass('success');
|
||||||
|
@ -5,8 +5,8 @@ TODO:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { doExtrasFetch, extension_settings, getApiUrl, modules } from '../../extensions.js';
|
import { doExtrasFetch, extension_settings, getApiUrl, modules } from '../../extensions.js';
|
||||||
import { callPopup } from '../../../script.js';
|
|
||||||
import { initVoiceMap } from './index.js';
|
import { initVoiceMap } from './index.js';
|
||||||
|
import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||||
|
|
||||||
export { CoquiTtsProvider };
|
export { CoquiTtsProvider };
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ class CoquiTtsProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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 callGenericPopup('Name of Coqui voice to add to voice select dropdown:', POPUP_TYPE.INPUT);
|
||||||
|
|
||||||
const model_origin = $('#coqui_model_origin').val();
|
const model_origin = $('#coqui_model_origin').val();
|
||||||
const model_language = $('#coqui_api_language').val();
|
const model_language = $('#coqui_api_language').val();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { getRequestHeaders, callPopup } from '../../../script.js';
|
import { getRequestHeaders } from '../../../script.js';
|
||||||
|
import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||||
import { splitRecursive } from '../../utils.js';
|
import { splitRecursive } from '../../utils.js';
|
||||||
import { getPreviewString, saveTtsProviderSettings } from './index.js';
|
import { getPreviewString, saveTtsProviderSettings } from './index.js';
|
||||||
import { initVoiceMap } from './index.js';
|
import { initVoiceMap } from './index.js';
|
||||||
@ -56,7 +57,7 @@ class NovelTtsProvider {
|
|||||||
|
|
||||||
// Add a new Novel custom voice to provider
|
// Add a new Novel custom voice to provider
|
||||||
async addCustomVoice() {
|
async addCustomVoice() {
|
||||||
const voiceName = await callPopup('<h3>Custom Voice name:</h3>', 'input');
|
const voiceName = await callGenericPopup('Custom Voice name:', POPUP_TYPE.INPUT);
|
||||||
this.settings.customVoices.push(voiceName);
|
this.settings.customVoices.push(voiceName);
|
||||||
this.populateCustomVoices();
|
this.populateCustomVoices();
|
||||||
initVoiceMap(); // Update TTS extension voiceMap
|
initVoiceMap(); // Update TTS extension voiceMap
|
||||||
|
Reference in New Issue
Block a user