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