name changes
This commit is contained in:
parent
d03af9b41d
commit
b3a4787db6
|
@ -2,7 +2,7 @@ import { getRequestHeaders } from "../../../script.js"
|
|||
import { getApiUrl } from "../../extensions.js"
|
||||
import { doExtrasFetch, modules } from "../../extensions.js"
|
||||
import { getPreviewString } from "./index.js"
|
||||
import { onTtsProviderSettingsInput } from "./index.js"
|
||||
import { saveTtsProviderSettings } from "./index.js"
|
||||
|
||||
export { EdgeTtsProvider }
|
||||
|
||||
|
@ -31,7 +31,7 @@ class EdgeTtsProvider {
|
|||
onSettingsChange() {
|
||||
this.settings.rate = Number($('#edge_tts_rate').val());
|
||||
$('#edge_tts_rate_output').text(this.settings.rate);
|
||||
onTtsProviderSettingsInput()
|
||||
saveTtsProviderSettings()
|
||||
}
|
||||
|
||||
loadSettings(settings) {
|
||||
|
@ -63,10 +63,10 @@ class EdgeTtsProvider {
|
|||
// Perform a simple readiness check by trying to fetch voiceIds
|
||||
async checkReady(){
|
||||
throwIfModuleMissing()
|
||||
await this.fetchTtsVoiceIds()
|
||||
await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
|
||||
async onApplyClick() {
|
||||
async onRefreshClick() {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class EdgeTtsProvider {
|
|||
|
||||
async getVoice(voiceName) {
|
||||
if (this.voices.length == 0) {
|
||||
this.voices = await this.fetchTtsVoiceIds()
|
||||
this.voices = await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
const match = this.voices.filter(
|
||||
voice => voice.name == voiceName
|
||||
|
@ -95,7 +95,7 @@ class EdgeTtsProvider {
|
|||
//###########//
|
||||
// API CALLS //
|
||||
//###########//
|
||||
async fetchTtsVoiceIds() {
|
||||
async fetchTtsVoiceObjects() {
|
||||
throwIfModuleMissing()
|
||||
|
||||
const url = new URL(getApiUrl());
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { onTtsProviderSettingsInput } from "./index.js"
|
||||
import { saveTtsProviderSettings } from "./index.js"
|
||||
export { ElevenLabsTtsProvider }
|
||||
|
||||
class ElevenLabsTtsProvider {
|
||||
|
@ -46,7 +46,7 @@ class ElevenLabsTtsProvider {
|
|||
this.settings.stability = $('#elevenlabs_tts_stability').val()
|
||||
this.settings.similarity_boost = $('#elevenlabs_tts_similarity_boost').val()
|
||||
this.settings.multilingual = $('#elevenlabs_tts_multilingual').prop('checked')
|
||||
onTtsProviderSettingsInput()
|
||||
saveTtsProviderSettings()
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,10 +79,10 @@ class ElevenLabsTtsProvider {
|
|||
|
||||
// Perform a simple readiness check by trying to fetch voiceIds
|
||||
async checkReady(){
|
||||
await this.fetchTtsVoiceIds()
|
||||
await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
|
||||
async onApplyClick() {
|
||||
async onRefreshClick() {
|
||||
}
|
||||
|
||||
async onConnectClick() {
|
||||
|
@ -97,7 +97,7 @@ class ElevenLabsTtsProvider {
|
|||
// Using this call to validate API key
|
||||
this.settings.apiKey = $('#elevenlabs_tts_api_key').val()
|
||||
|
||||
await this.fetchTtsVoiceIds().catch(error => {
|
||||
await this.fetchTtsVoiceObjects().catch(error => {
|
||||
throw `TTS API key validation failed`
|
||||
})
|
||||
this.settings.apiKey = this.settings.apiKey
|
||||
|
@ -111,7 +111,7 @@ class ElevenLabsTtsProvider {
|
|||
|
||||
async getVoice(voiceName) {
|
||||
if (this.voices.length == 0) {
|
||||
this.voices = await this.fetchTtsVoiceIds()
|
||||
this.voices = await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
const match = this.voices.filter(
|
||||
elevenVoice => elevenVoice.name == voiceName
|
||||
|
@ -158,7 +158,7 @@ class ElevenLabsTtsProvider {
|
|||
//###########//
|
||||
// API CALLS //
|
||||
//###########//
|
||||
async fetchTtsVoiceIds() {
|
||||
async fetchTtsVoiceObjects() {
|
||||
const headers = {
|
||||
'xi-api-key': this.settings.apiKey
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { getRequestHeaders, callPopup } from "../../../script.js"
|
||||
import { getPreviewString } from "./index.js"
|
||||
import { onTtsProviderSettingsInput } from "./index.js"
|
||||
import { initVoiceMap } from "./index.js"
|
||||
|
||||
export { NovelTtsProvider }
|
||||
|
||||
|
@ -37,15 +37,13 @@ class NovelTtsProvider {
|
|||
return html;
|
||||
}
|
||||
|
||||
onSettingsChange() {
|
||||
onTtsProviderSettingsInput()
|
||||
}
|
||||
|
||||
// Add a new Novel custom voice to provider
|
||||
async addCustomVoice(){
|
||||
const voiceName = await callPopup('<h3>Custom Voice name:</h3>', 'input')
|
||||
this.settings.customVoices.push(voiceName)
|
||||
this.populateCustomVoices()
|
||||
initVoiceMap() // Update TTS extension voiceMap
|
||||
}
|
||||
|
||||
// Delete selected custom voice from provider
|
||||
|
@ -57,6 +55,7 @@ class NovelTtsProvider {
|
|||
this.settings.customVoices.splice(voiceIndex, 1);
|
||||
}
|
||||
this.populateCustomVoices()
|
||||
initVoiceMap() // Update TTS extension voiceMap
|
||||
}
|
||||
|
||||
// Create the UI dropdown list of voices in provider
|
||||
|
@ -66,7 +65,6 @@ class NovelTtsProvider {
|
|||
this.settings.customVoices.forEach(voice => {
|
||||
voiceSelect.append(`<option>${voice}</option>`)
|
||||
})
|
||||
this.onSettingsChange()
|
||||
}
|
||||
|
||||
loadSettings(settings) {
|
||||
|
@ -96,10 +94,10 @@ class NovelTtsProvider {
|
|||
// Perform a simple readiness check by trying to fetch voiceIds
|
||||
// Doesnt really do much for Novel, not seeing a good way to test this at the moment.
|
||||
async checkReady(){
|
||||
await this.fetchTtsVoiceIds()
|
||||
await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
|
||||
async onApplyClick() {
|
||||
async onRefreshClick() {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -123,7 +121,7 @@ class NovelTtsProvider {
|
|||
//###########//
|
||||
// API CALLS //
|
||||
//###########//
|
||||
async fetchTtsVoiceIds() {
|
||||
async fetchTtsVoiceObjects() {
|
||||
let voices = [
|
||||
{ name: 'Ligeia', voice_id: 'Ligeia', lang: 'en-US', preview_url: false },
|
||||
{ name: 'Aini', voice_id: 'Aini', lang: 'en-US', preview_url: false },
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { doExtrasFetch, getApiUrl, modules } from "../../extensions.js"
|
||||
import { onTtsProviderSettingsInput } from "./index.js"
|
||||
import { saveTtsProviderSettings } from "./index.js"
|
||||
|
||||
export { SileroTtsProvider }
|
||||
|
||||
|
@ -31,7 +31,7 @@ class SileroTtsProvider {
|
|||
onSettingsChange() {
|
||||
// Used when provider settings are updated from UI
|
||||
this.settings.provider_endpoint = $('#silero_tts_endpoint').val()
|
||||
onTtsProviderSettingsInput()
|
||||
saveTtsProviderSettings()
|
||||
}
|
||||
|
||||
loadSettings(settings) {
|
||||
|
@ -72,10 +72,10 @@ class SileroTtsProvider {
|
|||
|
||||
// Perform a simple readiness check by trying to fetch voiceIds
|
||||
async checkReady(){
|
||||
await this.fetchTtsVoiceIds()
|
||||
await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
|
||||
async onApplyClick() {
|
||||
async onRefreshClick() {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ class SileroTtsProvider {
|
|||
|
||||
async getVoice(voiceName) {
|
||||
if (this.voices.length == 0) {
|
||||
this.voices = await this.fetchTtsVoiceIds()
|
||||
this.voices = await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
const match = this.voices.filter(
|
||||
sileroVoice => sileroVoice.name == voiceName
|
||||
|
@ -104,7 +104,7 @@ class SileroTtsProvider {
|
|||
//###########//
|
||||
// API CALLS //
|
||||
//###########//
|
||||
async fetchTtsVoiceIds() {
|
||||
async fetchTtsVoiceObjects() {
|
||||
const response = await doExtrasFetch(`${this.settings.provider_endpoint}/speakers`)
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}: ${await response.json()}`)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { isMobile } from "../../RossAscends-mods.js";
|
||||
import { getPreviewString } from "./index.js";
|
||||
import { talkingAnimation } from './index.js';
|
||||
import { onTtsProviderSettingsInput } from "./index.js"
|
||||
import { saveTtsProviderSettings } from "./index.js"
|
||||
export { SystemTtsProvider }
|
||||
|
||||
/**
|
||||
|
@ -107,7 +107,7 @@ class SystemTtsProvider {
|
|||
this.settings.pitch = Number($('#system_tts_pitch').val());
|
||||
$('#system_tts_pitch_output').text(this.settings.pitch);
|
||||
$('#system_tts_rate_output').text(this.settings.rate);
|
||||
onTtsProviderSettingsInput()
|
||||
saveTtsProviderSettings()
|
||||
}
|
||||
|
||||
loadSettings(settings) {
|
||||
|
@ -156,17 +156,17 @@ class SystemTtsProvider {
|
|||
|
||||
// Perform a simple readiness check by trying to fetch voiceIds
|
||||
async checkReady(){
|
||||
await this.fetchTtsVoiceIds()
|
||||
await this.fetchTtsVoiceObjects()
|
||||
}
|
||||
|
||||
async onApplyClick() {
|
||||
async onRefreshClick() {
|
||||
return
|
||||
}
|
||||
|
||||
//#################//
|
||||
// TTS Interfaces //
|
||||
//#################//
|
||||
fetchTtsVoiceIds() {
|
||||
fetchTtsVoiceObjects() {
|
||||
if (!('speechSynthesis' in window)) {
|
||||
return [];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue