mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add Silero TTS to Extras
This commit is contained in:
@ -2,10 +2,12 @@
|
|||||||
"display_name": "TTS",
|
"display_name": "TTS",
|
||||||
"loading_order": 10,
|
"loading_order": 10,
|
||||||
"requires": [],
|
"requires": [],
|
||||||
"optional": [],
|
"optional": [
|
||||||
|
"tts"
|
||||||
|
],
|
||||||
"js": "index.js",
|
"js": "index.js",
|
||||||
"css": "style.css",
|
"css": "style.css",
|
||||||
"author": "Ouoertheo#7264",
|
"author": "Ouoertheo#7264",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"homePage": "None"
|
"homePage": "None"
|
||||||
}
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
import { getApiUrl, modules } from "../../extensions.js"
|
||||||
|
|
||||||
export { SileroTtsProvider }
|
export { SileroTtsProvider }
|
||||||
|
|
||||||
class SileroTtsProvider {
|
class SileroTtsProvider {
|
||||||
@ -17,7 +19,8 @@ class SileroTtsProvider {
|
|||||||
let html = `
|
let html = `
|
||||||
<label for="silero_tts_endpoint">Provider Endpoint:</label>
|
<label for="silero_tts_endpoint">Provider Endpoint:</label>
|
||||||
<input id="silero_tts_endpoint" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.provider_endpoint}"/>
|
<input id="silero_tts_endpoint" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.provider_endpoint}"/>
|
||||||
<span> A simple Python Silero TTS Server can be found <a href="https://github.com/ouoertheo/silero-api-server">here</a>.</span>
|
<span>
|
||||||
|
<span>Use <a target="_blank" href="https://github.com/Cohee1207/SillyTavern-extras">SillyTavern Extras API</a> or <a target="_blank" href="https://github.com/ouoertheo/silero-api-server">Silero TTS Server</a>.</span>
|
||||||
`
|
`
|
||||||
return html
|
return html
|
||||||
}
|
}
|
||||||
@ -43,8 +46,19 @@ class SileroTtsProvider {
|
|||||||
throw `Invalid setting passed to TTS Provider: ${key}`
|
throw `Invalid setting passed to TTS Provider: ${key}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const apiCheckInterval = setInterval(() => {
|
||||||
|
// Use Extras API if TTS support is enabled
|
||||||
|
if (modules.includes('tts')) {
|
||||||
|
const baseUrl = new URL(getApiUrl());
|
||||||
|
baseUrl.pathname = '/api/tts';
|
||||||
|
this.settings.provider_endpoint = baseUrl.toString();
|
||||||
|
$('#silero_tts_endpoint').val(this.settings.provider_endpoint);
|
||||||
|
clearInterval(apiCheckInterval);
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
$('#silero_tts_endpoint').text(this.settings.provider_endpoint)
|
$('#silero_tts_endpoint').val(this.settings.provider_endpoint)
|
||||||
console.info("Settings loaded")
|
console.info("Settings loaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user