Merge branch 'staging' into whitelist-hosts
| @@ -21,6 +21,7 @@ | |||
| 21 | "bing-translate-api": "^4.0.2", | 21 | "bing-translate-api": "^4.0.2", |
| 22 | "body-parser": "^1.20.2", | 22 | "body-parser": "^1.20.2", |
| 23 | "bowser": "^2.11.0", | 23 | "bowser": "^2.11.0", |
| 24 | "chalk": "^5.4.1", | ||
| 24 | "command-exists": "^1.2.9", | 25 | "command-exists": "^1.2.9", |
| 25 | "compression": "^1", | 26 | "compression": "^1", |
| 26 | "cookie-parser": "^1.4.6", | 27 | "cookie-parser": "^1.4.6", |
| @@ -2438,17 +2439,12 @@ | |||
| 2438 | } | 2439 | } |
| 2439 | }, | 2440 | }, |
| 2440 | "node_modules/chalk": { | 2441 | "node_modules/chalk": { |
| 2441 | "version": "4.1.2", | 2442 | "version": "5.4.1", |
| 2442 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", | 2443 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", |
| 2443 | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", | 2444 | "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", |
| 2444 | "dev": true, | ||
| 2445 | "license": "MIT", | 2445 | "license": "MIT", |
| 2446 | "dependencies": { | ||
| 2447 | "ansi-styles": "^4.1.0", | ||
| 2448 | "supports-color": "^7.1.0" | ||
| 2449 | }, | ||
| 2450 | "engines": { | 2446 | "engines": { |
| 2451 | "node": ">=10" | 2447 | "node": "^12.17.0 || ^14.13 || >=16.0.0" |
| 2452 | }, | 2448 | }, |
| 2453 | "funding": { | 2449 | "funding": { |
| 2454 | "url": "https://github.com/chalk/chalk?sponsor=1" | 2450 | "url": "https://github.com/chalk/chalk?sponsor=1" |
| @@ -3492,6 +3488,23 @@ | |||
| 3492 | "url": "https://opencollective.com/eslint" | 3488 | "url": "https://opencollective.com/eslint" |
| 3493 | } | 3489 | } |
| 3494 | }, | 3490 | }, |
| 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 | }, | ||
| 3495 | "node_modules/eslint/node_modules/debug": { | 3508 | "node_modules/eslint/node_modules/debug": { |
| 3496 | "version": "4.3.4", | 3509 | "version": "4.3.4", |
| 3497 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", | 3510 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", |
| @@ -11,6 +11,7 @@ | |||
| 11 | "bing-translate-api": "^4.0.2", | 11 | "bing-translate-api": "^4.0.2", |
| 12 | "body-parser": "^1.20.2", | 12 | "body-parser": "^1.20.2", |
| 13 | "bowser": "^2.11.0", | 13 | "bowser": "^2.11.0", |
| 14 | "chalk": "^5.4.1", | ||
| 14 | "command-exists": "^1.2.9", | 15 | "command-exists": "^1.2.9", |
| 15 | "compression": "^1", | 16 | "compression": "^1", |
| 16 | "cookie-parser": "^1.4.6", | 17 | "cookie-parser": "^1.4.6", |
| @@ -7,26 +7,13 @@ import crypto from 'node:crypto'; | |||
| 7 | import process from 'node:process'; | 7 | import process from 'node:process'; |
| 8 | import yaml from 'yaml'; | 8 | import yaml from 'yaml'; |
| 9 | import _ from 'lodash'; | 9 | import _ from 'lodash'; |
| 10 | import chalk from 'chalk'; | ||
| 10 | import { createRequire } from 'node:module'; | 11 | import { createRequire } from 'node:module'; |
| 11 | 12 | ||
| 12 | /** | 13 | /** |
| 13 | * Colorizes console output. | 14 | * Colorizes console output. |
| 14 | */ | 15 | */ |
| 15 | const color = { | 16 | const 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 | }; | ||
| 30 | 17 | ||
| 31 | const keyMigrationMap = [ | 18 | const keyMigrationMap = [ |
| 32 | { | 19 | { |
| @@ -4940,7 +4940,10 @@ | |||
| 4940 | </div> | 4940 | </div> |
| 4941 | <hr class="wide100p margin0"> | 4941 | <hr class="wide100p margin0"> |
| 4942 | <div class="alignitemscenter flex-container justifyCenter wide100p" style="justify-content: space-between;"> | 4942 | <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> | ||
| 4944 | <div class="flex-container"> | 4947 | <div class="flex-container"> |
| 4945 | <div id="extensions_status" data-i18n="Not connected...">Not connected...</div> | 4948 | <div id="extensions_status" data-i18n="Not connected...">Not connected...</div> |
| 4946 | <label for="extensions_autoconnect" class="checkbox_label flexNoGap"> | 4949 | <label for="extensions_autoconnect" class="checkbox_label flexNoGap"> |
| @@ -20,6 +20,7 @@ import * as Popper from '@popperjs/core'; | |||
| 20 | import droll from 'droll'; | 20 | import droll from 'droll'; |
| 21 | import morphdom from 'morphdom'; | 21 | import morphdom from 'morphdom'; |
| 22 | import { toggle as slideToggle } from 'slidetoggle'; | 22 | import { toggle as slideToggle } from 'slidetoggle'; |
| 23 | import chalk from 'chalk'; | ||
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| 25 | * Expose the libraries to the 'window' object. | 26 | * Expose the libraries to the 'window' object. |
| @@ -96,6 +97,7 @@ export default { | |||
| 96 | droll, | 97 | droll, |
| 97 | morphdom, | 98 | morphdom, |
| 98 | slideToggle, | 99 | slideToggle, |
| 100 | chalk, | ||
| 99 | }; | 101 | }; |
| 100 | 102 | ||
| 101 | export { | 103 | export { |
| @@ -118,4 +120,5 @@ export { | |||
| 118 | droll, | 120 | droll, |
| 119 | morphdom, | 121 | morphdom, |
| 120 | slideToggle, | 122 | slideToggle, |
| 123 | chalk, | ||
| 121 | }; | 124 | }; |
| @@ -3866,7 +3866,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 3866 | coreChat = await Promise.all(coreChat.map(async (chatItem, index) => { | 3866 | coreChat = await Promise.all(coreChat.map(async (chatItem, index) => { |
| 3867 | let message = chatItem.mes; | 3867 | let message = chatItem.mes; |
| 3868 | let regexType = chatItem.is_user ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT; | 3868 | let regexType = chatItem.is_user ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT; |
| 3869 | let options = { isPrompt: true, depth: (coreChat.length - index - 1) }; | 3869 | let options = { isPrompt: true, depth: (coreChat.length - index - (isContinue ? 1 : 0)) }; |
| 3870 | 3870 | ||
| 3871 | let regexedMessage = getRegexedString(message, regexType, options); | 3871 | let regexedMessage = getRegexedString(message, regexType, options); |
| 3872 | regexedMessage = await appendFileContent(chatItem, regexedMessage); | 3872 | regexedMessage = await appendFileContent(chatItem, regexedMessage); |
| @@ -3884,7 +3884,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 3884 | 3884 | ||
| 3885 | const reasoning = new PromptReasoning(); | 3885 | const reasoning = new PromptReasoning(); |
| 3886 | for (let i = coreChat.length - 1; i >= 0; i--) { | 3886 | for (let i = coreChat.length - 1; i >= 0; i--) { |
| 3887 | const depth = coreChat.length - i - 1; | 3887 | const depth = coreChat.length - i - (isContinue ? 1 : 0); |
| 3888 | const isPrefix = isContinue && i === coreChat.length - 1; | 3888 | const isPrefix = isContinue && i === coreChat.length - 1; |
| 3889 | coreChat[i] = { | 3889 | coreChat[i] = { |
| 3890 | ...coreChat[i], | 3890 | ...coreChat[i], |
| @@ -258,6 +258,7 @@ class AllTalkTtsProvider { | |||
| 258 | $('#rvc_narrator_voice').val(this.settings.rvc_narrator_voice); | 258 | $('#rvc_narrator_voice').val(this.settings.rvc_narrator_voice); |
| 259 | $('#rvc_character_pitch').val(this.settings.rvc_character_pitch); | 259 | $('#rvc_character_pitch').val(this.settings.rvc_character_pitch); |
| 260 | $('#rvc_narrator_pitch').val(this.settings.rvc_narrator_pitch); | 260 | $('#rvc_narrator_pitch').val(this.settings.rvc_narrator_pitch); |
| 261 | $('#server_version').val(this.settings.server_version); | ||
| 261 | 262 | ||
| 262 | console.debug('AllTalkTTS: Settings loaded'); | 263 | console.debug('AllTalkTTS: Settings loaded'); |
| 263 | try { | 264 | try { |
| @@ -655,11 +656,11 @@ class AllTalkTtsProvider { | |||
| 655 | if (serverVersionSelect) { | 656 | if (serverVersionSelect) { |
| 656 | serverVersionSelect.addEventListener('change', async (event) => { | 657 | serverVersionSelect.addEventListener('change', async (event) => { |
| 657 | this.settings.server_version = event.target.value; | 658 | this.settings.server_version = event.target.value; |
| 659 | this.onSettingsChange(); | ||
| 658 | if (event.target.value === 'v2') { | 660 | if (event.target.value === 'v2') { |
| 659 | await this.fetchRvcVoiceObjects(); | 661 | await this.fetchRvcVoiceObjects(); |
| 660 | } | 662 | } |
| 661 | this.updateRvcVoiceDropdowns(); | 663 | this.updateRvcVoiceDropdowns(); |
| 662 | this.onSettingsChange(); | ||
| 663 | }); | 664 | }); |
| 664 | } | 665 | } |
| 665 | 666 | ||
| @@ -3324,7 +3324,7 @@ async function goToCharacterCallback(_, name) { | |||
| 3324 | const character = findChar({ name: name }); | 3324 | const character = findChar({ name: name }); |
| 3325 | if (character) { | 3325 | if (character) { |
| 3326 | const chid = getCharIndex(character); | 3326 | const chid = getCharIndex(character); |
| 3327 | await openChat(new String(chid)); | 3327 | await openChat(String(chid)); |
| 3328 | setActiveCharacter(character.avatar); | 3328 | setActiveCharacter(character.avatar); |
| 3329 | setActiveGroup(null); | 3329 | setActiveGroup(null); |
| 3330 | return character.name; | 3330 | return character.name; |
| @@ -197,7 +197,7 @@ const calculateChatSize = (charDir) => { | |||
| 197 | 197 | ||
| 198 | // Calculate the total string length of the data object | 198 | // Calculate the total string length of the data object |
| 199 | const calculateDataSize = (data) => { | 199 | const calculateDataSize = (data) => { |
| 200 | return typeof data === 'object' ? Object.values(data).reduce((acc, val) => acc + new String(val).length, 0) : 0; | 200 | return typeof data === 'object' ? Object.values(data).reduce((acc, val) => acc + String(val).length, 0) : 0; |
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| 203 | /** | 203 | /** |
| @@ -14,6 +14,7 @@ import _ from 'lodash'; | |||
| 14 | import yauzl from 'yauzl'; | 14 | import yauzl from 'yauzl'; |
| 15 | import mime from 'mime-types'; | 15 | import mime from 'mime-types'; |
| 16 | import { default as simpleGit } from 'simple-git'; | 16 | import { default as simpleGit } from 'simple-git'; |
| 17 | import chalk from 'chalk'; | ||
| 17 | import { LOG_LEVELS } from './constants.js'; | 18 | import { LOG_LEVELS } from './constants.js'; |
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| @@ -323,21 +324,7 @@ export function deepMerge(target, source) { | |||
| 323 | return output; | 324 | return output; |
| 324 | } | 325 | } |
| 325 | 326 | ||
| 326 | export const color = { | 327 | export 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 | }; | ||
| 341 | 328 | ||
| 342 | /** | 329 | /** |
| 343 | * Gets a random UUIDv4 string. | 330 | * Gets a random UUIDv4 string. |