Chore: Add code formatting conventions as eslint rules (#5158) * Add code formatting conventions as eslint rules * Improve formatting in addQuickReply

357da3219b6686616c3435524fa23ac987eff840

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
94 files changed, +32 -232Showing whitespace changes
.eslintrc.cjs+23 -0
@@ -102,5 +102,28 @@ module.exports = {
102102 // These rules should eventually be enabled.
103103 'no-async-promise-executor': 'off',
104104 'no-inner-declarations': 'off',
105+ 'brace-style': 'off',
106+ // Additional formatting rules based on codebase conventions
107+ 'array-bracket-spacing': ['error', 'never'],
108+ 'computed-property-spacing': ['error', 'never'],
109+ 'block-spacing': ['error', 'always'],
110+ 'keyword-spacing': ['error', { before: true, after: true }],
111+ 'space-before-blocks': ['error', 'always'],
112+ 'space-before-function-paren': ['error', { anonymous: 'always', named: 'never', asyncArrow: 'always' }],
113+ 'space-in-parens': ['error', 'never'],
114+ 'comma-spacing': ['error', { before: false, after: true }],
115+ 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
116+ 'func-call-spacing': ['error', 'never'],
117+ 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }],
118+ 'padded-blocks': ['error', 'never'],
119+ 'no-whitespace-before-property': 'error',
120+ 'space-unary-ops': ['error', { words: true, nonwords: false }],
121+ 'arrow-spacing': ['error', { before: true, after: true }],
122+ 'template-curly-spacing': ['error', 'never'],
123+ 'rest-spread-spacing': ['error', 'never'],
124+ 'generator-star-spacing': ['error', { before: false, after: true }],
125+ 'yield-star-spacing': ['error', { before: false, after: true }],
126+ 'template-tag-spacing': ['error', 'never'],
127+ 'switch-colon-spacing': ['error', { after: true, before: false }],
105128 },
106129};
public/script.js+2 -14
@@ -2516,7 +2516,6 @@ export function addOneMessage(mes, { type = undefined, insertAfter = null, scrol
25162516 * @returns {JQuery<HTMLElement>} Rendered HTMLElement.
25172517 */
25182518export function updateMessageElement(mes, { messageId = chat.length - 1, messageElement = messageTemplate.clone(), adjustMediaScroll = SCROLL_BEHAVIOR.NONE } = {}) {
2519-
25202519 let avatarImg = getThumbnailUrl('persona', user_avatar);
25212520
25222521 //for non-user messages
@@ -3709,9 +3708,9 @@ class StreamingProcessor {
37093708 }
37103709
37113710 /**
37123711 * @returns {GeneratorAsyncGenerator<{ text: string, swipes: string[], logprobs: import('./scripts/logprobs.js').TokenLogprobs, toolCalls: any[], state: any }, void, void>}
37133712 */
37143713 async* nullStreamingGeneration() {
37153714 throw new Error('Generation function for streaming is not hooked up');
37163715 }
37173716
@@ -4862,7 +4861,6 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
48624861
48634862 // Add quiet generation prompt at depth 0
48644863 if (quiet_prompt && quiet_prompt.length) {
4865-
48664864 // here name1 is forced for all quiet prompts..why?
48674865 const name = name1;
48684866 //checks if we are in instruct, if so, formats the chat as such, otherwise just adds the quiet prompt
@@ -5399,7 +5397,6 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
53995397 if (!isAborted && power_user.auto_swipe && generatedTextFiltered(getMessage)) {
54005398 is_send_press = false;
54015399 return await swipe(null, SWIPE_DIRECTION.RIGHT, { source: SWIPE_SOURCE.AUTO_SWIPE, repeated: true, forceMesId: chat.length - 1 });
5402-
54035400 }
54045401
54055402 console.debug('/api/chats/save called by /Generate');
@@ -6517,7 +6514,6 @@ export async function saveReply({ type, getMessage, fromStreaming = false, title
65176514 !fromStreaming && await eventSource.emit(event_types.MESSAGE_RECEIVED, chat_id, type);
65186515 addOneMessage(chat[chat_id], { type: 'swipe' });
65196516 !fromStreaming && await eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, chat_id, type);
6520-
65216517 } else {
65226518 console.debug('entering chat update routine for non-swipe post');
65236519 const newMessage = {};
@@ -8247,7 +8243,6 @@ export async function getChatsFromFiles(data, isGroupChat) {
82478243 currentChat.shift();
82488244 }
82498245 chat_dict[file_name] = currentChat;
8250-
82518246 } catch (error) {
82528247 console.error(error);
82538248 }
@@ -9588,7 +9583,6 @@ export async function createOrEditCharacter(e) {
95889583 select_rm_info('char_create', avatarId, oldSelectedChar);
95899584
95909585 crop_data = undefined;
9591-
95929586 } catch (error) {
95939587 console.error('Error creating character', error);
95949588 toastr.error(t`Failed to create character`);
@@ -9984,7 +9978,6 @@ export async function swipe(event, direction, { source, repeated, message = chat
99849978 duration: 0, //used to be 100 //Disabled on Cohee's request. https://github.com/SillyTavern/SillyTavern/pull/4610/files#r2408731744
99859979 queue: false,
99869980 progress: function (animation, progress, remainingMs) {
9987-
99889981 if (is_animation_scroll) chatElement.scrollTop(getMessageBottomHeight(thisMesDiv));
99899982 },
99909983 complete: function () {
@@ -10001,7 +9994,6 @@ export async function swipe(event, direction, { source, repeated, message = chat
100019994 * @param {boolean} [skipSwipeOut=false]
100029995 */
100039996 async function animateSwipe(run_generate = false, skipSwipeOut = false) {
10004-
100059997 if (!skipSwipeOut) {
100069998 //Swipe out.
100079999 await animateSwipeTransition(mesId, { xEnd: `${swipeRange}px`, duration: swipeDuration });
@@ -10069,7 +10061,6 @@ export async function swipe(event, direction, { source, repeated, message = chat
1006910061
1007010062 //If the swipe is not being deleted.
1007110063 if (source != SWIPE_SOURCE.DELETE && source != SWIPE_SOURCE.BACK) {
10072-
1007310064 // Make sure ad-hoc changes to extras are saved before swiping away
1007410065 syncMesToSwipe(mesId);
1007510066
@@ -10382,7 +10373,6 @@ export async function doNewChat({ deleteCurrentChat = false } = {}) {
1038210373 await createOrEditCharacter(new CustomEvent('newChat'));
1038310374 if (deleteCurrentChat) await delChat(chat_file_for_del + '.jsonl');
1038410375 }
10385-
1038610376}
1038710377
1038810378/**
@@ -11407,9 +11397,7 @@ jQuery(async function () {
1140711397
1140811398 divchat.style.borderRadius = '';
1140911399 divchat.style.backgroundColor = '';
11410-
1141111400 } else {
11412-
1141311401 divchat.style.borderRadius = '10px'; // Adjust the value to control the roundness of the corners
1141411402 divchat.style.backgroundColor = ''; // Set the background color to your preference
1141511403
public/scripts/BulkEditOverlay.js+0 -0
public/scripts/PromptManager.js+0 -2
@@ -986,7 +986,6 @@ class PromptManager {
986986 * @returns {void}
987987 */
988988 addPrompt(prompt, identifier) {
989-
990989 if (typeof prompt !== 'object' || prompt === null) throw new Error('Object is not a prompt');
991990
992991 const newPrompt = {
@@ -1318,7 +1317,6 @@ class PromptManager {
13181317 this.updatePromptByIdentifier(identifier, prompt);
13191318 debouncedSaveServiceSettings().then(() => this.render());
13201319 });
1321-
13221320 }
13231321
13241322 /**
public/scripts/RossAscends-mods.js+0 -3
@@ -101,7 +101,6 @@ observer.observe(document.documentElement, observerConfig);
101101 * @returns {string} - A human-readable string that represents the time spent generating characters.
102102 */
103103export function humanizeGenTime(total_gen_time) {
104-
105104 //convert time_spent to humanized format of "_ Hours, _ Minutes, _ Seconds" from milliseconds
106105 let time_spent = total_gen_time || 0;
107106 time_spent = Math.floor(time_spent / 1000);
@@ -1274,8 +1273,6 @@ export function initRossMods() {
12741273 }
12751274
12761275
1277-
1278-
12791276 if (event.ctrlKey && /^[1-9]$/.test(event.key)) {
12801277 // This will eventually be to trigger quick replies
12811278 // event.preventDefault();
public/scripts/autocomplete/AutoComplete.js+0 -5
@@ -80,8 +80,6 @@ export class AutoComplete {
8080 }
8181
8282
83-
84-
8583 /**
8684 * @param {HTMLTextAreaElement|HTMLInputElement} textarea The textarea to receive autocomplete.
8785 * @param {() => boolean} checkIfActivate Function should return true only if under the current conditions, autocomplete should display (e.g., for slash commands: autoComplete.text[0] == '/')
@@ -414,7 +412,6 @@ export class AutoComplete {
414412 });
415413
416414
417-
418415 if (this.isForceHidden) {
419416 // hidden with escape
420417 return this.hide();
@@ -465,7 +462,6 @@ export class AutoComplete {
465462 }
466463
467464
468-
469465 /**
470466 * Create updated DOM.
471467 */
@@ -514,7 +510,6 @@ export class AutoComplete {
514510 }
515511
516512
517-
518513 /**
519514 * Update position of DOM.
520515 */
public/scripts/autocomplete/AutoCompleteFuzzyScore.js+0 -3
@@ -1,6 +1,3 @@
1-
2-
3-
41export class AutoCompleteFuzzyScore {
52 /**@type {number}*/ start;
63 /**@type {number}*/ longestConsecutive;
public/scripts/autocomplete/AutoCompleteNameResult.js+0 -1
@@ -2,7 +2,6 @@ import { AutoCompleteNameResultBase } from './AutoCompleteNameResultBase.js';
22import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js';
33
44
5-
65export class AutoCompleteNameResult extends AutoCompleteNameResultBase {
76 /**
87 *
public/scripts/autocomplete/AutoCompleteNameResultBase.js+0 -1
@@ -1,7 +1,6 @@
11import { AutoCompleteOption } from './AutoCompleteOption.js';
22
33
4-
54export class AutoCompleteNameResultBase {
65 /**@type {string} */ name;
76 /**@type {number} */ start;
public/scripts/autocomplete/AutoCompleteOption.js+0 -1
@@ -1,7 +1,6 @@
11import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';
22
33
4-
54export class AutoCompleteOption {
65 /** @type {string} */ name;
76 /** @type {string} */ typeIcon;
public/scripts/bulk-edit.js+0 -0
public/scripts/cfg-scale.js+0 -1
@@ -150,7 +150,6 @@ function onCfgMenuItemClick() {
150150 setTimeout(function () {
151151 $('#cfgConfig').hide();
152152 }, animation_duration);
153-
154153 }
155154 //duplicate options menu close handler from script.js
156155 //because this listener takes priority
public/scripts/chat-backups.js+0 -0
public/scripts/data-maid.js+0 -1
@@ -251,7 +251,6 @@ class DataMaidDialog {
251251 categoryElement.remove();
252252 this.displayEmptyPlaceholder();
253253 });
254-
255254 });
256255 categoryElement.querySelectorAll('.dataMaidItemDelete').forEach(button => {
257256 button.addEventListener('click', async () => {
public/scripts/extensions/assets/index.js+0 -1
@@ -95,7 +95,6 @@ async function downloadAssetsList(url) {
9595 fetch(url, { cache: 'no-cache' })
9696 .then(response => response.json())
9797 .then(async function (json) {
98-
9998 availableAssets = {};
10099 $('#assets_menu').empty();
101100
public/scripts/extensions/expressions/index.js+0 -2
@@ -1414,7 +1414,6 @@ export async function getExpressionsList({ filterAvailable = false } = {}) {
14141414 });
14151415
14161416 if (apiResult.ok) {
1417-
14181417 const data = await apiResult.json();
14191418 expressionsList = data.labels;
14201419 return expressionsList;
@@ -1488,7 +1487,6 @@ function chooseSpriteForExpression(spriteFolderName, expression, { prevExpressio
14881487 }
14891488
14901489 return spriteFile;
1491-
14921490}
14931491
14941492/**
public/scripts/extensions/gallery/index.js+0 -1
@@ -791,7 +791,6 @@ async function listGalleryCommand(args) {
791791
792792 const items = await getGalleryItems(url);
793793 return JSON.stringify(items.map(it => it.src));
794-
795794 } catch (err) {
796795 console.error(err);
797796 }
public/scripts/extensions/quick-reply/api/QuickReplyApi.js+0 -6
@@ -10,16 +10,12 @@ export class QuickReplyApi {
1010 /** @type {SettingsUi} */ settingsUi;
1111
1212
13-
14-
1513 constructor(/** @type {QuickReplySettings} */settings, /** @type {SettingsUi} */settingsUi) {
1614 this.settings = settings;
1715 this.settingsUi = settingsUi;
1816 }
1917
2018
21-
22-
2319 /**
2420 * @param {QuickReply} qr
2521 * @returns {QuickReplySet}
@@ -53,8 +49,6 @@ export class QuickReplyApi {
5349 }
5450
5551
56-
57-
5852 /**
5953 * Executes a quick reply by its index and returns the result.
6054 *
public/scripts/extensions/quick-reply/index.js+0 -4
@@ -14,8 +14,6 @@ import { selected_group } from '../../group-chats.js';
1414export { debounceAsync };
1515
1616
17-
18-
1917const _VERBOSE = true;
2018export const debug = (...msg) => _VERBOSE ? console.debug('[QR2]', ...msg) : null;
2119export const log = (...msg) => _VERBOSE ? console.log('[QR2]', ...msg) : null;
@@ -54,8 +52,6 @@ let autoExec;
5452export let quickReplyApi;
5553
5654
57-
58-
5955const loadSets = async () => {
6056 const response = await fetch('/api/settings/get', {
6157 method: 'POST',
public/scripts/extensions/quick-reply/src/AutoExecuteHandler.js+0 -4
@@ -8,8 +8,6 @@ export class AutoExecuteHandler {
88 /** @type {Boolean[]}*/ preventAutoExecuteStack = [];
99
1010
11-
12-
1311 constructor(/** @type {QuickReplySettings} */settings) {
1412 this.settings = settings;
1513 }
@@ -20,8 +18,6 @@ export class AutoExecuteHandler {
2018 }
2119
2220
23-
24-
2521 async performAutoExecute(/** @type {QuickReply[]} */qrList) {
2622 for (const qr of qrList) {
2723 this.preventAutoExecuteStack.push(qr.preventAutoExecute);
public/scripts/extensions/quick-reply/src/QuickReply.js+0 -10
@@ -27,8 +27,6 @@ export class QuickReply {
2727 }
2828
2929
30-
31-
3230 /**@type {number}*/ id;
3331 /**@type {string}*/ icon;
3432 /**@type {string}*/ label = '';
@@ -89,8 +87,6 @@ export class QuickReply {
8987 }
9088
9189
92-
93-
9490 unrender() {
9591 this.dom?.remove();
9692 this.dom = null;
@@ -169,8 +165,6 @@ export class QuickReply {
169165 }
170166
171167
172-
173-
174168 renderSettings(idx) {
175169 if (!this.settingsDom) {
176170 const item = document.createElement('div'); {
@@ -1769,8 +1763,6 @@ export class QuickReply {
17691763 }
17701764
17711765
1772-
1773-
17741766 delete() {
17751767 if (this.onDelete) {
17761768 this.unrender();
@@ -1908,8 +1900,6 @@ export class QuickReply {
19081900 }
19091901
19101902
1911-
1912-
19131903 toJSON() {
19141904 return {
19151905 id: this.id,
public/scripts/extensions/quick-reply/src/QuickReplyConfig.js+0 -8
@@ -13,8 +13,6 @@ export class QuickReplyConfig {
1313 /**@type {HTMLElement}*/ setListDom;
1414
1515
16-
17-
1816 static from(props) {
1917 props.setList = props.setList?.map(it => QuickReplySetLink.from(it))?.filter(it => it.set) ?? [];
2018 const instance = Object.assign(new this(), props);
@@ -23,8 +21,6 @@ export class QuickReplyConfig {
2321 }
2422
2523
26-
27-
2824 init() {
2925 this.setList.forEach(it => this.hookQuickReplyLink(it));
3026 }
@@ -54,8 +50,6 @@ export class QuickReplyConfig {
5450 }
5551
5652
57-
58-
5953 renderSettingsInto(/**@type {HTMLElement}*/root) {
6054 /**@type {HTMLElement}*/
6155 this.setListDom = root.querySelector('.qr--setList');
@@ -91,8 +85,6 @@ export class QuickReplyConfig {
9185 }
9286
9387
94-
95-
9688 /**
9789 * @param {QuickReplySetLink} qrl
9890 */
public/scripts/extensions/quick-reply/src/QuickReplyContextLink.js+0 -2
@@ -8,8 +8,6 @@ export class QuickReplyContextLink {
88 }
99
1010
11-
12-
1311 /**@type {QuickReplySet}*/ set;
1412 /**@type {Boolean}*/ isChained = false;
1513
public/scripts/extensions/quick-reply/src/QuickReplySet.js+1 -2
@@ -209,8 +209,7 @@ export class QuickReplySet {
209209
210210 addQuickReply(data = {}) {
211211 const id = Math.max(this.idIndex, this.qrList.reduce((max, qr) => Math.max(max, qr.id), 0)) + 1;
212- data.id =
212+ data.id = this.idIndex = id + 1;
213- this.idIndex = id + 1;
214213 const qr = QuickReply.from(data);
215214 this.qrList.push(qr);
216215 this.hookQuickReply(qr);
public/scripts/extensions/quick-reply/src/QuickReplySetLink.js+0 -8
@@ -9,8 +9,6 @@ export class QuickReplySetLink {
99 }
1010
1111
12-
13-
1412 /**@type {QuickReplySet}*/ set;
1513 /**@type {Boolean}*/ isVisible = true;
1614
@@ -23,8 +21,6 @@ export class QuickReplySetLink {
2321 /**@type {HTMLElement}*/ settingsDom;
2422
2523
26-
27-
2824 renderSettings(idx) {
2925 this.index = idx;
3026 const item = document.createElement('div'); {
@@ -98,8 +94,6 @@ export class QuickReplySetLink {
9894 }
9995
10096
101-
102-
10397 update() {
10498 if (this.onUpdate) {
10599 this.onUpdate(this);
@@ -118,8 +112,6 @@ export class QuickReplySetLink {
118112 }
119113
120114
121-
122-
123115 toJSON() {
124116 return {
125117 set: this.set.name,
public/scripts/extensions/quick-reply/src/QuickReplySettings.js+0 -6
@@ -15,8 +15,6 @@ export class QuickReplySettings {
1515 }
1616
1717
18-
19-
2018 /**@type {Boolean}*/ isEnabled = false;
2119 /**@type {Boolean}*/ isCombined = false;
2220 /**@type {Boolean}*/ isPopout = false;
@@ -50,8 +48,6 @@ export class QuickReplySettings {
5048 /**@type {Function}*/ onRequestEditSet;
5149
5250
53-
54-
5551 init() {
5652 this.hookConfig(this.config);
5753 this.hookConfig(this.chatConfig);
@@ -72,8 +68,6 @@ export class QuickReplySettings {
7268 }
7369
7470
75-
76-
7771 save() {
7872 extension_settings.quickReplyV2 = this.toJSON();
7973 saveSettingsDebounced();
public/scripts/extensions/quick-reply/src/SlashCommandHandler.js+0 -8
@@ -16,15 +16,11 @@ export class SlashCommandHandler {
1616 /** @type {QuickReplyApi} */ api;
1717
1818
19-
20-
2119 constructor(/** @type {QuickReplyApi} */api) {
2220 this.api = api;
2321 }
2422
2523
26-
27-
2824 init() {
2925 function getExecutionIcons(/** @type {QuickReply} */ qr) {
3026 let icons = '';
@@ -783,8 +779,6 @@ export class SlashCommandHandler {
783779 }
784780
785781
786-
787-
788782 getSetByName(name) {
789783 const set = this.api.getSetByName(name);
790784 if (!set) {
@@ -802,8 +796,6 @@ export class SlashCommandHandler {
802796 }
803797
804798
805-
806-
807799 async executeQuickReplyByIndex(idx) {
808800 try {
809801 return await this.api.executeQuickReplyByIndex(idx);
public/scripts/extensions/quick-reply/src/ui/ButtonUi.js+0 -8
@@ -10,15 +10,11 @@ export class ButtonUi {
1010 /**@type {HTMLElement}*/ popoutDom;
1111
1212
13-
14-
1513 constructor(/**@type {QuickReplySettings}*/settings) {
1614 this.settings = settings;
1715 }
1816
1917
20-
21-
2218 render() {
2319 if (this.settings.isPopout) {
2420 return this.renderPopout();
@@ -57,8 +53,6 @@ export class ButtonUi {
5753 }
5854
5955
60-
61-
6256 renderBar() {
6357 if (!this.dom) {
6458 let buttonHolder;
@@ -100,8 +94,6 @@ export class ButtonUi {
10094 }
10195
10296
103-
104-
10597 renderPopout() {
10698 if (!this.popoutDom) {
10799 let buttonHolder;
public/scripts/extensions/quick-reply/src/ui/SettingsUi.js+0 -8
@@ -29,18 +29,12 @@ export class SettingsUi {
2929 /**@type {HTMLSelectElement}*/ currentSet;
3030
3131
32-
33-
3432 constructor(/**@type {QuickReplySettings}*/settings) {
3533 this.settings = settings;
3634 settings.onRequestEditSet = (qrs) => this.selectQrSet(qrs);
3735 }
3836
3937
40-
41-
42-
43-
4438 rerender() {
4539 if (!this.dom) return;
4640 const content = this.dom.querySelector('.inline-drawer-content');
@@ -256,8 +250,6 @@ export class SettingsUi {
256250 }
257251
258252
259-
260-
261253 async onIsEnabled() {
262254 this.settings.isEnabled = this.isEnabled.checked;
263255 this.settings.save();
public/scripts/extensions/quick-reply/src/ui/ctx/ContextMenu.js+0 -4
@@ -11,8 +11,6 @@ export class ContextMenu {
1111 /**@type {HTMLElement}*/ menu;
1212
1313
14-
15-
1614 constructor(/**@type {QuickReply}*/qr) {
1715 // this.itemList = items;
1816 this.itemList = this.build(qr).children;
@@ -104,8 +102,6 @@ export class ContextMenu {
104102 }
105103
106104
107-
108-
109105 show({ clientX, clientY }) {
110106 if (this.isActive) return;
111107 this.isActive = true;
public/scripts/extensions/quick-reply/src/ui/ctx/MenuItem.js+0 -3
@@ -15,8 +15,6 @@ export class MenuItem {
1515 /**@type {function}*/ onExpand;
1616
1717
18-
19-
2018 /**
2119 *
2220 * @param {?string} icon
@@ -80,7 +78,6 @@ export class MenuItem {
8078 }
8179 item.addEventListener('mouseover', () => sub.show(item));
8280 item.addEventListener('mouseleave', () => sub.hide());
83-
8481 }
8582 }
8683 }
public/scripts/extensions/quick-reply/src/ui/ctx/SubMenu.js+0 -4
@@ -9,8 +9,6 @@ export class SubMenu {
99 /**@type {HTMLElement}*/ root;
1010
1111
12-
13-
1412 constructor(/**@type {MenuItem[]}*/items) {
1513 this.itemList = items;
1614 }
@@ -29,8 +27,6 @@ export class SubMenu {
2927 }
3028
3129
32-
33-
3430 show(/**@type {HTMLElement}*/parent) {
3531 if (this.isActive) return;
3632 this.isActive = true;
public/scripts/extensions/regex/index.js+0 -1
@@ -1031,7 +1031,6 @@ function executeRegexScriptForDebugging(script, text) {
10311031 const trailingText = text.substring(lastIndex);
10321032 outputText += trailingText;
10331033 highlightedOutput += escapeHtml(trailingText);
1034-
10351034 } catch (e) {
10361035 err = (err ? err + '; ' : '') + `Replace error: ${e.message}`;
10371036 outputText = text; // Fallback
public/scripts/extensions/token-counter/index.js+0 -1
@@ -115,5 +115,4 @@ jQuery(() => {
115115 returns: 'number of tokens',
116116 helpString: 'Counts the number of tokens in the current chat.',
117117 }));
118-
119118});
public/scripts/extensions/tts/alltalk.js+0 -1
@@ -1043,7 +1043,6 @@ class AllTalkTtsProvider {
10431043 // V2: Combine the endpoint with the relative path
10441044 return `${this.settings.provider_endpoint}${data.output_file_url}`;
10451045 }
1046-
10471046 } catch (error) {
10481047 console.error('[fetchTtsGeneration] Exception caught:', error);
10491048 throw error;
public/scripts/extensions/tts/chatterbox.js+0 -3
@@ -239,7 +239,6 @@ class ChatterboxTtsProvider {
239239 }
240240
241241 this.setupEventListeners();
242-
243242 } catch (error) {
244243 console.error('Error loading Chatterbox settings:', error);
245244 this.updateStatus('Offline');
@@ -518,7 +517,6 @@ class ChatterboxTtsProvider {
518517 });
519518
520519 await audio.play();
521-
522520 } catch (error) {
523521 console.error('Error previewing voice:', error);
524522 this.updateStatus('Ready');
@@ -627,7 +625,6 @@ class ChatterboxTtsProvider {
627625
628626 // Return the response directly - SillyTavern expects a Response object
629627 return response;
630-
631628 } catch (error) {
632629 console.error('Error in generateTts:', error);
633630 this.updateStatus('Ready');
public/scripts/extensions/tts/coqui.js+0 -1
@@ -583,7 +583,6 @@ class CoquiTtsProvider {
583583 $('#coqui_api_model_install_button').show();
584584 return;
585585 }
586-
587586 }
588587
589588
public/scripts/extensions/tts/cosyvoice.js+0 -6
@@ -110,15 +110,11 @@ class CosyVoiceProvider {
110110 //#################//
111111
112112 async getVoice(voiceName) {
113-
114-
115-
116113 if (this.voices.length == 0) {
117114 this.voices = await this.fetchTtsVoiceObjects();
118115 }
119116
120117
121-
122118 const match = this.voices.filter(
123119 v => v.name == voiceName,
124120 )[0];
@@ -130,7 +126,6 @@ class CosyVoiceProvider {
130126 }
131127
132128
133-
134129 async generateTts(text, voiceId) {
135130 const response = await this.fetchTtsGeneration(text, voiceId);
136131 return response;
@@ -198,7 +193,6 @@ class CosyVoiceProvider {
198193 }
199194
200195
201-
202196 // Interface not used
203197 async fetchTtsFromHistory(history_item_id) {
204198 return Promise.resolve(history_item_id);
public/scripts/extensions/tts/elevenlabs.js+0 -0
public/scripts/extensions/tts/google-native.js+0 -2
@@ -124,7 +124,6 @@ export class GoogleNativeTtsProvider {
124124 console.info(`Google TTS: Loaded ${this.voices.length} voices`);
125125
126126 return this.voices;
127-
128127 } catch (error) {
129128 console.error('Failed to fetch Google TTS voices:', error);
130129 throw error;
@@ -151,7 +150,6 @@ export class GoogleNativeTtsProvider {
151150 this.audioElement.src = url;
152151 this.audioElement.play();
153152 this.audioElement.onended = () => URL.revokeObjectURL(url);
154-
155153 } catch (error) {
156154 console.error('TTS Preview Error:', error);
157155 toastr.error(`Could not generate preview: ${error.message}`);
public/scripts/extensions/tts/gpt-sovits-v2.js+0 -8
@@ -115,15 +115,11 @@ class GptSovitsV2Provider {
115115 //#################//
116116
117117 async getVoice(voiceName) {
118-
119-
120-
121118 if (this.voices.length == 0) {
122119 this.voices = await this.fetchTtsVoiceObjects();
123120 }
124121
125122
126-
127123 const match = this.voices.filter(
128124 v => v.name == voiceName,
129125 )[0];
@@ -135,7 +131,6 @@ class GptSovitsV2Provider {
135131 }
136132
137133
138-
139134 async generateTts(text, voiceId) {
140135 const response = await this.fetchTtsGeneration(text, voiceId);
141136 return response;
@@ -171,8 +166,6 @@ class GptSovitsV2Provider {
171166 */
172167
173168
174-
175-
176169 async fetchTtsGeneration(inputText, voiceId, lang = null, forceNoStreaming = false) {
177170 console.info(`Generating new TTS for voice_id ${voiceId}`);
178171
@@ -215,7 +208,6 @@ class GptSovitsV2Provider {
215208 }
216209
217210
218-
219211 // Interface not used
220212 async fetchTtsFromHistory(history_item_id) {
221213 return Promise.resolve(history_item_id);
public/scripts/extensions/tts/gsvi.js+0 -9
@@ -1,4 +1,3 @@
1-
21import { saveTtsProviderSettings } from './index.js';
32
43export { GSVITtsProvider };
@@ -60,11 +59,9 @@ class GSVITtsProvider {
6059 const characterList = await response.json();
6160 this.characterList = characterList;
6261 this.voices = Object.keys(characterList);
63-
6462 }
6563
6664
67-
6865 get settingsHtml() {
6966 let html = `
7067 <label for="gsvi_api_language">Text Language</label>
@@ -142,11 +139,8 @@ class GSVITtsProvider {
142139 $('#gsvi_batch_size_output').text(this.settings.batch_size);
143140
144141
145-
146-
147142 // Persist settings changes
148143 saveTtsProviderSettings();
149-
150144 }
151145
152146 async loadSettings(settings) {
@@ -197,7 +191,6 @@ class GSVITtsProvider {
197191 }
198192
199193
200-
201194 // Perform a simple readiness check by trying to fetch voiceIds
202195 async checkReady() {
203196 await Promise.allSettled([this.fetchCharacterList()]);
@@ -256,12 +249,10 @@ class GSVITtsProvider {
256249
257250
258251 return `${this.settings.provider_endpoint}/tts?${params.toString()}`;
259-
260252 }
261253
262254 // Interface not used by GSVI TTS
263255 async fetchTtsFromHistory(history_item_id) {
264256 return Promise.resolve(history_item_id);
265257 }
266-
267258}
public/scripts/extensions/tts/index.js+0 -4
@@ -611,7 +611,6 @@ async function processTtsQueue() {
611611
612612 // Pass the full voiceMapKey (e.g., "User ("Quotes")") as well with character name
613613 await tts(segmentText, voiceId, char, voiceMapKey);
614-
615614 } catch (error) {
616615 toastr.error(error.toString());
617616 console.error(error);
@@ -707,7 +706,6 @@ async function processTtsQueue() {
707706
708707 // Clear current job so the segmented jobs can be processed
709708 currentTtsJob = null;
710-
711709 } catch (error) {
712710 toastr.error(error.toString());
713711 console.error(error);
@@ -1286,7 +1284,6 @@ export function getCharacters(unrestricted) {
12861284 }
12871285
12881286 return characters;
1289-
12901287}
12911288
12921289export function sanitizeId(input) {
@@ -1314,7 +1311,6 @@ function parseVoiceMap(voiceMapString) {
13141311}
13151312
13161313
1317-
13181314/**
13191315 * Apply voiceMap based on current voiceMapEntries
13201316 */
public/scripts/extensions/tts/kokoro-worker.js+0 -0
public/scripts/extensions/tts/minimax.js+0 -2
@@ -837,7 +837,6 @@ class MiniMaxTtsProvider {
837837 // Backend handles all the complex processing and returns audio data directly
838838 console.debug('MiniMax TTS: Audio response received from backend');
839839 return response;
840-
841840 } catch (error) {
842841 console.error('Error in MiniMax TTS generation:', error);
843842 throw error;
@@ -954,7 +953,6 @@ class MiniMaxTtsProvider {
954953 this.audioElement.onended = null;
955954 this.audioElement.onerror = null;
956955 };
957-
958956 } catch (error) {
959957 console.error('MiniMax TTS Preview Error:', error);
960958 toastr.error(`Could not generate preview: ${error.message}`);
public/scripts/extensions/tts/openai.js+0 -1
@@ -146,7 +146,6 @@ class OpenAITtsProvider {
146146 }
147147
148148 populateCharacterInstructions() {
149-
150149 const currentCharacters = $('.tts_voicemap_block_char span').map((i, el) => $(el).text()).get();
151150
152151 $('#openai-character-instructions').empty();
public/scripts/extensions/tts/silerotts.js+0 -1
@@ -172,5 +172,4 @@ class SileroTtsProvider {
172172 async fetchTtsFromHistory(history_item_id) {
173173 return Promise.resolve(history_item_id);
174174 }
175-
176175}
public/scripts/extensions/tts/xtts.js+0 -1
@@ -323,5 +323,4 @@ class XTTSTtsProvider {
323323 async fetchTtsFromHistory(history_item_id) {
324324 return Promise.resolve(history_item_id);
325325 }
326-
327326}
public/scripts/extensions/vectors/index.js+0 -1
@@ -1456,7 +1456,6 @@ async function onViewStatsClick() {
14561456 messageElement.addClass('vectorized');
14571457 }
14581458 }
1459-
14601459}
14611460
14621461async function onVectorizeAllFilesClick() {
public/scripts/f-localStorage.js+0 -1
@@ -13,7 +13,6 @@ export function SaveLocal(target, val) {
1313export function LoadLocal(target) {
1414 console.debug('LoadLocal -- ' + target);
1515 return localStorage.getItem(target);
16-
1716}
1817/**
1918 * @deprecated THIS FUNCTION IS OBSOLETE. DO NOT USE
public/scripts/filters.js+0 -1
@@ -76,7 +76,6 @@ export const fuzzySearchCategories = Object.freeze({
7676 * data = filterHelper.applyFilters(data);
7777 */
7878export class FilterHelper {
79-
8079 /**
8180 * Cache fuzzy search weighting scores for re-usability, sorting and stuff
8281 *
public/scripts/group-chats.js+0 -1
@@ -2477,7 +2477,6 @@ jQuery(() => {
24772477 const value = $(this).prop('checked');
24782478 hideMutedSprites = value;
24792479 onHideMutedSpritesClick(value);
2480-
24812480 });
24822481 $('#send_textarea').on('keyup', onSendTextareaInput);
24832482 $('#groupCurrentMemberPopoutButton').on('click', doCurMemberListPopout);
public/scripts/input-md-formatting.js+4 -5
@@ -59,7 +59,8 @@ export function initInputMarkdown() {
5959 let cursorShift = charsToAdd.length;
6060 let selectedTextandPossibleFormatting = textarea.value.substring(start - possiblePreviousFormattingMargin, end + possiblePreviousFormattingMargin).trim();
6161
6262 if (isTextSelected) { //if text is selected
63+ //if text is selected
6364 selectedText = textarea.value.substring(start, end);
6465 if (selectedTextandPossibleFormatting === charsToAdd + selectedText + charsToAdd) {
6566 // If the selected text is already formatted, remove the formatting
@@ -90,7 +91,8 @@ export function initInputMarkdown() {
9091 textarea.focus();
9192 document.execCommand('insertText', false, charsToAdd + selectedText + charsToAdd + possibleAddedSpace);
9293 }
9394 } else {// No text is selected
95+ // No text is selected
9496 //check 1 character before and after the cursor for non-space characters
9597
9698 if (beforeCaret !== ' ' && afterCaret !== ' ' && afterCaret !== '' && beforeCaret !== '') { //look for caret in the middle of a word
@@ -116,7 +118,6 @@ export function initInputMarkdown() {
116118 }
117119
118120 if (charsToAdd + discoveredWord + charsToAdd === discoveredWordWithPossibleFormatting) {
119-
120121 // Replace the expanded selection with the original discovered word
121122 textarea.focus();
122123 document.execCommand('insertText', false, discoveredWord);
@@ -126,8 +127,6 @@ export function initInputMarkdown() {
126127 textarea.focus();
127128 document.execCommand('insertText', false, charsToAdd + discoveredWord + charsToAdd);
128129 }
129-
130-
131130 } else { //caret is not inside a word, so just add the formatting
132131 textarea.focus();
133132 textarea.setSelectionRange(start, end);
public/scripts/instruct-mode.js+0 -1
@@ -798,7 +798,6 @@ jQuery(() => {
798798 $('#instruct_system_sequence').prop('readOnly', false);
799799 $('#instruct_system_suffix').prop('readOnly', false);
800800 }
801-
802801 });
803802
804803 $('#instruct_enabled').on('change', function () {
public/scripts/openai.js+0 -4
@@ -2279,7 +2279,6 @@ function appendElectronHubOptions(model_list, groupModels = false) {
22792279 appendOption(model);
22802280 });
22812281 }
2282-
22832282}
22842283
22852284function electronHubSortBy(data, property = 'alphabetically') {
@@ -3985,7 +3984,6 @@ function loadOpenAISettings(data, settings) {
39853984 option.value = i;
39863985 option.text = item;
39873986 $('#settings_preset_openai').append(option);
3988-
39893987 });
39903988 openai_setting_names = settingNames;
39913989
@@ -4896,7 +4894,6 @@ function getSiliconflowMaxContext(model, isUnlocked) {
48964894
48974895 // Return context size if model found, otherwise default to 32k
48984896 return Object.entries(contextMap).find(([key]) => model.includes(key))?.[1] || max_32k;
4899-
49004897}
49014898
49024899/**
@@ -5041,7 +5038,6 @@ async function onModelChange() {
50415038 console.log('Claude model changed to', value);
50425039 oai_settings.claude_model = value;
50435040 $('#model_claude_select').val(oai_settings.claude_model);
5044-
50455041 }
50465042
50475043 if ($(this).is('#model_openai_select')) {
public/scripts/personas.js+0 -2
@@ -1593,7 +1593,6 @@ export async function showCharConnections() {
15931593 highlightPersonas: true,
15941594 targetedChar: getCurrentConnectionObj(),
15951595 shiftClickHandler: (element, ev) => {
1596-
15971596 const personaId = $(element).attr('data-pid');
15981597
15991598 /** @type {PersonaConnection[]} */
@@ -1845,7 +1844,6 @@ async function lockPersonaCallback(_args, value) {
18451844 if (isFalseBoolean(value)) {
18461845 await setPersonaLockState(false, type);
18471846 return 'false';
1848-
18491847 }
18501848
18511849 return '';
public/scripts/popup.js+0 -1
@@ -478,7 +478,6 @@ export class Popup {
478478 break;
479479 }
480480 }
481-
482481 };
483482 this.dlg.addEventListener('keydown', keyListener.bind(this));
484483 }
public/scripts/power-user.js+0 -7
@@ -536,7 +536,6 @@ function switchSwipeNumAllMessages() {
536536var originalSliderValues = [];
537537
538538async function switchLabMode({ noReset = false } = {}) {
539-
540539 /* if (power_user.enableZenSliders && power_user.enableLabMode) {
541540 toastr.warning("Can't start Lab Mode while Zen Sliders are active")
542541 return
@@ -571,8 +570,6 @@ async function switchLabMode({ noReset = false } = {}) {
571570 $('#amount_gen').attr('min', '1')
572571 .attr('max', '99999')
573572 .attr('step', '1');
574-
575-
576573 } else if (!noReset) {
577574 //re apply the original sliders values to each input
578575 originalSliderValues.forEach(function (slider) {
@@ -628,7 +625,6 @@ async function switchZenSliders() {
628625 });
629626 $('div[id$="_zenslider"]').remove();
630627 }
631-
632628}
633629async function CreateZenSliders(elmnt) {
634630 var originalSlider = elmnt;
@@ -1178,7 +1174,6 @@ function applyShadowWidth() {
11781174 document.documentElement.style.setProperty('--shadowWidth', String(power_user.shadow_width));
11791175 $('#shadow_width_counter').val(power_user.shadow_width);
11801176 $('#shadow_width').val(power_user.shadow_width);
1181-
11821177}
11831178
11841179function applyFontScale(type) {
@@ -2954,7 +2949,6 @@ function setAvgBG() {
29542949 } */
29552950
29562951 function getAverageRGB(imgEl) {
2957-
29582952 var blockSize = 5, // only visit every 5 pixels
29592953 defaultRGB = { r: 0, g: 0, b: 0 }, // for non-supporting envs
29602954 canvas = document.createElement('canvas'),
@@ -2994,7 +2988,6 @@ function setAvgBG() {
29942988 rgb.b = ~~(rgb.b / count);
29952989
29962990 return rgb;
2997-
29982991 }
29992992
30002993 /**
public/scripts/preset-manager.js+0 -1
@@ -514,7 +514,6 @@ class PresetManager {
514514 console.error('Preset could not be renamed', error);
515515 throw new Error('Preset could not be renamed');
516516 }
517-
518517 }
519518
520519 /**
public/scripts/reasoning.js+0 -1
@@ -865,7 +865,6 @@ function selectReasoningTemplateCallback(args, name) {
865865 UI.$select.val(foundName).trigger('change');
866866 !quiet && toastr.success(`Reasoning template "${foundName}" selected`);
867867 return foundName;
868-
869868}
870869
871870function registerReasoningSlashCommands() {
public/scripts/samplerSelect.js+0 -1
@@ -203,7 +203,6 @@ function setSamplerListListeners() {
203203
204204 console.log(samplerName, relatedDOMElement.data(SELECT_SAMPLER.DATA), shouldDisplay);
205205 });
206-
207206}
208207
209208function isElementVisibleInDOM(element) {
public/scripts/showdown-underscore.js+0 -0
public/scripts/slash-commands.js+0 -2
@@ -4916,7 +4916,6 @@ export async function sendNarratorMessage(args, text) {
49164916}
49174917
49184918export async function promptQuietForLoudResponse(who, text) {
4919-
49204919 let character_id = getContext().characterId;
49214920 if (who === 'sys') {
49224921 text = 'System: ' + text;
@@ -4955,7 +4954,6 @@ export async function promptQuietForLoudResponse(who, text) {
49554954 addOneMessage(message);
49564955 await eventSource.emit(event_types.USER_MESSAGE_RENDERED, (chat.length - 1));
49574956 await saveChatConditional();
4958-
49594957}
49604958
49614959async function sendCommentMessage(args, text) {
public/scripts/slash-commands/SlashCommand.js+0 -3
@@ -26,7 +26,6 @@ import { SlashCommandScope } from './SlashCommandScope.js';
2626*/
2727
2828
29-
3029export class SlashCommand {
3130 /**
3231 * Creates a SlashCommand from a properties object.
@@ -48,8 +47,6 @@ export class SlashCommand {
4847 }
4948
5049
51-
52-
5350 /**@type {string}*/ name;
5451 /**@type {(namedArguments:NamedArguments, unnamedArguments:UnnamedArguments)=>string|SlashCommandClosure|Promise<string|SlashCommandClosure>}*/ callback;
5552 /**@type {string}*/ helpString;
public/scripts/slash-commands/SlashCommandArgument.js+0 -1
@@ -5,7 +5,6 @@ import { SlashCommandExecutor } from './SlashCommandExecutor.js';
55import { SlashCommandScope } from './SlashCommandScope.js';
66
77
8-
98/**@readonly*/
109/**@enum {string}*/
1110export const ARGUMENT_TYPE = {
public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js+0 -0
public/scripts/slash-commands/SlashCommandBrowser.js+0 -0
public/scripts/slash-commands/SlashCommandClosure.js+0 -0
public/scripts/slash-commands/SlashCommandCommandAutoCompleteOption.js+0 -2
@@ -10,8 +10,6 @@ export class SlashCommandCommandAutoCompleteOption extends AutoCompleteOption {
1010 }
1111
1212
13-
14-
1513 /**
1614 * @param {SlashCommand} command
1715 * @param {string} name
public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js+0 -0
public/scripts/slash-commands/SlashCommandDebugController.js+0 -5
@@ -18,15 +18,11 @@ export class SlashCommandDebugController {
1818 /** @type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise<boolean>} */ onBreakPoint;
1919
2020
21-
22-
2321 testStepping(closure) {
2422 return this.stepStack[this.stack.indexOf(closure)];
2523 }
2624
2725
28-
29-
3026 down(closure) {
3127 this.stack.push(closure);
3228 if (this.stepStack.length < this.stack.length) {
@@ -44,7 +40,6 @@ export class SlashCommandDebugController {
4440 }
4541
4642
47-
4843 resume() {
4944 this.continueResolver?.(false);
5045 this.continuePromise = null;
public/scripts/slash-commands/SlashCommandEnumAutoCompleteOption.js+0 -1
@@ -18,7 +18,6 @@ export class SlashCommandEnumAutoCompleteOption extends AutoCompleteOption {
1818 /**@type {SlashCommandEnumValue}*/ enumValue;
1919
2020
21-
2221 /**
2322 * @param {SlashCommand} cmd
2423 * @param {SlashCommandEnumValue} enumValue
public/scripts/slash-commands/SlashCommandExecutionError.js+0 -1
@@ -48,7 +48,6 @@ export class SlashCommandExecutionError extends Error {
4848 }
4949
5050
51-
5251 constructor(cause, message, commandName, start, end, commandText, fullText) {
5352 super(message, { cause });
5453 this.commandName = commandName;
public/scripts/slash-commands/SlashCommandExecutor.js+0 -0
public/scripts/slash-commands/SlashCommandParser.js+0 -0
public/scripts/slash-commands/SlashCommandScope.js+0 -2
@@ -109,8 +109,6 @@ export class SlashCommandScope {
109109}
110110
111111
112-
113-
114112export class SlashCommandScopeVariableExistsError extends Error {}
115113
116114
public/scripts/tags.js+0 -1
@@ -2091,7 +2091,6 @@ function onTagAsFolderClick() {
20912091 // If folder display has changed, we have to redraw the character list, otherwise this folders state would not change
20922092 printCharactersDebounced();
20932093 saveSettingsDebounced();
2094-
20952094}
20962095
20972096function updateDrawTagFolder(element, tag) {
public/scripts/textgen-settings.js+0 -1
@@ -802,7 +802,6 @@ async function getStatusTextgen() {
802802 console.info('Status check aborted.', err.reason);
803803 } else {
804804 console.error('Error getting status', err);
805-
806805 }
807806 setOnlineStatus('no_connection');
808807 }
public/scripts/user.js+0 -4
@@ -455,7 +455,6 @@ async function changeName(handle, name, callback) {
455455
456456 toastr.success('Name changed successfully', 'Name Changed');
457457 callback();
458-
459458 } catch (error) {
460459 console.error('Error changing name:', error);
461460 }
@@ -495,7 +494,6 @@ async function restoreSnapshot(name, callback) {
495494 } catch (error) {
496495 console.error('Error restoring snapshot:', error);
497496 }
498-
499497}
500498
501499/**
@@ -601,7 +599,6 @@ async function viewSettingsSnapshots() {
601599 const content = await loadSnapshotContent(snapshot.name);
602600 contentBlock.val(content);
603601 }
604-
605602 });
606603 template.find('.snapshotList').append(snapshotBlock);
607604 }
@@ -667,7 +664,6 @@ async function resetEverything(callback) {
667664 } catch (error) {
668665 console.error('Error resetting everything:', error);
669666 }
670-
671667}
672668
673669async function openUserProfile() {
public/scripts/utils.js+0 -1
@@ -2310,7 +2310,6 @@ export function highlightRegex(regexStr) {
23102310 flags: new RegExp('(?<=\\/)([gimsuy]*)$', 'g'), // Match trailing flags
23112311 delimiters: new RegExp('^\\/|(?<![\\\\<])\\/', 'g'), // Match leading or trailing delimiters
23122312 };
2313-
23142313 } catch (error) {
23152314 return {
23162315 brackets: new RegExp('(\\\\)?\\[.*?\\]', 'g'), // Non-escaped square brackets
public/scripts/world-info.js+0 -2
@@ -675,7 +675,6 @@ class WorldInfoTimedEffects {
675675 console.log('[WI] Timed effect "delay" applied to entry', entry);
676676 }
677677 }
678-
679678 }
680679
681680 /**
@@ -4495,7 +4494,6 @@ function parseDecorators(content) {
44954494 }
44964495
44974496 return [[], content];
4498-
44994497}
45004498
45014499/**
src/endpoints/assets.js+0 -2
@@ -111,7 +111,6 @@ router.post('/get', async (request, response) => {
111111
112112 try {
113113 if (fs.existsSync(folderPath) && fs.statSync(folderPath).isDirectory()) {
114-
115114 ensureFoldersExist(request.user.directories);
116115
117116 const folders = fs.readdirSync(folderPath, { withFileTypes: true })
@@ -346,7 +345,6 @@ router.post('/character', async (request, response) => {
346345 let output = [];
347346 try {
348347 if (fs.existsSync(folderPath) && fs.statSync(folderPath).isDirectory()) {
349-
350348 // Live2d assets
351349 if (category == 'live2d') {
352350 const folders = fs.readdirSync(folderPath, { withFileTypes: true });
src/endpoints/backends/text-completions.js+0 -2
@@ -541,7 +541,6 @@ llamacpp.post('/props', async function (request, response) {
541541 console.debug('LlamaCpp props response:', data);
542542
543543 return response.send(data);
544-
545544 } catch (error) {
546545 console.error(error);
547546 return response.sendStatus(500);
@@ -591,7 +590,6 @@ llamacpp.post('/slots', async function (request, response) {
591590 console.debug('LlamaCpp slots response:', data);
592591
593592 return response.send(data);
594-
595593 } catch (error) {
596594 console.error(error);
597595 return response.sendStatus(500);
src/endpoints/backups.js+0 -0
src/endpoints/characters.js+2 -2
@@ -639,7 +639,6 @@ function charaFormatData(data, directories) {
639639 if (file && file.entries) {
640640 _.set(char, 'data.character_book', convertWorldInfoToCharacterBook(data.world, file.entries));
641641 }
642-
643642 } catch {
644643 console.warn(`Failed to read world info file: ${data.world}. Character book will not be available.`);
645644 }
@@ -921,7 +920,8 @@ async function importFromJson(uploadPath, { request }, preservedFileName) {
921920 let charJSON = JSON.stringify(char);
922921 const result = await writeCharacterData(DEFAULT_AVATAR_PATH, charJSON, pngName, request);
923922 return result ? pngName : '';
924923 } else if (jsonData.char_name !== undefined) {//json Pygmalion notepad
924+ //json Pygmalion notepad
925925 console.info('Importing from gradio json');
926926 jsonData.char_name = sanitize(jsonData.char_name);
927927 if (jsonData.creator_notes) {
src/endpoints/extensions.js+0 -2
@@ -367,7 +367,6 @@ router.post('/version', async (request, response) => {
367367 const { isUpToDate, remoteUrl } = await checkIfRepoIsUpToDate(extensionPath);
368368
369369 return response.send({ currentBranchName, currentCommitHash, isUpToDate, remoteUrl });
370-
371370 } catch (error) {
372371 console.error('Getting extension version failed', error);
373372 return response.status(500).send(`Server Error: ${error.message}`);
@@ -406,7 +405,6 @@ router.post('/delete', async (request, response) => {
406405 console.info(`Extension has been deleted at ${extensionPath}`);
407406
408407 return response.send(`Extension has been deleted at ${extensionPath}`);
409-
410408 } catch (error) {
411409 console.error('Deleting custom content failed', error);
412410 return response.status(500).send(`Server Error: ${error.message}`);
src/endpoints/groups.js+0 -0
src/endpoints/horde.js+0 -2
@@ -256,7 +256,6 @@ router.post('/caption-image', async (request, response) => {
256256 console.info(status);
257257
258258 if (status.state === HordeAsyncRequestStates.done) {
259-
260259 if (status.forms === undefined) {
261260 console.error('Image interrogation request failed: no forms found.');
262261 return response.sendStatus(500);
@@ -278,7 +277,6 @@ router.post('/caption-image', async (request, response) => {
278277 return response.sendStatus(503);
279278 }
280279 }
281-
282280 } catch (error) {
283281 console.error(error);
284282 response.sendStatus(500);
src/endpoints/image-metadata.js+0 -1
@@ -442,7 +442,6 @@ router.post('/', async function (request, response) {
442442 }
443443
444444 return response.status(400).json({ error: 'Invalid request format.' });
445-
446445 } catch (error) {
447446 console.error('[ImageMetadata] API error:', error);
448447 return response.status(500).json({ error: 'Internal server error.' });
src/endpoints/minimax.js+0 -2
@@ -189,7 +189,6 @@ router.post('/generate-voice', async (request, response) => {
189189 response.setHeader('Content-Length', audioBytes.length);
190190
191191 return response.send(Buffer.from(audioBytes));
192-
193192 } catch (conversionError) {
194193 console.error('MiniMax TTS: Audio conversion error:', conversionError);
195194 return response.status(500).json({ error: `Audio data conversion failed: ${conversionError.message}` });
@@ -222,7 +221,6 @@ router.post('/generate-voice', async (request, response) => {
222221 console.error('MiniMax TTS: No valid audio data in response:', responseData);
223222 return response.status(500).json({ error: `API Error: ${errorMessage}` });
224223 }
225-
226224 } catch (error) {
227225 console.error('MiniMax TTS generation failed:', error);
228226 return response.status(500).json({ error: 'Internal server error' });
src/endpoints/stable-diffusion.js+0 -1
@@ -158,7 +158,6 @@ router.post('/samplers', async (request, response) => {
158158 const data = await result.json();
159159 const names = data.map(x => x.name);
160160 return response.send(names);
161-
162161 } catch (error) {
163162 console.error(error);
164163 return response.sendStatus(500);
src/endpoints/thumbnails.js+0 -1
@@ -301,7 +301,6 @@ publicRouter.get('/', async function (request, response) {
301301
302302 // Send a 404 so the frontend can display a placeholder
303303 return response.sendStatus(404);
304-
305304 } catch (error) {
306305 console.error('Failed getting thumbnail', error);
307306 return response.sendStatus(500);
src/prompt-converters.js+0 -1
@@ -118,7 +118,6 @@ export function postProcessPrompt(messages, type, names) {
118118 * @copyright Prompt Conversion script taken from RisuAI by kwaroran (GPLv3).
119119 */
120120export function convertClaudePrompt(messages, addAssistantPostfix, addAssistantPrefill, withSysPromptSupport, useSystemPrompt, addSysHumanMsg, excludePrefixes) {
121-
122121 //Prepare messages for claude.
123122 //When 'Exclude Human/Assistant prefixes' checked, setting messages role to the 'system'(last message is exception).
124123 if (messages.length > 0) {
src/util.js+0 -1
@@ -1012,7 +1012,6 @@ export async function canResolve(name, useIPv6 = true, useIPv4 = true) {
10121012 }
10131013
10141014 return v6Resolved || v4Resolved;
1015-
10161015 } catch (error) {
10171016 return false;
10181017 }