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,7 +2,9 @@
|
||||
"display_name": "TTS",
|
||||
"loading_order": 10,
|
||||
"requires": [],
|
||||
"optional": [],
|
||||
"optional": [
|
||||
"tts"
|
||||
],
|
||||
"js": "index.js",
|
||||
"css": "style.css",
|
||||
"author": "Ouoertheo#7264",
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { getApiUrl, modules } from "../../extensions.js"
|
||||
|
||||
export { SileroTtsProvider }
|
||||
|
||||
class SileroTtsProvider {
|
||||
@ -17,7 +19,8 @@ class SileroTtsProvider {
|
||||
let html = `
|
||||
<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}"/>
|
||||
<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
|
||||
}
|
||||
@ -44,7 +47,18 @@ class SileroTtsProvider {
|
||||
}
|
||||
}
|
||||
|
||||
$('#silero_tts_endpoint').text(this.settings.provider_endpoint)
|
||||
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').val(this.settings.provider_endpoint)
|
||||
console.info("Settings loaded")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user