Make less obtrusive

This commit is contained in:
Cohee
2023-11-28 19:24:26 +02:00
parent a1098a4f31
commit 16527710b3

View File

@ -144,26 +144,28 @@ class SileroTtsProvider {
} }
async initSession() { async initSession() {
console.info(`requesting new session`) console.info(`Silero TTS: requesting new session`);
try {
const response = await doExtrasFetch( const response = await doExtrasFetch(
`${this.settings.provider_endpoint}/session`, `${this.settings.provider_endpoint}/session`,
{ {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Cache-Control': 'no-cache' // Added this line to disable caching of file so new files are always played - Rolyat 7/7/23 'Cache-Control': 'no-cache',
}, },
body: JSON.stringify({ body: JSON.stringify({
"path": "sillytavern" "path": "sillytavern",
}) }),
} }
) )
if (!response.ok && response.status !== 404) { if (!response.ok && response.status !== 404) {
toastr.error(response.statusText, 'Fetching Session Failed');
throw new Error(`HTTP ${response.status}: ${await response.text()}`); throw new Error(`HTTP ${response.status}: ${await response.text()}`);
} }
return response } catch (error) {
console.info('Silero TTS: endpoint not available', error);
}
} }
// Interface not used by Silero TTS // Interface not used by Silero TTS