lint: Comma dangle

This commit is contained in:
Cohee
2023-12-02 22:06:57 +02:00
parent 08fedf3a96
commit 64a3564892
53 changed files with 388 additions and 384 deletions

View File

@ -37,7 +37,7 @@ const languageLabels = {
'en': 'English',
'fr': 'French',
'es': 'Spanish',
'ja': 'Japanese'
'ja': 'Japanese',
};
function throwIfModuleMissing() {
@ -64,7 +64,7 @@ class CoquiTtsProvider {
voiceMap: {},
customVoices: {},
voiceIds: [],
voiceMapDict: {}
voiceMapDict: {},
};
get settingsHtml() {
@ -341,7 +341,7 @@ class CoquiTtsProvider {
async getVoice(voiceName) {
let match = await this.fetchTtsVoiceObjects();
match = match.filter(
voice => voice.name == voiceName
voice => voice.name == voiceName,
)[0];
if (!match) {
throw `TTS Voice name ${voiceName} not found in CoquiTTS Provider voice list`;
@ -603,11 +603,11 @@ class CoquiTtsProvider {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache'
'Cache-Control': 'no-cache',
},
body: JSON.stringify({
'model_id': model_id,
})
}),
});
if (!apiResult.ok) {
@ -627,12 +627,12 @@ class CoquiTtsProvider {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache'
'Cache-Control': 'no-cache',
},
body: JSON.stringify({
'model_id': model_id,
'action': action
})
'action': action,
}),
});
if (!apiResult.ok) {
@ -655,12 +655,12 @@ class CoquiTtsProvider {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache'
'Cache-Control': 'no-cache',
},
body: JSON.stringify({
'model_id': 'model_id',
'action': 'action'
})
'action': 'action',
}),
});
if (!apiResult.ok) {
@ -708,14 +708,14 @@ class CoquiTtsProvider {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache'
'Cache-Control': 'no-cache',
},
body: JSON.stringify({
'text': text,
'model_id': model_id,
'language_id': parseInt(language),
'speaker_id': parseInt(speaker)
})
'speaker_id': parseInt(speaker),
}),
});
if (!apiResult.ok) {

View File

@ -79,7 +79,7 @@ class EdgeTtsProvider {
this.voices = await this.fetchTtsVoiceObjects();
}
const match = this.voices.filter(
voice => voice.name == voiceName
voice => voice.name == voiceName,
)[0];
if (!match) {
throw `TTS Voice name ${voiceName} not found`;
@ -142,8 +142,8 @@ class EdgeTtsProvider {
'text': inputText,
'voice': voiceId,
'rate': Number(this.settings.rate),
})
}
}),
},
);
if (!response.ok) {
toastr.error(response.statusText, 'TTS Generation Failed');

View File

@ -16,7 +16,7 @@ class ElevenLabsTtsProvider {
similarity_boost: 0.75,
apiKey: '',
model: 'eleven_monolingual_v1',
voiceMap: {}
voiceMap: {},
};
get settingsHtml() {
@ -129,7 +129,7 @@ class ElevenLabsTtsProvider {
this.voices = await this.fetchTtsVoiceObjects();
}
const match = this.voices.filter(
elevenVoice => elevenVoice.name == voiceName
elevenVoice => elevenVoice.name == voiceName,
)[0];
if (!match) {
throw `TTS Voice name ${voiceName} not found in ElevenLabs account`;
@ -175,10 +175,10 @@ class ElevenLabsTtsProvider {
//###########//
async fetchTtsVoiceObjects() {
const headers = {
'xi-api-key': this.settings.apiKey
'xi-api-key': this.settings.apiKey,
};
const response = await fetch('https://api.elevenlabs.io/v1/voices', {
headers: headers
headers: headers,
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
@ -189,13 +189,13 @@ class ElevenLabsTtsProvider {
async fetchTtsVoiceSettings() {
const headers = {
'xi-api-key': this.settings.apiKey
'xi-api-key': this.settings.apiKey,
};
const response = await fetch(
'https://api.elevenlabs.io/v1/voices/settings/default',
{
headers: headers
}
headers: headers,
},
);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
@ -212,7 +212,7 @@ class ElevenLabsTtsProvider {
method: 'POST',
headers: {
'xi-api-key': this.settings.apiKey,
'Content-Type': 'application/json'
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_id: model,
@ -221,8 +221,8 @@ class ElevenLabsTtsProvider {
stability: Number(this.settings.stability),
similarity_boost: Number(this.settings.similarity_boost),
},
})
}
}),
},
);
if (!response.ok) {
toastr.error(response.statusText, 'TTS Generation Failed');
@ -237,9 +237,9 @@ class ElevenLabsTtsProvider {
`https://api.elevenlabs.io/v1/history/${history_item_id}/audio`,
{
headers: {
'xi-api-key': this.settings.apiKey
}
}
'xi-api-key': this.settings.apiKey,
},
},
);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
@ -249,10 +249,10 @@ class ElevenLabsTtsProvider {
async fetchTtsHistory() {
const headers = {
'xi-api-key': this.settings.apiKey
'xi-api-key': this.settings.apiKey,
};
const response = await fetch('https://api.elevenlabs.io/v1/history', {
headers: headers
headers: headers,
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);

View File

@ -220,7 +220,7 @@ async function moduleWorker() {
currentMessageNumber = lastMessageNumber;
console.debug(
`Adding message from ${message.name} for TTS processing: "${message.mes}"`
`Adding message from ${message.name} for TTS processing: "${message.mes}"`,
);
ttsJobQueue.push(message);
}
@ -292,8 +292,8 @@ function debugTtsPlayback() {
'audioQueueProcessorReady': audioQueueProcessorReady,
'ttsJobQueue': ttsJobQueue,
'currentTtsJob': currentTtsJob,
'ttsConfig': extension_settings.tts
}
'ttsConfig': extension_settings.tts,
},
));
}
window.debugTtsPlayback = debugTtsPlayback;
@ -458,7 +458,7 @@ function saveLastValues() {
const context = getContext();
lastChatId = context.chatId;
lastMessageHash = getStringHash(
(context.chat.length && context.chat[context.chat.length - 1].mes) ?? ''
(context.chat.length && context.chat[context.chat.length - 1].mes) ?? '',
);
}
@ -559,7 +559,7 @@ function loadSettings() {
$('#tts_provider').val(extension_settings.tts.currentProvider);
$('#tts_enabled').prop(
'checked',
extension_settings.tts.enabled
extension_settings.tts.enabled,
);
$('#tts_narrate_dialogues').prop('checked', extension_settings.tts.narrate_dialogues_only);
$('#tts_narrate_quoted').prop('checked', extension_settings.tts.narrate_quoted_only);
@ -605,7 +605,7 @@ function onRefreshClick() {
function onEnableClick() {
extension_settings.tts.enabled = $('#tts_enabled').is(
':checked'
':checked',
);
updateUiAudioPlayState();
saveSettingsDebounced();

View File

@ -16,7 +16,7 @@ class NovelTtsProvider {
defaultSettings = {
voiceMap: {},
customVoices: []
customVoices: [],
};
/**
@ -155,7 +155,7 @@ class NovelTtsProvider {
// Add in custom voices to the map
let addVoices = this.settings.customVoices.map(voice =>
({ name: voice, voice_id: voice, lang: 'en-US', preview_url: false })
({ name: voice, voice_id: voice, lang: 'en-US', preview_url: false }),
);
voices = voices.concat(addVoices);
@ -188,8 +188,8 @@ class NovelTtsProvider {
body: JSON.stringify({
'text': inputText,
'voice': voiceId,
})
}
}),
},
);
if (!response.ok) {
toastr.error(response.statusText, 'TTS Generation Failed');

View File

@ -15,7 +15,7 @@ class SileroTtsProvider {
defaultSettings = {
provider_endpoint: 'http://localhost:8001/tts',
voiceMap: {}
voiceMap: {},
};
get settingsHtml() {
@ -94,7 +94,7 @@ class SileroTtsProvider {
this.voices = await this.fetchTtsVoiceObjects();
}
const match = this.voices.filter(
sileroVoice => sileroVoice.name == voiceName
sileroVoice => sileroVoice.name == voiceName,
)[0];
if (!match) {
throw `TTS Voice name ${voiceName} not found`;
@ -127,14 +127,14 @@ class SileroTtsProvider {
method: 'POST',
headers: {
'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', // Added this line to disable caching of file so new files are always played - Rolyat 7/7/23
},
body: JSON.stringify({
'text': inputText,
'speaker': voiceId,
'session': 'sillytavern'
})
}
'session': 'sillytavern',
}),
},
);
if (!response.ok) {
toastr.error(response.statusText, 'TTS Generation Failed');
@ -157,7 +157,7 @@ class SileroTtsProvider {
body: JSON.stringify({
'path': 'sillytavern',
}),
}
},
);
if (!response.ok && response.status !== 404) {

View File

@ -51,7 +51,7 @@ class XTTSTtsProvider {
defaultSettings = {
provider_endpoint: 'http://localhost:8020',
language: 'en',
voiceMap: {}
voiceMap: {},
};
get settingsHtml() {
@ -149,7 +149,7 @@ class XTTSTtsProvider {
this.voices = await this.fetchTtsVoiceObjects();
}
const match = this.voices.filter(
XTTSVoice => XTTSVoice.name == voiceName
XTTSVoice => XTTSVoice.name == voiceName,
)[0];
if (!match) {
throw `TTS Voice name ${voiceName} not found`;
@ -182,14 +182,14 @@ class XTTSTtsProvider {
method: 'POST',
headers: {
'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', // Added this line to disable caching of file so new files are always played - Rolyat 7/7/23
},
body: JSON.stringify({
'text': inputText,
'speaker_wav': voiceId,
'language': this.settings.language
})
}
'language': this.settings.language,
}),
},
);
if (!response.ok) {
toastr.error(response.statusText, 'TTS Generation Failed');