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

@ -159,7 +159,7 @@ async function captionExtras(base64Img) {
'Content-Type': 'application/json',
'Bypass-Tunnel-Reminder': 'bypass',
},
body: JSON.stringify({ image: base64Img })
body: JSON.stringify({ image: base64Img }),
});
if (!apiResult.ok) {
@ -179,7 +179,7 @@ async function captionLocal(base64Img) {
const apiResult = await fetch('/api/extra/caption', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ image: base64Img })
body: JSON.stringify({ image: base64Img }),
});
if (!apiResult.ok) {
@ -199,7 +199,7 @@ async function captionHorde(base64Img) {
const apiResult = await fetch('/api/horde/caption-image', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ image: base64Img })
body: JSON.stringify({ image: base64Img }),
});
if (!apiResult.ok) {

View File

@ -40,7 +40,7 @@ const DEFAULT_EXPRESSIONS = [
'remorse',
'sadness',
'surprise',
'neutral'
'neutral',
];
let expressionsList = null;
@ -325,14 +325,14 @@ async function setImage(img, path) {
expressionClone.addClass('expression-animating');
//fade the clone in
expressionClone.css({
opacity: 0
opacity: 0,
}).animate({
opacity: 1
opacity: 1,
}, duration)
//when finshed fading in clone, fade out the original
.promise().done(function () {
img.animate({
opacity: 0
opacity: 0,
}, duration);
//remove old expression
img.remove();
@ -1057,14 +1057,14 @@ async function setExpression(character, expression, force) {
expressionClone.addClass('expression-animating');
//fade the clone in
expressionClone.css({
opacity: 0
opacity: 0,
}).animate({
opacity: 1
opacity: 1,
}, duration)
//when finshed fading in clone, fade out the original
.promise().done(function () {
img.animate({
opacity: 0
opacity: 0,
}, duration);
//remove old expression
img.remove();
@ -1268,7 +1268,7 @@ async function onClickExpressionOverrideButton() {
const overridePath = String($('#expression_override').val());
const existingOverrideIndex = extension_settings.expressionOverrides.findIndex((e) =>
e.name == avatarFileName
e.name == avatarFileName,
);
// If the path is empty, delete the entry from overrides
@ -1397,7 +1397,7 @@ function setExpressionOverrideHtml(forceClear = false) {
}
const expressionOverride = extension_settings.expressionOverrides.find((e) =>
e.name == avatarFileName
e.name == avatarFileName,
);
if (expressionOverride && expressionOverride.path) {

View File

@ -70,7 +70,7 @@ async function initGallery(items, url) {
navigationPagination: { background: '#111', color: '#fff', colorHover: '#ccc', borderRadius: '4px' },
thumbnail: { background: '#444', backgroundImage: 'linear-gradient(315deg, #111 0%, #445 90%)', borderColor: '#000', borderRadius: '0px', labelOpacity: 1, labelBackground: 'rgba(34, 34, 34, 0)', titleColor: '#fff', titleBgColor: 'transparent', titleShadow: '', descriptionColor: '#ccc', descriptionBgColor: 'transparent', descriptionShadow: '', stackBackground: '#aaa' },
thumbnailIcon: { padding: '5px', color: '#fff', shadow: '' },
pagination: { background: '#181818', backgroundSelected: '#666', color: '#fff', borderRadius: '2px', shapeBorder: '3px solid var(--SmartThemeQuoteColor)', shapeColor: '#444', shapeSelectedColor: '#aaa' }
pagination: { background: '#181818', backgroundSelected: '#666', color: '#fff', borderRadius: '2px', shapeBorder: '3px solid var(--SmartThemeQuoteColor)', shapeColor: '#444', shapeSelectedColor: '#aaa' },
},
galleryDisplayMode: 'pagination',
fnThumbnailOpen: viewWithDragbox,
@ -135,11 +135,11 @@ async function showCharGallery() {
if (firstTime) {
await loadFileToDocument(
`${extensionFolderPath}nanogallery2.woff.min.css`,
'css'
'css',
);
await loadFileToDocument(
`${extensionFolderPath}jquery.nanogallery2.min.js`,
'js'
'js',
);
firstTime = false;
toastr.info('Images can also be found in the folder `user/images`', 'Drag and drop images onto the gallery to upload them', { timeOut: 6000 });
@ -187,7 +187,7 @@ async function uploadFile(file, url) {
// Create the payload
const payload = {
image: base64Data
image: base64Data,
};
// Add the ch_name from the provided URL (assuming it's the character name)
@ -198,13 +198,13 @@ async function uploadFile(file, url) {
// Merge headers with content-type for JSON
Object.assign(headers, {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
});
const response = await fetch('/uploadimage', {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
body: JSON.stringify(payload),
});
if (!response.ok) {
@ -244,7 +244,7 @@ $(document).ready(function () {
$('<option>', {
id: 'show_char_gallery',
text: 'Show Gallery',
})
}),
);
});

View File

@ -484,8 +484,8 @@ async function summarizeChatExtras(context) {
repetition_penalty: extension_settings.memory.repetitionPenalty,
temperature: extension_settings.memory.temperature,
length_penalty: extension_settings.memory.lengthPenalty,
}
})
},
}),
});
if (apiResult.ok) {

View File

@ -512,7 +512,7 @@ async function saveQuickReplyPreset() {
const response = await fetch('/savequickreply', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify(quickReplyPreset)
body: JSON.stringify(quickReplyPreset),
});
if (response.ok) {
@ -556,7 +556,7 @@ async function updateQuickReplyPreset() {
const response = await fetch('/savequickreply', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify(quickReplyPreset)
body: JSON.stringify(quickReplyPreset),
});
if (response.ok) {

View File

@ -3,7 +3,7 @@ import { extension_settings } from '../../extensions.js';
export {
regex_placement,
getRegexedString,
runRegexScript
runRegexScript,
};
const regex_placement = {
@ -11,12 +11,12 @@ const regex_placement = {
MD_DISPLAY: 0,
USER_INPUT: 1,
AI_OUTPUT: 2,
SLASH_COMMAND: 3
SLASH_COMMAND: 3,
};
const regex_replace_strategy = {
REPLACE: 0,
OVERLAY: 1
OVERLAY: 1,
};
// Originally from: https://github.com/IonicaBizau/regex-parser.js/blob/master/lib/index.js
@ -98,8 +98,8 @@ function runRegexScript(regexScript, rawString, { characterOverride } = {}) {
trimCapturedMatch ?? trimFencedMatch,
{
characterOverride,
replaceStrategy: regexScript.replaceStrategy ?? regex_replace_strategy.REPLACE
}
replaceStrategy: regexScript.replaceStrategy ?? regex_replace_strategy.REPLACE,
},
);
if (!newString) {
newString = rawString.replace(fencedMatch, subReplaceString);

View File

@ -203,7 +203,7 @@ async function onRegexEditorOpenClick(existingId) {
parseInt(editorHtml
.find('select[name="replace_strategy_select"]')
.find(':selected')
.val()) ?? 0
.val()) ?? 0,
};
saveRegexScript(newRegexScript, existingScriptIndex);

View File

@ -422,7 +422,7 @@ async function loadSettingOptions() {
loadModels(),
loadSchedulers(),
loadVaes(),
loadComfyWorkflows()
loadComfyWorkflows(),
]);
}
@ -888,7 +888,7 @@ async function validateComfyUrl() {
headers: getRequestHeaders(),
body: JSON.stringify({
url: extension_settings.sd.comfy_url,
})
}),
});
if (!result.ok) {
throw new Error('ComfyUI returned an error.');
@ -1163,7 +1163,7 @@ async function loadComfySamplers() {
headers: getRequestHeaders(),
body: JSON.stringify({
url: extension_settings.sd.comfy_url,
})
}),
});
if (!result.ok) {
throw new Error('ComfyUI returned an error.');
@ -1388,7 +1388,7 @@ async function loadComfyModels() {
headers: getRequestHeaders(),
body: JSON.stringify({
url: extension_settings.sd.comfy_url,
})
}),
});
if (!result.ok) {
throw new Error('ComfyUI returned an error.');
@ -1447,7 +1447,7 @@ async function loadComfySchedulers() {
headers: getRequestHeaders(),
body: JSON.stringify({
url: extension_settings.sd.comfy_url,
})
}),
});
if (!result.ok) {
throw new Error('ComfyUI returned an error.');
@ -1506,7 +1506,7 @@ async function loadComfyVaes() {
headers: getRequestHeaders(),
body: JSON.stringify({
url: extension_settings.sd.comfy_url,
})
}),
});
if (!result.ok) {
throw new Error('ComfyUI returned an error.');
@ -1529,7 +1529,7 @@ async function loadComfyWorkflows() {
headers: getRequestHeaders(),
body: JSON.stringify({
url: extension_settings.sd.comfy_url,
})
}),
});
if (!result.ok) {
throw new Error('ComfyUI returned an error.');
@ -2148,7 +2148,7 @@ async function generateComfyImage(prompt) {
prompt: `{
"prompt": ${workflow}
}`,
})
}),
});
return { format: 'png', data: await promptResult.text() };
}
@ -2426,7 +2426,7 @@ $('#sd_dropdown [id]').on('click', function () {
'sd_world': 'scene',
'sd_last': 'last',
'sd_raw_last': 'raw_last',
'sd_background': 'background'
'sd_background': 'background',
};
const param = idParamMap[id];

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');