From 9c218455c49555777d14ae4ea3673411fb70d394 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:22:12 +0300 Subject: [PATCH] [chore] Run ESLint --- public/scripts/BulkEditOverlay.js | 10 ++++----- public/scripts/RossAscends-mods.js | 2 +- public/scripts/logprobs.js | 24 +++++++++++----------- public/scripts/openai.js | 2 +- src/endpoints/backends/text-completions.js | 8 ++++---- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/public/scripts/BulkEditOverlay.js b/public/scripts/BulkEditOverlay.js index fccf12da3..26b9fc5b3 100644 --- a/public/scripts/BulkEditOverlay.js +++ b/public/scripts/BulkEditOverlay.js @@ -266,7 +266,7 @@ class BulkTagPopupHandler { printTagList($('#bulkTagList'), { tags: () => this.getMutualTags(), tagOptions: { removable: true } }); // Tag input with resolvable list for the mutual tags to get redrawn, so that newly added tags get sorted correctly - createTagInput('#bulkTagInput', '#bulkTagList', { tags: () => this.getMutualTags(), tagOptions: { removable: true }}); + createTagInput('#bulkTagInput', '#bulkTagList', { tags: () => this.getMutualTags(), tagOptions: { removable: true } }); document.querySelector('#bulk_tag_popup_reset').addEventListener('click', this.resetTags.bind(this)); document.querySelector('#bulk_tag_popup_remove_mutual').addEventListener('click', this.removeMutual.bind(this)); @@ -291,7 +291,7 @@ class BulkTagPopupHandler { // Find mutual tags for multiple characters const allTags = this.characterIds.map(cid => getTagsList(getTagKeyForEntity(cid))); const mutualTags = allTags.reduce((mutual, characterTags) => - mutual.filter(tag => characterTags.some(cTag => cTag.id === tag.id)) + mutual.filter(tag => characterTags.some(cTag => cTag.id === tag.id)), ); this.currentMutualTags = mutualTags.sort(compareTagsForSort); @@ -587,7 +587,7 @@ class BulkEditOverlay { this.container.removeEventListener('mouseup', cancelHold); this.container.removeEventListener('touchend', cancelHold); }, - BulkEditOverlay.longPressDelay); + BulkEditOverlay.longPressDelay); }; handleLongPressEnd = (event) => { @@ -694,7 +694,7 @@ class BulkEditOverlay { } else { character.classList.remove(BulkEditOverlay.selectedClass); if (legacyBulkEditCheckbox) legacyBulkEditCheckbox.checked = false; - this.#selectedCharacters = this.#selectedCharacters.filter(item => String(characterId) !== item) + this.#selectedCharacters = this.#selectedCharacters.filter(item => String(characterId) !== item); } this.updateSelectedCount(); @@ -816,7 +816,7 @@ class BulkEditOverlay { Also delete the chat files `; - } + }; /** * Request user input before concurrently handle deletion diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index b007a0d7e..a6bebf3e4 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -263,7 +263,7 @@ async function RA_autoloadchat() { await selectCharacterById(String(active_character_id)); // Do a little tomfoolery to spoof the tag selector - const selectedCharElement = $(`#rm_print_characters_block .character_select[chid="${active_character_id}"]`) + const selectedCharElement = $(`#rm_print_characters_block .character_select[chid="${active_character_id}"]`); applyTagsOnCharacterSelect.call(selectedCharElement); } } diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index b2e682286..e87adf487 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -221,7 +221,7 @@ function onAlternativeClicked(tokenLogprobs, alternative) { } if (getGeneratingApi() === 'openai') { - return callPopup(`

Feature unavailable

Due to API limitations, rerolling a token is not supported with OpenAI. Try switching to a different API.

`, 'text'); + return callPopup('

Feature unavailable

Due to API limitations, rerolling a token is not supported with OpenAI. Try switching to a different API.

', 'text'); } const { messageLogprobs, continueFrom } = getActiveMessageLogprobData(); @@ -261,7 +261,7 @@ function onPrefixClicked() { function checkGenerateReady() { if (is_send_press) { - toastr.warning(`Please wait for the current generation to complete.`); + toastr.warning('Please wait for the current generation to complete.'); return false; } return true; @@ -292,13 +292,13 @@ function onToggleLogprobsPanel() { } else { logprobsViewer.addClass('resizing'); logprobsViewer.transition({ - opacity: 0.0, - duration: animation_duration, - }, - async function () { - await delay(50); - logprobsViewer.removeClass('resizing'); - }); + opacity: 0.0, + duration: animation_duration, + }, + async function () { + await delay(50); + logprobsViewer.removeClass('resizing'); + }); setTimeout(function () { logprobsViewer.hide(); }, animation_duration); @@ -407,7 +407,7 @@ export function saveLogprobsForActiveMessage(logprobs, continueFrom) { messageLogprobs: logprobs, continueFrom, hash: getMessageHash(chat[msgId]), - } + }; state.messageLogprobs.set(data.hash, data); @@ -458,7 +458,7 @@ function convertTokenIdLogprobsToText(input) { // Flatten unique token IDs across all logprobs const tokenIds = Array.from(new Set(input.flatMap(logprobs => - logprobs.topLogprobs.map(([token]) => token).concat(logprobs.token) + logprobs.topLogprobs.map(([token]) => token).concat(logprobs.token), ))); // Submit token IDs to tokenizer to get token text, then build ID->text map @@ -469,7 +469,7 @@ function convertTokenIdLogprobsToText(input) { input.forEach(logprobs => { logprobs.token = tokenIdText.get(logprobs.token); logprobs.topLogprobs = logprobs.topLogprobs.map(([token, logprob]) => - [tokenIdText.get(token), logprob] + [tokenIdText.get(token), logprob], ); }); } diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 8a71b89f0..7ce8c8c37 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -2264,7 +2264,7 @@ export class ChatCompletion { const shouldSquash = (message) => { return !excludeList.includes(message.identifier) && message.role === 'system' && !message.name; - } + }; if (shouldSquash(message)) { if (lastMessage && shouldSquash(lastMessage)) { diff --git a/src/endpoints/backends/text-completions.js b/src/endpoints/backends/text-completions.js index 8e0ebba8d..22806cbf0 100644 --- a/src/endpoints/backends/text-completions.js +++ b/src/endpoints/backends/text-completions.js @@ -516,7 +516,7 @@ llamacpp.post('/slots', jsonParser, async function (request, response) { const baseUrl = trimV1(request.body.server_url); let fetchResponse; - if (request.body.action === "info") { + if (request.body.action === 'info') { fetchResponse = await fetch(`${baseUrl}/slots`, { method: 'GET', timeout: 0, @@ -525,16 +525,16 @@ llamacpp.post('/slots', jsonParser, async function (request, response) { if (!/^\d+$/.test(request.body.id_slot)) { return response.sendStatus(400); } - if (request.body.action !== "erase" && !request.body.filename) { + if (request.body.action !== 'erase' && !request.body.filename) { return response.sendStatus(400); } - + fetchResponse = await fetch(`${baseUrl}/slots/${request.body.id_slot}?action=${request.body.action}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, timeout: 0, body: JSON.stringify({ - filename: request.body.action !== "erase" ? `${request.body.filename}` : undefined, + filename: request.body.action !== 'erase' ? `${request.body.filename}` : undefined, }), }); }