Merge branch 'staging' into whitelist-hosts

68db63b6299f10b202c6a1802234adfaa8541d40

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

10 files changed, +40 -45Ignore whitespace
package-lock.json+22 -9
@@ -21,6 +21,7 @@
2121 "bing-translate-api": "^4.0.2",
2222 "body-parser": "^1.20.2",
2323 "bowser": "^2.11.0",
24+ "chalk": "^5.4.1",
2425 "command-exists": "^1.2.9",
2526 "compression": "^1",
2627 "cookie-parser": "^1.4.6",
@@ -2438,17 +2439,12 @@
24382439 }
24392440 },
24402441 "node_modules/chalk": {
24412442 "version": "5.4.1.2",
24422443 "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.2.tgz",
24432444 "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+0G76SLROeyw9CpQ061i4mAU3w==",
2444- "dev": true,
24452445 "license": "MIT",
2446- "dependencies": {
2447- "ansi-styles": "^4.1.0",
2448- "supports-color": "^7.1.0"
2449- },
24502446 "engines": {
2451- "node": ">=10"
2447+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
24522448 },
24532449 "funding": {
24542450 "url": "https://github.com/chalk/chalk?sponsor=1"
@@ -3492,6 +3488,23 @@
34923488 "url": "https://opencollective.com/eslint"
34933489 }
34943490 },
3491+ "node_modules/eslint/node_modules/chalk": {
3492+ "version": "4.1.2",
3493+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
3494+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
3495+ "dev": true,
3496+ "license": "MIT",
3497+ "dependencies": {
3498+ "ansi-styles": "^4.1.0",
3499+ "supports-color": "^7.1.0"
3500+ },
3501+ "engines": {
3502+ "node": ">=10"
3503+ },
3504+ "funding": {
3505+ "url": "https://github.com/chalk/chalk?sponsor=1"
3506+ }
3507+ },
34953508 "node_modules/eslint/node_modules/debug": {
34963509 "version": "4.3.4",
34973510 "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
package.json+1 -0
@@ -11,6 +11,7 @@
1111 "bing-translate-api": "^4.0.2",
1212 "body-parser": "^1.20.2",
1313 "bowser": "^2.11.0",
14+ "chalk": "^5.4.1",
1415 "command-exists": "^1.2.9",
1516 "compression": "^1",
1617 "cookie-parser": "^1.4.6",
post-install.js+2 -15
@@ -7,26 +7,13 @@ import crypto from 'node:crypto';
77import process from 'node:process';
88import yaml from 'yaml';
99import _ from 'lodash';
10+import chalk from 'chalk';
1011import { createRequire } from 'node:module';
1112
1213/**
1314 * Colorizes console output.
1415 */
1516const color = {chalk;
16- byNum: (mess, fgNum) => {
17- mess = mess || '';
18- fgNum = fgNum === undefined ? 31 : fgNum;
19- return '\u001b[' + fgNum + 'm' + mess + '\u001b[39m';
20- },
21- black: (mess) => color.byNum(mess, 30),
22- red: (mess) => color.byNum(mess, 31),
23- green: (mess) => color.byNum(mess, 32),
24- yellow: (mess) => color.byNum(mess, 33),
25- blue: (mess) => color.byNum(mess, 34),
26- magenta: (mess) => color.byNum(mess, 35),
27- cyan: (mess) => color.byNum(mess, 36),
28- white: (mess) => color.byNum(mess, 37),
29-};
3017
3118const keyMigrationMap = [
3219 {
public/index.html+4 -1
@@ -4940,7 +4940,10 @@
49404940 </div>
49414941 <hr class="wide100p margin0">
49424942 <div class="alignitemscenter flex-container justifyCenter wide100p" style="justify-content: space-between;">
4943- <h4 class="margin0"><span data-i18n="Extras API:">Extras API:</span></h4>
4943+ <h4 class="margin0">
4944+ <span data-i18n="(DEPRECATED)">(DEPRECATED)</span>
4945+ <span data-i18n="Extras API:">Extras API:</span>
4946+ </h4>
49444947 <div class="flex-container">
49454948 <div id="extensions_status" data-i18n="Not connected...">Not connected...</div>
49464949 <label for="extensions_autoconnect" class="checkbox_label flexNoGap">
public/lib.js+3 -0
@@ -20,6 +20,7 @@ import * as Popper from '@popperjs/core';
2020import droll from 'droll';
2121import morphdom from 'morphdom';
2222import { toggle as slideToggle } from 'slidetoggle';
23+import chalk from 'chalk';
2324
2425/**
2526 * Expose the libraries to the 'window' object.
@@ -96,6 +97,7 @@ export default {
9697 droll,
9798 morphdom,
9899 slideToggle,
100+ chalk,
99101};
100102
101103export {
@@ -118,4 +120,5 @@ export {
118120 droll,
119121 morphdom,
120122 slideToggle,
123+ chalk,
121124};
public/script.js+2 -2
@@ -3866,7 +3866,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
38663866 coreChat = await Promise.all(coreChat.map(async (chatItem, index) => {
38673867 let message = chatItem.mes;
38683868 let regexType = chatItem.is_user ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT;
38693869 let options = { isPrompt: true, depth: (coreChat.length - index - (isContinue ? 1 : 0)) };
38703870
38713871 let regexedMessage = getRegexedString(message, regexType, options);
38723872 regexedMessage = await appendFileContent(chatItem, regexedMessage);
@@ -3884,7 +3884,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
38843884
38853885 const reasoning = new PromptReasoning();
38863886 for (let i = coreChat.length - 1; i >= 0; i--) {
38873887 const depth = coreChat.length - i - (isContinue ? 1 : 0);
38883888 const isPrefix = isContinue && i === coreChat.length - 1;
38893889 coreChat[i] = {
38903890 ...coreChat[i],
public/scripts/extensions/tts/alltalk.js+2 -1
@@ -258,6 +258,7 @@ class AllTalkTtsProvider {
258258 $('#rvc_narrator_voice').val(this.settings.rvc_narrator_voice);
259259 $('#rvc_character_pitch').val(this.settings.rvc_character_pitch);
260260 $('#rvc_narrator_pitch').val(this.settings.rvc_narrator_pitch);
261+ $('#server_version').val(this.settings.server_version);
261262
262263 console.debug('AllTalkTTS: Settings loaded');
263264 try {
@@ -655,11 +656,11 @@ class AllTalkTtsProvider {
655656 if (serverVersionSelect) {
656657 serverVersionSelect.addEventListener('change', async (event) => {
657658 this.settings.server_version = event.target.value;
659+ this.onSettingsChange();
658660 if (event.target.value === 'v2') {
659661 await this.fetchRvcVoiceObjects();
660662 }
661663 this.updateRvcVoiceDropdowns();
662- this.onSettingsChange();
663664 });
664665 }
665666
public/scripts/slash-commands.js+1 -1
@@ -3324,7 +3324,7 @@ async function goToCharacterCallback(_, name) {
33243324 const character = findChar({ name: name });
33253325 if (character) {
33263326 const chid = getCharIndex(character);
33273327 await openChat(new String(chid));
33283328 setActiveCharacter(character.avatar);
33293329 setActiveGroup(null);
33303330 return character.name;
src/endpoints/characters.js+1 -1
@@ -197,7 +197,7 @@ const calculateChatSize = (charDir) => {
197197
198198// Calculate the total string length of the data object
199199const calculateDataSize = (data) => {
200200 return typeof data === 'object' ? Object.values(data).reduce((acc, val) => acc + new String(val).length, 0) : 0;
201201};
202202
203203/**
src/util.js+2 -15
@@ -14,6 +14,7 @@ import _ from 'lodash';
1414import yauzl from 'yauzl';
1515import mime from 'mime-types';
1616import { default as simpleGit } from 'simple-git';
17+import chalk from 'chalk';
1718import { LOG_LEVELS } from './constants.js';
1819
1920/**
@@ -323,21 +324,7 @@ export function deepMerge(target, source) {
323324 return output;
324325}
325326
326327export const color = {chalk;
327- byNum: (mess, fgNum) => {
328- mess = mess || '';
329- fgNum = fgNum === undefined ? 31 : fgNum;
330- return '\u001b[' + fgNum + 'm' + mess + '\u001b[39m';
331- },
332- black: (mess) => color.byNum(mess, 30),
333- red: (mess) => color.byNum(mess, 31),
334- green: (mess) => color.byNum(mess, 32),
335- yellow: (mess) => color.byNum(mess, 33),
336- blue: (mess) => color.byNum(mess, 34),
337- magenta: (mess) => color.byNum(mess, 35),
338- cyan: (mess) => color.byNum(mess, 36),
339- white: (mess) => color.byNum(mess, 37),
340-};
341328
342329/**
343330 * Gets a random UUIDv4 string.