Merge branch 'staging' into fix-srw-trim

c5d4bdcd0bab5bf5698c0495f4700b5676137e35

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

44 files changed, +350 -101Showing whitespace changes
.eslintrc.cjs+4 -0
@@ -3,6 +3,9 @@ module.exports = {
3 extends: [3 extends: [
4 'eslint:recommended',4 'eslint:recommended',
5 ],5 ],
6 plugins: [
7 'jsdoc',
8 ],
6 env: {9 env: {
7 es6: true,10 es6: true,
8 },11 },
@@ -78,6 +81,7 @@ module.exports = {
78 'public/scripts/extensions/tts/lib/**',81 'public/scripts/extensions/tts/lib/**',
79 ],82 ],
80 rules: {83 rules: {
84 'jsdoc/no-undefined-types': ['warn', { disableReporting: true, markVariablesAsUsed: true }],
81 'no-unused-vars': ['error', { args: 'none' }],85 'no-unused-vars': ['error', { args: 'none' }],
82 'no-control-regex': 'off',86 'no-control-regex': 'off',
83 'no-constant-condition': ['error', { checkLoops: false }],87 'no-constant-condition': ['error', { checkLoops: false }],
.github/workflows/pr-auto-manager.yml+41 -0
@@ -11,6 +11,41 @@ permissions:
11 pull-requests: write11 pull-requests: write
1212
13jobs:13jobs:
14 run-eslint:
15 name: ✅ Check ESLint on PR
16 runs-on: ubuntu-latest
17 # Only needs to run when code is changed
18 if: github.event.action == 'opened' || github.event.action == 'synchronize'
19
20 steps:
21 - name: Checkout Repository
22 # Checkout
23 # https://github.com/marketplace/actions/checkout
24 uses: actions/checkout@v4.2.2
25
26 - name: Setup Node.js
27 # Setup Node.js environment
28 # https://github.com/marketplace/actions/setup-node-js-environment
29 uses: actions/setup-node@v4.3.0
30 with:
31 node-version: 20
32
33 - name: Run npm install
34 run: npm ci
35
36 - name: Run ESLint
37 # Action ESLint
38 # https://github.com/marketplace/actions/action-eslint
39 uses: sibiraj-s/action-eslint@v3.0.1
40 with:
41 token: ${{ secrets.GITHUB_TOKEN }}
42 eslint-args: '--ignore-path=.gitignore --quiet'
43 extensions: 'js,ts'
44 annotations: true
45 ignore-patterns: |
46 dist/
47 lib/
48
14 label-by-size:49 label-by-size:
15 name: 🏷️ Label PR by Size50 name: 🏷️ Label PR by Size
16 # This job should run after all others, to prevent possible concurrency issues51 # This job should run after all others, to prevent possible concurrency issues
@@ -186,6 +221,12 @@ jobs:
186 runs-on: ubuntu-latest221 runs-on: ubuntu-latest
187 if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'staging'222 if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'staging'
188223
224 # Override permissions, We need to be able to write to issues
225 permissions:
226 contents: read
227 issues: write
228 pull-requests: write
229
189 steps:230 steps:
190 - name: Extract Linked Issues From PR Description231 - name: Extract Linked Issues From PR Description
191 id: extract_issues232 id: extract_issues
package-lock.json+202 -4
@@ -110,7 +110,8 @@
110 "@types/write-file-atomic": "^4.0.3",110 "@types/write-file-atomic": "^4.0.3",
111 "@types/yargs": "^17.0.33",111 "@types/yargs": "^17.0.33",
112 "@types/yauzl": "^2.10.3",112 "@types/yauzl": "^2.10.3",
113 "eslint": "^8.57.1"113 "eslint": "^8.57.1",
114 "eslint-plugin-jsdoc": "^48.10.0"
114 },115 },
115 "engines": {116 "engines": {
116 "node": ">= 18"117 "node": ">= 18"
@@ -147,6 +148,21 @@
147 "integrity": "sha512-KlmTftToTtmb6aLVdne4NluS+POWputPF5J8v25UN/EQS+K9vahWEIe1NPRSFqBQclObkqHaj7JOnFrmnSm5MA==",148 "integrity": "sha512-KlmTftToTtmb6aLVdne4NluS+POWputPF5J8v25UN/EQS+K9vahWEIe1NPRSFqBQclObkqHaj7JOnFrmnSm5MA==",
148 "license": "Apache-2.0"149 "license": "Apache-2.0"
149 },150 },
151 "node_modules/@es-joy/jsdoccomment": {
152 "version": "0.46.0",
153 "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.46.0.tgz",
154 "integrity": "sha512-C3Axuq1xd/9VqFZpW4YAzOx5O9q/LP46uIQy/iNDpHG3fmPa6TBtvfglMCs3RBiBxAIi0Go97r8+jvTt55XMyQ==",
155 "dev": true,
156 "license": "MIT",
157 "dependencies": {
158 "comment-parser": "1.4.1",
159 "esquery": "^1.6.0",
160 "jsdoc-type-pratt-parser": "~4.0.0"
161 },
162 "engines": {
163 "node": ">=16"
164 }
165 },
150 "node_modules/@eslint-community/eslint-utils": {166 "node_modules/@eslint-community/eslint-utils": {
151 "version": "4.4.0",167 "version": "4.4.0",
152 "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",168 "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -970,6 +986,19 @@
970 "node": ">=14"986 "node": ">=14"
971 }987 }
972 },988 },
989 "node_modules/@pkgr/core": {
990 "version": "0.1.1",
991 "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz",
992 "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==",
993 "dev": true,
994 "license": "MIT",
995 "engines": {
996 "node": "^12.20.0 || ^14.18.0 || >=16.0.0"
997 },
998 "funding": {
999 "url": "https://opencollective.com/unts"
1000 }
1001 },
973 "node_modules/@popperjs/core": {1002 "node_modules/@popperjs/core": {
974 "version": "2.11.8",1003 "version": "2.11.8",
975 "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",1004 "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
@@ -2099,6 +2128,16 @@
2099 "safe-buffer": "~5.2.0"2128 "safe-buffer": "~5.2.0"
2100 }2129 }
2101 },2130 },
2131 "node_modules/are-docs-informative": {
2132 "version": "0.0.2",
2133 "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz",
2134 "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==",
2135 "dev": true,
2136 "license": "MIT",
2137 "engines": {
2138 "node": ">=14"
2139 }
2140 },
2102 "node_modules/argparse": {2141 "node_modules/argparse": {
2103 "version": "2.0.1",2142 "version": "2.0.1",
2104 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",2143 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -2614,6 +2653,16 @@
2614 "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",2653 "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
2615 "license": "MIT"2654 "license": "MIT"
2616 },2655 },
2656 "node_modules/comment-parser": {
2657 "version": "1.4.1",
2658 "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz",
2659 "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==",
2660 "dev": true,
2661 "license": "MIT",
2662 "engines": {
2663 "node": ">= 12.0.0"
2664 }
2665 },
2617 "node_modules/compress-commons": {2666 "node_modules/compress-commons": {
2618 "version": "6.0.2",2667 "version": "6.0.2",
2619 "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz",2668 "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz",
@@ -3560,6 +3609,69 @@
3560 "url": "https://opencollective.com/eslint"3609 "url": "https://opencollective.com/eslint"
3561 }3610 }
3562 },3611 },
3612 "node_modules/eslint-plugin-jsdoc": {
3613 "version": "48.10.0",
3614 "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.10.0.tgz",
3615 "integrity": "sha512-BEli0k8E0dzhJairAllwlkGnyYDZVKNn4WDmyKy+v6J5qGNuofjzxwNUi+55BOGmyO9mKBhqaidwGy+dxndn/Q==",
3616 "dev": true,
3617 "license": "BSD-3-Clause",
3618 "dependencies": {
3619 "@es-joy/jsdoccomment": "~0.46.0",
3620 "are-docs-informative": "^0.0.2",
3621 "comment-parser": "1.4.1",
3622 "debug": "^4.3.5",
3623 "escape-string-regexp": "^4.0.0",
3624 "esquery": "^1.6.0",
3625 "parse-imports": "^2.1.1",
3626 "semver": "^7.6.3",
3627 "spdx-expression-parse": "^4.0.0",
3628 "synckit": "^0.9.1"
3629 },
3630 "engines": {
3631 "node": ">=18"
3632 },
3633 "peerDependencies": {
3634 "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0"
3635 }
3636 },
3637 "node_modules/eslint-plugin-jsdoc/node_modules/debug": {
3638 "version": "4.4.0",
3639 "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
3640 "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
3641 "dev": true,
3642 "license": "MIT",
3643 "dependencies": {
3644 "ms": "^2.1.3"
3645 },
3646 "engines": {
3647 "node": ">=6.0"
3648 },
3649 "peerDependenciesMeta": {
3650 "supports-color": {
3651 "optional": true
3652 }
3653 }
3654 },
3655 "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": {
3656 "version": "4.0.0",
3657 "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
3658 "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
3659 "dev": true,
3660 "license": "MIT",
3661 "engines": {
3662 "node": ">=10"
3663 },
3664 "funding": {
3665 "url": "https://github.com/sponsors/sindresorhus"
3666 }
3667 },
3668 "node_modules/eslint-plugin-jsdoc/node_modules/ms": {
3669 "version": "2.1.3",
3670 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
3671 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
3672 "dev": true,
3673 "license": "MIT"
3674 },
3563 "node_modules/eslint-scope": {3675 "node_modules/eslint-scope": {
3564 "version": "7.2.2",3676 "version": "7.2.2",
3565 "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",3677 "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
@@ -3690,9 +3802,9 @@
3690 }3802 }
3691 },3803 },
3692 "node_modules/esquery": {3804 "node_modules/esquery": {
3693 "version": "1.5.0",3805 "version": "1.6.0",
3694 "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",3806 "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
3695 "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",3807 "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==",
3696 "dev": true,3808 "dev": true,
3697 "license": "BSD-3-Clause",3809 "license": "BSD-3-Clause",
3698 "dependencies": {3810 "dependencies": {
@@ -5015,6 +5127,16 @@
5015 "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",5127 "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
5016 "license": "MIT"5128 "license": "MIT"
5017 },5129 },
5130 "node_modules/jsdoc-type-pratt-parser": {
5131 "version": "4.0.0",
5132 "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz",
5133 "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==",
5134 "dev": true,
5135 "license": "MIT",
5136 "engines": {
5137 "node": ">=12.0.0"
5138 }
5139 },
5018 "node_modules/json-buffer": {5140 "node_modules/json-buffer": {
5019 "version": "3.0.1",5141 "version": "3.0.1",
5020 "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",5142 "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
@@ -5891,6 +6013,20 @@
5891 "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==",6013 "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==",
5892 "license": "MIT"6014 "license": "MIT"
5893 },6015 },
6016 "node_modules/parse-imports": {
6017 "version": "2.2.1",
6018 "resolved": "https://registry.npmjs.org/parse-imports/-/parse-imports-2.2.1.tgz",
6019 "integrity": "sha512-OL/zLggRp8mFhKL0rNORUTR4yBYujK/uU+xZL+/0Rgm2QE4nLO9v8PzEweSJEbMGKmDRjJE4R3IMJlL2di4JeQ==",
6020 "dev": true,
6021 "license": "Apache-2.0 AND MIT",
6022 "dependencies": {
6023 "es-module-lexer": "^1.5.3",
6024 "slashes": "^3.0.12"
6025 },
6026 "engines": {
6027 "node": ">= 18"
6028 }
6029 },
5894 "node_modules/parse5": {6030 "node_modules/parse5": {
5895 "version": "7.1.2",6031 "version": "7.1.2",
5896 "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",6032 "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
@@ -6600,6 +6736,19 @@
6600 "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==",6736 "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==",
6601 "license": "MIT"6737 "license": "MIT"
6602 },6738 },
6739 "node_modules/semver": {
6740 "version": "7.7.1",
6741 "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
6742 "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
6743 "dev": true,
6744 "license": "ISC",
6745 "bin": {
6746 "semver": "bin/semver.js"
6747 },
6748 "engines": {
6749 "node": ">=10"
6750 }
6751 },
6603 "node_modules/send": {6752 "node_modules/send": {
6604 "version": "0.19.0",6753 "version": "0.19.0",
6605 "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",6754 "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
@@ -6811,6 +6960,13 @@
6811 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",6960 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
6812 "license": "MIT"6961 "license": "MIT"
6813 },6962 },
6963 "node_modules/slashes": {
6964 "version": "3.0.12",
6965 "resolved": "https://registry.npmjs.org/slashes/-/slashes-3.0.12.tgz",
6966 "integrity": "sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==",
6967 "dev": true,
6968 "license": "ISC"
6969 },
6814 "node_modules/sliced": {6970 "node_modules/sliced": {
6815 "version": "1.0.1",6971 "version": "1.0.1",
6816 "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",6972 "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",
@@ -6903,6 +7059,31 @@
6903 "source-map": "^0.6.0"7059 "source-map": "^0.6.0"
6904 }7060 }
6905 },7061 },
7062 "node_modules/spdx-exceptions": {
7063 "version": "2.5.0",
7064 "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz",
7065 "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==",
7066 "dev": true,
7067 "license": "CC-BY-3.0"
7068 },
7069 "node_modules/spdx-expression-parse": {
7070 "version": "4.0.0",
7071 "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz",
7072 "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==",
7073 "dev": true,
7074 "license": "MIT",
7075 "dependencies": {
7076 "spdx-exceptions": "^2.1.0",
7077 "spdx-license-ids": "^3.0.0"
7078 }
7079 },
7080 "node_modules/spdx-license-ids": {
7081 "version": "3.0.21",
7082 "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz",
7083 "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==",
7084 "dev": true,
7085 "license": "CC0-1.0"
7086 },
6906 "node_modules/sprintf-js": {7087 "node_modules/sprintf-js": {
6907 "version": "1.1.3",7088 "version": "1.1.3",
6908 "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",7089 "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
@@ -7042,6 +7223,23 @@
7042 "node": ">=8"7223 "node": ">=8"
7043 }7224 }
7044 },7225 },
7226 "node_modules/synckit": {
7227 "version": "0.9.2",
7228 "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz",
7229 "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==",
7230 "dev": true,
7231 "license": "MIT",
7232 "dependencies": {
7233 "@pkgr/core": "^0.1.0",
7234 "tslib": "^2.6.2"
7235 },
7236 "engines": {
7237 "node": "^14.18.0 || >=16.0.0"
7238 },
7239 "funding": {
7240 "url": "https://opencollective.com/unts"
7241 }
7242 },
7045 "node_modules/tapable": {7243 "node_modules/tapable": {
7046 "version": "2.2.1",7244 "version": "2.2.1",
7047 "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",7245 "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
package.json+2 -1
@@ -140,6 +140,7 @@
140 "@types/write-file-atomic": "^4.0.3",140 "@types/write-file-atomic": "^4.0.3",
141 "@types/yargs": "^17.0.33",141 "@types/yargs": "^17.0.33",
142 "@types/yauzl": "^2.10.3",142 "@types/yauzl": "^2.10.3",
143 "eslint": "^8.57.1"143 "eslint": "^8.57.1",
144 "eslint-plugin-jsdoc": "^48.10.0"
144 }145 }
145}146}
public/index.html+9 -7
@@ -3415,13 +3415,6 @@
3415 <div class="flex-container">3415 <div class="flex-container">
3416 <select id="model_custom_select" class="text_pole model_custom_select"></select>3416 <select id="model_custom_select" class="text_pole model_custom_select"></select>
3417 </div>3417 </div>
3418 <h4 data-i18n="Prompt Post-Processing">Prompt Post-Processing</h4>
3419 <select id="custom_prompt_post_processing" class="text_pole" title="Applies additional processing to the prompt before sending it to the API." data-i18n="[title]Applies additional processing to the prompt before sending it to the API.">
3420 <option data-i18n="prompt_post_processing_none" value="">None</option>
3421 <option data-i18n="prompt_post_processing_merge" value="merge">Merge consecutive roles</option>
3422 <option data-i18n="prompt_post_processing_semi" value="semi">Semi-strict (alternating roles)</option>
3423 <option data-i18n="prompt_post_processing_strict" value="strict">Strict (user first, alternating roles)</option>
3424 </select>
3425 </form>3418 </form>
3426 <div id="01ai_form" data-source="01ai">3419 <div id="01ai_form" data-source="01ai">
3427 <h4>3420 <h4>
@@ -3440,6 +3433,15 @@
3440 <select id="model_01ai_select">3433 <select id="model_01ai_select">
3441 </select>3434 </select>
3442 </div>3435 </div>
3436 <div id="prompt_post_porcessing_form" data-source="custom,openrouter">
3437 <h4 data-i18n="Prompt Post-Processing">Prompt Post-Processing</h4>
3438 <select id="custom_prompt_post_processing" class="text_pole" title="Applies additional processing to the prompt before sending it to the API." data-i18n="[title]Applies additional processing to the prompt before sending it to the API.">
3439 <option data-i18n="prompt_post_processing_none" value="">None</option>
3440 <option data-i18n="prompt_post_processing_merge" value="merge">Merge consecutive roles</option>
3441 <option data-i18n="prompt_post_processing_semi" value="semi">Semi-strict (alternating roles)</option>
3442 <option data-i18n="prompt_post_processing_strict" value="strict">Strict (user first, alternating roles)</option>
3443 </select>
3444 </div>
3443 <div class="flex-container flex">3445 <div class="flex-container flex">
3444 <div id="api_button_openai" class="api_button menu_button menu_button_icon" type="submit" data-i18n="Connect">Connect</div>3446 <div id="api_button_openai" class="api_button menu_button menu_button_icon" type="submit" data-i18n="Connect">Connect</div>
3445 <div class="api_loading menu_button menu_button_icon" data-i18n="Cancel">Cancel</div>3447 <div class="api_loading menu_button menu_button_icon" data-i18n="Cancel">Cancel</div>
public/script.js+1 -1
@@ -595,7 +595,7 @@ let is_delete_mode = false;
595let fav_ch_checked = false;595let fav_ch_checked = false;
596let scrollLock = false;596let scrollLock = false;
597export let abortStatusCheck = new AbortController();597export let abortStatusCheck = new AbortController();
598let charDragDropHandler = null;598export let charDragDropHandler = null;
599599
600/** @type {debounce_timeout} The debounce timeout used for chat/settings save. debounce_timeout.long: 1.000 ms */600/** @type {debounce_timeout} The debounce timeout used for chat/settings save. debounce_timeout.long: 1.000 ms */
601export const DEFAULT_SAVE_EDIT_TIMEOUT = debounce_timeout.relaxed;601export const DEFAULT_SAVE_EDIT_TIMEOUT = debounce_timeout.relaxed;
public/scripts/PromptManager.js+1 -1
@@ -4,7 +4,7 @@ import { DOMPurify, Popper } from '../lib.js';
44
5import { event_types, eventSource, is_send_press, main_api, substituteParams } from '../script.js';5import { event_types, eventSource, is_send_press, main_api, substituteParams } from '../script.js';
6import { is_group_generating } from './group-chats.js';6import { is_group_generating } from './group-chats.js';
7import { Message, TokenHandler } from './openai.js';7import { Message, MessageCollection, TokenHandler } from './openai.js';
8import { power_user } from './power-user.js';8import { power_user } from './power-user.js';
9import { debounce, waitUntilCondition, escapeHtml } from './utils.js';9import { debounce, waitUntilCondition, escapeHtml } from './utils.js';
10import { debounce_timeout } from './constants.js';10import { debounce_timeout } from './constants.js';
public/scripts/autocomplete/AutoComplete.js+0 -2
@@ -3,10 +3,8 @@ import { debounce, escapeRegex } from '../utils.js';
3import { AutoCompleteOption } from './AutoCompleteOption.js';3import { AutoCompleteOption } from './AutoCompleteOption.js';
4import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';4import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';
5import { BlankAutoCompleteOption } from './BlankAutoCompleteOption.js';5import { BlankAutoCompleteOption } from './BlankAutoCompleteOption.js';
6// eslint-disable-next-line no-unused-vars
7import { AutoCompleteNameResult } from './AutoCompleteNameResult.js';6import { AutoCompleteNameResult } from './AutoCompleteNameResult.js';
8import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js';7import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js';
9import { Popup, getTopmostModalLayer } from '../popup.js';
108
11/**@readonly*/9/**@readonly*/
12/**@enum {Number}*/10/**@enum {Number}*/
public/scripts/autocomplete/AutoCompleteNameResultBase.js+0 -1
@@ -1,4 +1,3 @@
1import { SlashCommandNamedArgumentAutoCompleteOption } from '../slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js';
2import { AutoCompleteOption } from './AutoCompleteOption.js';1import { AutoCompleteOption } from './AutoCompleteOption.js';
32
43
public/scripts/autocomplete/AutoCompleteOption.js+0 -1
@@ -1,4 +1,3 @@
1import { SlashCommand } from '../slash-commands/SlashCommand.js';
2import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';1import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';
32
43
public/scripts/bookmarks.js+1 -2
@@ -1,7 +1,6 @@
1import {1import {
2 characters,2 characters,
3 saveChat,3 saveChat,
4 system_messages,
5 system_message_types,4 system_message_types,
6 this_chid,5 this_chid,
7 openCharacterChat,6 openCharacterChat,
@@ -13,7 +12,7 @@ import {
13 saveChatConditional,12 saveChatConditional,
14 saveItemizedPrompts,13 saveItemizedPrompts,
15} from '../script.js';14} from '../script.js';
16import { humanizedDateTime, getMessageTimeStamp } from './RossAscends-mods.js';15import { humanizedDateTime } from './RossAscends-mods.js';
17import {16import {
18 getGroupPastChats,17 getGroupPastChats,
19 group_activation_strategy,18 group_activation_strategy,
public/scripts/extensions/expressions/index.js+53 -15
@@ -4,7 +4,7 @@ import { characters, eventSource, event_types, generateRaw, getRequestHeaders, m
4import { dragElement, isMobile } from '../../RossAscends-mods.js';4import { dragElement, isMobile } from '../../RossAscends-mods.js';
5import { getContext, getApiUrl, modules, extension_settings, ModuleWorkerWrapper, doExtrasFetch, renderExtensionTemplateAsync } from '../../extensions.js';5import { getContext, getApiUrl, modules, extension_settings, ModuleWorkerWrapper, doExtrasFetch, renderExtensionTemplateAsync } from '../../extensions.js';
6import { loadMovingUIState, performFuzzySearch, power_user } from '../../power-user.js';6import { loadMovingUIState, performFuzzySearch, power_user } from '../../power-user.js';
7import { onlyUnique, debounce, getCharaFilename, trimToEndSentence, trimToStartSentence, waitUntilCondition, findChar } from '../../utils.js';7import { onlyUnique, debounce, getCharaFilename, trimToEndSentence, trimToStartSentence, waitUntilCondition, findChar, isFalseBoolean } from '../../utils.js';
8import { hideMutedSprites, selected_group } from '../../group-chats.js';8import { hideMutedSprites, selected_group } from '../../group-chats.js';
9import { isJsonSchemaSupported } from '../../textgen-settings.js';9import { isJsonSchemaSupported } from '../../textgen-settings.js';
10import { debounce_timeout } from '../../constants.js';10import { debounce_timeout } from '../../constants.js';
@@ -679,7 +679,7 @@ async function setSpriteFolderCommand(_, folder) {
679 return '';679 return '';
680}680}
681681
682async function classifyCallback(/** @type {{api: string?, prompt: string?}} */ { api = null, prompt = null }, text) {682async function classifyCallback(/** @type {{api: string?, filter: string?, prompt: string?}} */ { api = null, filter = null, prompt = null }, text) {
683 if (!text) {683 if (!text) {
684 toastr.error('No text provided');684 toastr.error('No text provided');
685 return '';685 return '';
@@ -690,13 +690,14 @@ async function classifyCallback(/** @type {{api: string?, prompt: string?}} */ {
690 }690 }
691691
692 const expressionApi = EXPRESSION_API[api] || extension_settings.expressions.api;692 const expressionApi = EXPRESSION_API[api] || extension_settings.expressions.api;
693 const filterAvailable = !isFalseBoolean(filter);
693694
694 if (!modules.includes('classify') && expressionApi == EXPRESSION_API.extras) {695 if (!modules.includes('classify') && expressionApi == EXPRESSION_API.extras) {
695 toastr.warning('Text classification is disabled or not available');696 toastr.warning('Text classification is disabled or not available');
696 return '';697 return '';
697 }698 }
698699
699 const label = await getExpressionLabel(text, expressionApi, { customPrompt: prompt });700 const label = await getExpressionLabel(text, expressionApi, { filterAvailable: filterAvailable, customPrompt: prompt });
700 console.debug(`Classification result for "${text}": ${label}`);701 console.debug(`Classification result for "${text}": ${label}`);
701 return label;702 return label;
702}703}
@@ -992,10 +993,11 @@ function onTextGenSettingsReady(args) {
992 * @param {string} text - The text to classify and retrieve the expression label for.993 * @param {string} text - The text to classify and retrieve the expression label for.
993 * @param {EXPRESSION_API} [expressionsApi=extension_settings.expressions.api] - The expressions API to use for classification.994 * @param {EXPRESSION_API} [expressionsApi=extension_settings.expressions.api] - The expressions API to use for classification.
994 * @param {object} [options={}] - Optional arguments.995 * @param {object} [options={}] - Optional arguments.
996 * @param {boolean?} [options.filterAvailable=null] - Whether to filter available expressions. If not specified, uses the extension setting.
995 * @param {string?} [options.customPrompt=null] - The custom prompt to use for classification.997 * @param {string?} [options.customPrompt=null] - The custom prompt to use for classification.
996 * @returns {Promise<string?>} - The label of the expression.998 * @returns {Promise<string?>} - The label of the expression.
997 */999 */
998export async function getExpressionLabel(text, expressionsApi = extension_settings.expressions.api, { customPrompt = null } = {}) {1000export async function getExpressionLabel(text, expressionsApi = extension_settings.expressions.api, { filterAvailable = null, customPrompt = null } = {}) {
999 // Return if text is undefined, saving a costly fetch request1001 // Return if text is undefined, saving a costly fetch request
1000 if ((!modules.includes('classify') && expressionsApi == EXPRESSION_API.extras) || !text) {1002 if ((!modules.includes('classify') && expressionsApi == EXPRESSION_API.extras) || !text) {
1001 return extension_settings.expressions.fallback_expression;1003 return extension_settings.expressions.fallback_expression;
@@ -1007,6 +1009,11 @@ export async function getExpressionLabel(text, expressionsApi = extension_settin
10071009
1008 text = sampleClassifyText(text);1010 text = sampleClassifyText(text);
10091011
1012 filterAvailable ??= extension_settings.expressions.filterAvailable;
1013 if (filterAvailable && ![EXPRESSION_API.llm, EXPRESSION_API.webllm].includes(expressionsApi)) {
1014 console.debug('Filter available is only supported for LLM and WebLLM expressions');
1015 }
1016
1010 try {1017 try {
1011 switch (expressionsApi) {1018 switch (expressionsApi) {
1012 // Local BERT pipeline1019 // Local BERT pipeline
@@ -1031,7 +1038,7 @@ export async function getExpressionLabel(text, expressionsApi = extension_settin
1031 return extension_settings.expressions.fallback_expression;1038 return extension_settings.expressions.fallback_expression;
1032 }1039 }
10331040
1034 const expressionsList = await getExpressionsList();1041 const expressionsList = await getExpressionsList({ filterAvailable: filterAvailable });
1035 const prompt = substituteParamsExtended(customPrompt, { labels: expressionsList }) || await getLlmPrompt(expressionsList);1042 const prompt = substituteParamsExtended(customPrompt, { labels: expressionsList }) || await getLlmPrompt(expressionsList);
1036 eventSource.once(event_types.TEXT_COMPLETION_SETTINGS_READY, onTextGenSettingsReady);1043 eventSource.once(event_types.TEXT_COMPLETION_SETTINGS_READY, onTextGenSettingsReady);
1037 const emotionResponse = await generateRaw(text, main_api, false, false, prompt);1044 const emotionResponse = await generateRaw(text, main_api, false, false, prompt);
@@ -1044,7 +1051,7 @@ export async function getExpressionLabel(text, expressionsApi = extension_settin
1044 return extension_settings.expressions.fallback_expression;1051 return extension_settings.expressions.fallback_expression;
1045 }1052 }
10461053
1047 const expressionsList = await getExpressionsList();1054 const expressionsList = await getExpressionsList({ filterAvailable: filterAvailable });
1048 const prompt = substituteParamsExtended(customPrompt, { labels: expressionsList }) || await getLlmPrompt(expressionsList);1055 const prompt = substituteParamsExtended(customPrompt, { labels: expressionsList }) || await getLlmPrompt(expressionsList);
1049 const messages = [1056 const messages = [
1050 { role: 'user', content: text + '\n\n' + prompt },1057 { role: 'user', content: text + '\n\n' + prompt },
@@ -1324,12 +1331,28 @@ function getCachedExpressions() {
1324 return [...expressionsList, ...extension_settings.expressions.custom].filter(onlyUnique);1331 return [...expressionsList, ...extension_settings.expressions.custom].filter(onlyUnique);
1325}1332}
13261333
1327export async function getExpressionsList() {1334export async function getExpressionsList({ filterAvailable = false } = {}) {
1328 // Return cached list if available1335 // If there is no cached list, load and cache it
1329 if (Array.isArray(expressionsList)) {1336 if (!Array.isArray(expressionsList)) {
1330 return getCachedExpressions();1337 expressionsList = await resolveExpressionsList();
1338 }
1339
1340 const expressions = getCachedExpressions();
1341
1342 // Filtering is only available for llm and webllm APIs
1343 if (!filterAvailable || ![EXPRESSION_API.llm, EXPRESSION_API.webllm].includes(extension_settings.expressions.api)) {
1344 return expressions;
1331 }1345 }
13321346
1347 // Get expressions with available sprites
1348 const currentLastMessage = selected_group ? getLastCharacterMessage() : null;
1349 const spriteFolderName = getSpriteFolderName(currentLastMessage, currentLastMessage?.name);
1350
1351 return expressions.filter(label => {
1352 const expression = spriteCache[spriteFolderName]?.find(x => x.label === label);
1353 return (expression?.files.length ?? 0) > 0;
1354 });
1355
1333 /**1356 /**
1334 * Returns the list of expressions from the API or fallback in offline mode.1357 * Returns the list of expressions from the API or fallback in offline mode.
1335 * @returns {Promise<string[]>}1358 * @returns {Promise<string[]>}
@@ -1376,9 +1399,6 @@ export async function getExpressionsList() {
1376 expressionsList = DEFAULT_EXPRESSIONS.slice();1399 expressionsList = DEFAULT_EXPRESSIONS.slice();
1377 return expressionsList;1400 return expressionsList;
1378 }1401 }
1379
1380 const result = await resolveExpressionsList();
1381 return [...result, ...extension_settings.expressions.custom].filter(onlyUnique);
1382}1402}
13831403
1384/**1404/**
@@ -2106,6 +2126,10 @@ function migrateSettings() {
2106 extension_settings.expressions.rerollIfSame = !!$(this).prop('checked');2126 extension_settings.expressions.rerollIfSame = !!$(this).prop('checked');
2107 saveSettingsDebounced();2127 saveSettingsDebounced();
2108 });2128 });
2129 $('#expressions_filter_available').prop('checked', extension_settings.expressions.filterAvailable).on('input', function () {
2130 extension_settings.expressions.filterAvailable = !!$(this).prop('checked');
2131 saveSettingsDebounced();
2132 });
2109 $('#expression_override_cleanup_button').on('click', onClickExpressionOverrideRemoveAllButton);2133 $('#expression_override_cleanup_button').on('click', onClickExpressionOverrideRemoveAllButton);
2110 $(document).on('dragstart', '.expression', (e) => {2134 $(document).on('dragstart', '.expression', (e) => {
2111 e.preventDefault();2135 e.preventDefault();
@@ -2283,13 +2307,13 @@ function migrateSettings() {
2283 SlashCommandParser.addCommandObject(SlashCommand.fromProps({2307 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
2284 name: 'expression-list',2308 name: 'expression-list',
2285 aliases: ['expressions'],2309 aliases: ['expressions'],
2286 /** @type {(args: {return: string}) => Promise<string>} */2310 /** @type {(args: {return: string, filter: string}) => Promise<string>} */
2287 callback: async (args) => {2311 callback: async (args) => {
2288 let returnType =2312 let returnType =
2289 /** @type {import('../../slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */2313 /** @type {import('../../slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */
2290 (args.return);2314 (args.return);
22912315
2292 const list = await getExpressionsList();2316 const list = await getExpressionsList({ filterAvailable: !isFalseBoolean(args.filter) });
22932317
2294 return await slashCommandReturnHelper.doReturn(returnType ?? 'pipe', list, { objectToStringFunc: list => list.join(', ') });2318 return await slashCommandReturnHelper.doReturn(returnType ?? 'pipe', list, { objectToStringFunc: list => list.join(', ') });
2295 },2319 },
@@ -2302,6 +2326,13 @@ function migrateSettings() {
2302 enumList: slashCommandReturnHelper.enumList({ allowObject: true }),2326 enumList: slashCommandReturnHelper.enumList({ allowObject: true }),
2303 forceEnum: true,2327 forceEnum: true,
2304 }),2328 }),
2329 SlashCommandNamedArgument.fromProps({
2330 name: 'filter',
2331 description: 'Filter the list to only include expressions that have available sprites for the current character.',
2332 typeList: [ARGUMENT_TYPE.BOOLEAN],
2333 enumList: commonEnumProviders.boolean('trueFalse')(),
2334 defaultValue: 'true',
2335 }),
2305 ],2336 ],
2306 returns: 'The comma-separated list of available expressions, including custom expressions.',2337 returns: 'The comma-separated list of available expressions, including custom expressions.',
2307 helpString: 'Returns a list of available expressions, including custom expressions.',2338 helpString: 'Returns a list of available expressions, including custom expressions.',
@@ -2318,6 +2349,13 @@ function migrateSettings() {
2318 enumList: Object.keys(EXPRESSION_API).map(api => new SlashCommandEnumValue(api, null, enumTypes.enum)),2349 enumList: Object.keys(EXPRESSION_API).map(api => new SlashCommandEnumValue(api, null, enumTypes.enum)),
2319 }),2350 }),
2320 SlashCommandNamedArgument.fromProps({2351 SlashCommandNamedArgument.fromProps({
2352 name: 'filter',
2353 description: 'Filter the list to only include expressions that have available sprites for the current character.',
2354 typeList: [ARGUMENT_TYPE.BOOLEAN],
2355 enumList: commonEnumProviders.boolean('trueFalse')(),
2356 defaultValue: 'true',
2357 }),
2358 SlashCommandNamedArgument.fromProps({
2321 name: 'prompt',2359 name: 'prompt',
2322 description: 'Custom prompt for classification. Only relevant if Classifier API is set to LLM.',2360 description: 'Custom prompt for classification. Only relevant if Classifier API is set to LLM.',
2323 typeList: [ARGUMENT_TYPE.STRING],2361 typeList: [ARGUMENT_TYPE.STRING],
public/scripts/extensions/expressions/settings.html+5 -1
@@ -29,7 +29,11 @@
29 </select>29 </select>
30 </div>30 </div>
31 <div class="expression_llm_prompt_block m-b-1 m-t-1">31 <div class="expression_llm_prompt_block m-b-1 m-t-1">
32 <label for="expression_llm_prompt" class="title_restorable">32 <label class="checkbox_label" for="expressions_filter_available" title="When using LLM or WebLLM classifier, only show and use expressions that have sprites assigned to them." data-i18n="[title]When using LLM or WebLLM classifier, only show and use expressions that have sprites assigned to them.">
33 <input id="expressions_filter_available" type="checkbox">
34 <span data-i18n="Filter expressions for available sprites">Filter expressions for available sprites</span>
35 </label>
36 <label for="expression_llm_prompt" class="title_restorable m-t-1">
33 <span data-i18n="LLM Prompt">LLM Prompt</span>37 <span data-i18n="LLM Prompt">LLM Prompt</span>
34 <div id="expression_llm_prompt_restore" title="Restore default value" class="right_menu_button">38 <div id="expression_llm_prompt_restore" title="Restore default value" class="right_menu_button">
35 <i class="fa-solid fa-clock-rotate-left fa-sm"></i>39 <i class="fa-solid fa-clock-rotate-left fa-sm"></i>
public/scripts/extensions/quick-reply/api/QuickReplyApi.js+0 -3
@@ -1,10 +1,7 @@
1// eslint-disable-next-line no-unused-vars
2import { QuickReply } from '../src/QuickReply.js';1import { QuickReply } from '../src/QuickReply.js';
3import { QuickReplyContextLink } from '../src/QuickReplyContextLink.js';2import { QuickReplyContextLink } from '../src/QuickReplyContextLink.js';
4import { QuickReplySet } from '../src/QuickReplySet.js';3import { QuickReplySet } from '../src/QuickReplySet.js';
5// eslint-disable-next-line no-unused-vars
6import { QuickReplySettings } from '../src/QuickReplySettings.js';4import { QuickReplySettings } from '../src/QuickReplySettings.js';
7// eslint-disable-next-line no-unused-vars
8import { SettingsUi } from '../src/ui/SettingsUi.js';5import { SettingsUi } from '../src/ui/SettingsUi.js';
9import { onlyUnique } from '../../../utils.js';6import { onlyUnique } from '../../../utils.js';
107
public/scripts/extensions/quick-reply/src/AutoExecuteHandler.js+0 -2
@@ -1,7 +1,5 @@
1import { warn } from '../index.js';1import { warn } from '../index.js';
2// eslint-disable-next-line no-unused-vars
3import { QuickReply } from './QuickReply.js';2import { QuickReply } from './QuickReply.js';
4// eslint-disable-next-line no-unused-vars
5import { QuickReplySettings } from './QuickReplySettings.js';3import { QuickReplySettings } from './QuickReplySettings.js';
64
7export class AutoExecuteHandler {5export class AutoExecuteHandler {
public/scripts/extensions/quick-reply/src/QuickReply.js+0 -2
@@ -635,7 +635,6 @@ export class QuickReply {
635 }, { passive:true });635 }, { passive:true });
636 const getLineStart = ()=>{636 const getLineStart = ()=>{
637 const start = message.selectionStart;637 const start = message.selectionStart;
638 const end = message.selectionEnd;
639 let lineStart;638 let lineStart;
640 if (start == 0 || message.value[start - 1] == '\n') {639 if (start == 0 || message.value[start - 1] == '\n') {
641 // cursor is already at beginning of line640 // cursor is already at beginning of line
@@ -701,7 +700,6 @@ export class QuickReply {
701 } else if (evt.key == 'Enter' && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !(ac.isReplaceable && ac.isActive)) {700 } else if (evt.key == 'Enter' && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !(ac.isReplaceable && ac.isActive)) {
702 // new line, keep indent701 // new line, keep indent
703 const start = message.selectionStart;702 const start = message.selectionStart;
704 const end = message.selectionEnd;
705 let lineStart = getLineStart();703 let lineStart = getLineStart();
706 const indent = /^([^\S\n]*)/.exec(message.value.slice(lineStart))[1] ?? '';704 const indent = /^([^\S\n]*)/.exec(message.value.slice(lineStart))[1] ?? '';
707 if (indent.length) {705 if (indent.length) {
public/scripts/extensions/quick-reply/src/SlashCommandHandler.js+0 -1
@@ -8,7 +8,6 @@ import { SlashCommandEnumValue, enumTypes } from '../../../slash-commands/SlashC
8import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js';8import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js';
9import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js';9import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js';
10import { isTrueBoolean } from '../../../utils.js';10import { isTrueBoolean } from '../../../utils.js';
11// eslint-disable-next-line no-unused-vars
12import { QuickReplyApi } from '../api/QuickReplyApi.js';11import { QuickReplyApi } from '../api/QuickReplyApi.js';
13import { QuickReply } from './QuickReply.js';12import { QuickReply } from './QuickReply.js';
14import { QuickReplySet } from './QuickReplySet.js';13import { QuickReplySet } from './QuickReplySet.js';
public/scripts/extensions/quick-reply/src/ui/ButtonUi.js+0 -1
@@ -1,7 +1,6 @@
1import { animation_duration } from '../../../../../script.js';1import { animation_duration } from '../../../../../script.js';
2import { dragElement } from '../../../../RossAscends-mods.js';2import { dragElement } from '../../../../RossAscends-mods.js';
3import { loadMovingUIState } from '../../../../power-user.js';3import { loadMovingUIState } from '../../../../power-user.js';
4// eslint-disable-next-line no-unused-vars
5import { QuickReplySettings } from '../QuickReplySettings.js';4import { QuickReplySettings } from '../QuickReplySettings.js';
65
7export class ButtonUi {6export class ButtonUi {
public/scripts/extensions/quick-reply/src/ui/SettingsUi.js+0 -1
@@ -3,7 +3,6 @@ import { getSortableDelay } from '../../../../utils.js';
3import { log, warn } from '../../index.js';3import { log, warn } from '../../index.js';
4import { QuickReply } from '../QuickReply.js';4import { QuickReply } from '../QuickReply.js';
5import { QuickReplySet } from '../QuickReplySet.js';5import { QuickReplySet } from '../QuickReplySet.js';
6// eslint-disable-next-line no-unused-vars
7import { QuickReplySettings } from '../QuickReplySettings.js';6import { QuickReplySettings } from '../QuickReplySettings.js';
87
9export class SettingsUi {8export class SettingsUi {
public/scripts/extensions/quick-reply/src/ui/ctx/ContextMenu.js+0 -1
@@ -1,5 +1,4 @@
1import { QuickReply } from '../../QuickReply.js';1import { QuickReply } from '../../QuickReply.js';
2// eslint-disable-next-line no-unused-vars
3import { QuickReplySet } from '../../QuickReplySet.js';2import { QuickReplySet } from '../../QuickReplySet.js';
4import { MenuHeader } from './MenuHeader.js';3import { MenuHeader } from './MenuHeader.js';
5import { MenuItem } from './MenuItem.js';4import { MenuItem } from './MenuItem.js';
public/scripts/extensions/stable-diffusion/index.js+0 -1
@@ -3772,7 +3772,6 @@ async function addSDGenButtons() {
3772 $('#sd_wand_container').append(buttonHtml);3772 $('#sd_wand_container').append(buttonHtml);
3773 $(document.body).append(dropdownHtml);3773 $(document.body).append(dropdownHtml);
37743774
3775 const messageButton = $('.sd_message_gen');
3776 const button = $('#sd_gen');3775 const button = $('#sd_gen');
3777 const dropdown = $('#sd_dropdown');3776 const dropdown = $('#sd_dropdown');
3778 dropdown.hide();3777 dropdown.hide();
public/scripts/extensions/token-counter/index.js+0 -0
public/scripts/extensions/tts/gpt-sovits-v2.js+0 -2
@@ -183,8 +183,6 @@ class GptSovitsV2Provider {
183183
184 let prompt_text = replaceSpeaker(voiceId);184 let prompt_text = replaceSpeaker(voiceId);
185185
186 const streaming = this.settings.streaming;
187
188 const params = {186 const params = {
189 text: inputText,187 text: inputText,
190 prompt_text: prompt_text,188 prompt_text: prompt_text,
public/scripts/extensions/tts/index.js+1 -1
@@ -1,5 +1,5 @@
1import { cancelTtsPlay, eventSource, event_types, getCurrentChatId, isStreamingEnabled, name2, saveSettingsDebounced, substituteParams } from '../../../script.js';1import { cancelTtsPlay, eventSource, event_types, getCurrentChatId, isStreamingEnabled, name2, saveSettingsDebounced, substituteParams } from '../../../script.js';
2import { ModuleWorkerWrapper, doExtrasFetch, extension_settings, getApiUrl, getContext, modules, renderExtensionTemplateAsync } from '../../extensions.js';2import { ModuleWorkerWrapper, extension_settings, getContext, renderExtensionTemplateAsync } from '../../extensions.js';
3import { delay, escapeRegex, getBase64Async, getStringHash, onlyUnique } from '../../utils.js';3import { delay, escapeRegex, getBase64Async, getStringHash, onlyUnique } from '../../utils.js';
4import { EdgeTtsProvider } from './edge.js';4import { EdgeTtsProvider } from './edge.js';
5import { ElevenLabsTtsProvider } from './elevenlabs.js';5import { ElevenLabsTtsProvider } from './elevenlabs.js';
public/scripts/group-chats.js+0 -1
@@ -46,7 +46,6 @@ import {
46 hideSwipeButtons,46 hideSwipeButtons,
47 chat_metadata,47 chat_metadata,
48 updateChatMetadata,48 updateChatMetadata,
49 isStreamingEnabled,
50 getThumbnailUrl,49 getThumbnailUrl,
51 getRequestHeaders,50 getRequestHeaders,
52 setMenuType,51 setMenuType,
public/scripts/nai-settings.js+1 -0
@@ -795,6 +795,7 @@ export function parseNovelAILogprobs(data) {
795795
796 // Add the chosen token to `merged` if it's not already there. This can796 // Add the chosen token to `merged` if it's not already there. This can
797 // happen if the chosen token was not among the top 10 most likely ones.797 // happen if the chosen token was not among the top 10 most likely ones.
798 // eslint-disable-next-line no-unused-vars
798 const [[chosenId], [_, chosenAfter]] = data.chosen[0];799 const [[chosenId], [_, chosenAfter]] = data.chosen[0];
799 if (!merged.some(([id]) => id === chosenId)) {800 if (!merged.some(([id]) => id === chosenId)) {
800 merged.push([chosenId, chosenAfter]);801 merged.push([chosenId, chosenAfter]);
public/scripts/openai.js+1 -1
@@ -2020,6 +2020,7 @@ async function sendOpenAIRequest(type, messages, signal) {
2020 'reasoning_effort': String(oai_settings.reasoning_effort),2020 'reasoning_effort': String(oai_settings.reasoning_effort),
2021 'enable_web_search': Boolean(oai_settings.enable_web_search),2021 'enable_web_search': Boolean(oai_settings.enable_web_search),
2022 'request_images': Boolean(oai_settings.request_images),2022 'request_images': Boolean(oai_settings.request_images),
2023 'custom_prompt_post_processing': oai_settings.custom_prompt_post_processing,
2023 };2024 };
20242025
2025 if (!canMultiSwipe && ToolManager.canPerformToolCalls(type)) {2026 if (!canMultiSwipe && ToolManager.canPerformToolCalls(type)) {
@@ -2100,7 +2101,6 @@ async function sendOpenAIRequest(type, messages, signal) {
2100 generate_data['custom_include_body'] = oai_settings.custom_include_body;2101 generate_data['custom_include_body'] = oai_settings.custom_include_body;
2101 generate_data['custom_exclude_body'] = oai_settings.custom_exclude_body;2102 generate_data['custom_exclude_body'] = oai_settings.custom_exclude_body;
2102 generate_data['custom_include_headers'] = oai_settings.custom_include_headers;2103 generate_data['custom_include_headers'] = oai_settings.custom_include_headers;
2103 generate_data['custom_prompt_post_processing'] = oai_settings.custom_prompt_post_processing;
2104 }2104 }
21052105
2106 if (isCohere) {2106 if (isCohere) {
public/scripts/slash-commands.js+5 -3
@@ -69,12 +69,14 @@ import { SlashCommand } from './slash-commands/SlashCommand.js';
69import { SlashCommandAbortController } from './slash-commands/SlashCommandAbortController.js';69import { SlashCommandAbortController } from './slash-commands/SlashCommandAbortController.js';
70import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashCommandNamedArgumentAssignment.js';70import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashCommandNamedArgumentAssignment.js';
71import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';71import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
72import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js';72import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js';
73import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';73import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
74import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakController.js';74import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakController.js';
75import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js';75import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js';
76import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js';76import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js';
77import { accountStorage } from './util/AccountStorage.js';77import { accountStorage } from './util/AccountStorage.js';
78import { SlashCommandDebugController } from './slash-commands/SlashCommandDebugController.js';
79import { SlashCommandScope } from './slash-commands/SlashCommandScope.js';
78export {80export {
79 executeSlashCommands, executeSlashCommandsWithOptions, getSlashCommandsHelp, registerSlashCommand,81 executeSlashCommands, executeSlashCommandsWithOptions, getSlashCommandsHelp, registerSlashCommand,
80};82};
@@ -4345,7 +4347,7 @@ const clearCommandProgressDebounced = debounce(clearCommandProgress);
4345 * @prop {boolean} [handleParserErrors] (true) Whether to handle parser errors (show toast on error) or throw.4347 * @prop {boolean} [handleParserErrors] (true) Whether to handle parser errors (show toast on error) or throw.
4346 * @prop {SlashCommandScope} [scope] (null) The scope to be used when executing the commands.4348 * @prop {SlashCommandScope} [scope] (null) The scope to be used when executing the commands.
4347 * @prop {boolean} [handleExecutionErrors] (false) Whether to handle execution errors (show toast on error) or throw4349 * @prop {boolean} [handleExecutionErrors] (false) Whether to handle execution errors (show toast on error) or throw
4348 * @prop {{[id:PARSER_FLAG]:boolean}} [parserFlags] (null) Parser flags to apply4350 * @prop {import('./slash-commands/SlashCommandParser.js').ParserFlags} [parserFlags] (null) Parser flags to apply
4349 * @prop {SlashCommandAbortController} [abortController] (null) Controller used to abort or pause command execution4351 * @prop {SlashCommandAbortController} [abortController] (null) Controller used to abort or pause command execution
4350 * @prop {SlashCommandDebugController} [debugController] (null) Controller used to control debug execution4352 * @prop {SlashCommandDebugController} [debugController] (null) Controller used to control debug execution
4351 * @prop {(done:number, total:number)=>void} [onProgress] (null) Callback to handle progress events4353 * @prop {(done:number, total:number)=>void} [onProgress] (null) Callback to handle progress events
@@ -4355,7 +4357,7 @@ const clearCommandProgressDebounced = debounce(clearCommandProgress);
4355/**4357/**
4356 * @typedef ExecuteSlashCommandsOnChatInputOptions4358 * @typedef ExecuteSlashCommandsOnChatInputOptions
4357 * @prop {SlashCommandScope} [scope] (null) The scope to be used when executing the commands.4359 * @prop {SlashCommandScope} [scope] (null) The scope to be used when executing the commands.
4358 * @prop {{[id:PARSER_FLAG]:boolean}} [parserFlags] (null) Parser flags to apply4360 * @prop {import('./slash-commands/SlashCommandParser.js').ParserFlags} [parserFlags] (null) Parser flags to apply
4359 * @prop {boolean} [clearChatInput] (false) Whether to clear the chat input textarea4361 * @prop {boolean} [clearChatInput] (false) Whether to clear the chat input textarea
4360 * @prop {string} [source] (null) String indicating where the code come from (e.g., QR name)4362 * @prop {string} [source] (null) String indicating where the code come from (e.g., QR name)
4361 */4363 */
public/scripts/slash-commands/SlashCommand.js+1 -5
@@ -3,16 +3,12 @@ import { SlashCommandAbortController } from './SlashCommandAbortController.js';
3import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandArgument.js';3import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandArgument.js';
4import { SlashCommandClosure } from './SlashCommandClosure.js';4import { SlashCommandClosure } from './SlashCommandClosure.js';
5import { SlashCommandDebugController } from './SlashCommandDebugController.js';5import { SlashCommandDebugController } from './SlashCommandDebugController.js';
6import { PARSER_FLAG } from './SlashCommandParser.js';
7import { SlashCommandScope } from './SlashCommandScope.js';6import { SlashCommandScope } from './SlashCommandScope.js';
87
9
10
11
12/**8/**
13 * @typedef {{9 * @typedef {{
14 * _scope:SlashCommandScope,10 * _scope:SlashCommandScope,
15 * _parserFlags:{[id:PARSER_FLAG]:boolean},11 * _parserFlags:import('./SlashCommandParser.js').ParserFlags,
16 * _abortController:SlashCommandAbortController,12 * _abortController:SlashCommandAbortController,
17 * _debugController:SlashCommandDebugController,13 * _debugController:SlashCommandDebugController,
18 * _hasUnnamedArgument:boolean,14 * _hasUnnamedArgument:boolean,
public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js+0 -3
@@ -1,9 +1,6 @@
1import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';1import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';
2import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js';
3import { AutoCompleteSecondaryNameResult } from '../autocomplete/AutoCompleteSecondaryNameResult.js';2import { AutoCompleteSecondaryNameResult } from '../autocomplete/AutoCompleteSecondaryNameResult.js';
4import { SlashCommand } from './SlashCommand.js';3import { SlashCommand } from './SlashCommand.js';
5import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
6import { SlashCommandClosure } from './SlashCommandClosure.js';
7import { SlashCommandCommandAutoCompleteOption } from './SlashCommandCommandAutoCompleteOption.js';4import { SlashCommandCommandAutoCompleteOption } from './SlashCommandCommandAutoCompleteOption.js';
8import { SlashCommandEnumAutoCompleteOption } from './SlashCommandEnumAutoCompleteOption.js';5import { SlashCommandEnumAutoCompleteOption } from './SlashCommandEnumAutoCompleteOption.js';
9import { SlashCommandExecutor } from './SlashCommandExecutor.js';6import { SlashCommandExecutor } from './SlashCommandExecutor.js';
public/scripts/slash-commands/SlashCommandClosure.js+0 -3
@@ -2,7 +2,6 @@ import { substituteParams } from '../../script.js';
2import { delay, escapeRegex, uuidv4 } from '../utils.js';2import { delay, escapeRegex, uuidv4 } from '../utils.js';
3import { SlashCommand } from './SlashCommand.js';3import { SlashCommand } from './SlashCommand.js';
4import { SlashCommandAbortController } from './SlashCommandAbortController.js';4import { SlashCommandAbortController } from './SlashCommandAbortController.js';
5import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
6import { SlashCommandBreak } from './SlashCommandBreak.js';5import { SlashCommandBreak } from './SlashCommandBreak.js';
7import { SlashCommandBreakController } from './SlashCommandBreakController.js';6import { SlashCommandBreakController } from './SlashCommandBreakController.js';
8import { SlashCommandBreakPoint } from './SlashCommandBreakPoint.js';7import { SlashCommandBreakPoint } from './SlashCommandBreakPoint.js';
@@ -16,9 +15,7 @@ import { SlashCommandScope } from './SlashCommandScope.js';
16export class SlashCommandClosure {15export class SlashCommandClosure {
17 /** @type {SlashCommandScope} */ scope;16 /** @type {SlashCommandScope} */ scope;
18 /** @type {boolean} */ executeNow = false;17 /** @type {boolean} */ executeNow = false;
19 // @ts-ignore
20 /** @type {SlashCommandNamedArgumentAssignment[]} */ argumentList = [];18 /** @type {SlashCommandNamedArgumentAssignment[]} */ argumentList = [];
21 // @ts-ignore
22 /** @type {SlashCommandNamedArgumentAssignment[]} */ providedArgumentList = [];19 /** @type {SlashCommandNamedArgumentAssignment[]} */ providedArgumentList = [];
23 /** @type {SlashCommandExecutor[]} */ executorList = [];20 /** @type {SlashCommandExecutor[]} */ executorList = [];
24 /** @type {SlashCommandAbortController} */ abortController;21 /** @type {SlashCommandAbortController} */ abortController;
public/scripts/slash-commands/SlashCommandDebugController.js+0 -0
public/scripts/slash-commands/SlashCommandEnumValue.js+0 -4
@@ -1,7 +1,3 @@
1import { SlashCommandExecutor } from './SlashCommandExecutor.js';
2import { SlashCommandScope } from './SlashCommandScope.js';
3
4
5/**1/**
6 * @typedef {'enum' | 'command' | 'namedArgument' | 'variable' | 'qr' | 'macro' | 'number' | 'name'} EnumType2 * @typedef {'enum' | 'command' | 'namedArgument' | 'variable' | 'qr' | 'macro' | 'number' | 'name'} EnumType
7 */3 */
public/scripts/slash-commands/SlashCommandExecutor.js+1 -6
@@ -1,11 +1,7 @@
1// eslint-disable-next-line no-unused-vars
2import { uuidv4 } from '../utils.js';1import { uuidv4 } from '../utils.js';
3import { SlashCommand } from './SlashCommand.js';2import { SlashCommand } from './SlashCommand.js';
4// eslint-disable-next-line no-unused-vars
5import { SlashCommandClosure } from './SlashCommandClosure.js';3import { SlashCommandClosure } from './SlashCommandClosure.js';
6import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';4import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
7// eslint-disable-next-line no-unused-vars
8import { PARSER_FLAG } from './SlashCommandParser.js';
9import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';5import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';
106
11export class SlashCommandExecutor {7export class SlashCommandExecutor {
@@ -29,10 +25,9 @@ export class SlashCommandExecutor {
29 }25 }
30 }26 }
31 /** @type {SlashCommand} */ command;27 /** @type {SlashCommand} */ command;
32 // @ts-ignore
33 /** @type {SlashCommandNamedArgumentAssignment[]} */ namedArgumentList = [];28 /** @type {SlashCommandNamedArgumentAssignment[]} */ namedArgumentList = [];
34 /** @type {SlashCommandUnnamedArgumentAssignment[]} */ unnamedArgumentList = [];29 /** @type {SlashCommandUnnamedArgumentAssignment[]} */ unnamedArgumentList = [];
35 /**@type {{[id:PARSER_FLAG]:boolean}} */ parserFlags;30 /** @type {import('./SlashCommandParser.js').ParserFlags} */ parserFlags;
3631
37 get commandCount() {32 get commandCount() {
38 return 133 return 1
public/scripts/slash-commands/SlashCommandNamedArgumentAssignment.js+0 -0
public/scripts/slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js+0 -1
@@ -1,7 +1,6 @@
1import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js';1import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js';
2import { SlashCommand } from './SlashCommand.js';2import { SlashCommand } from './SlashCommand.js';
3import { SlashCommandNamedArgument } from './SlashCommandArgument.js';3import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
4import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
54
6export class SlashCommandNamedArgumentAutoCompleteOption extends AutoCompleteOption {5export class SlashCommandNamedArgumentAutoCompleteOption extends AutoCompleteOption {
7 /** @type {SlashCommandNamedArgument} */ arg;6 /** @type {SlashCommandNamedArgument} */ arg;
public/scripts/slash-commands/SlashCommandParser.js+5 -6
@@ -8,11 +8,9 @@ import { SlashCommandExecutor } from './SlashCommandExecutor.js';
8import { SlashCommandParserError } from './SlashCommandParserError.js';8import { SlashCommandParserError } from './SlashCommandParserError.js';
9import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';9import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';
10import { SlashCommandQuickReplyAutoCompleteOption } from './SlashCommandQuickReplyAutoCompleteOption.js';10import { SlashCommandQuickReplyAutoCompleteOption } from './SlashCommandQuickReplyAutoCompleteOption.js';
11// eslint-disable-next-line no-unused-vars
12import { SlashCommandScope } from './SlashCommandScope.js';11import { SlashCommandScope } from './SlashCommandScope.js';
13import { SlashCommandVariableAutoCompleteOption } from './SlashCommandVariableAutoCompleteOption.js';12import { SlashCommandVariableAutoCompleteOption } from './SlashCommandVariableAutoCompleteOption.js';
14import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';13import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
15// eslint-disable-next-line no-unused-vars
16import { SlashCommandAbortController } from './SlashCommandAbortController.js';14import { SlashCommandAbortController } from './SlashCommandAbortController.js';
17import { SlashCommandAutoCompleteNameResult } from './SlashCommandAutoCompleteNameResult.js';15import { SlashCommandAutoCompleteNameResult } from './SlashCommandAutoCompleteNameResult.js';
18import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';16import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';
@@ -28,15 +26,17 @@ import { t } from '../i18n.js';
28/** @typedef {import('./SlashCommand.js').NamedArgumentsCapture} NamedArgumentsCapture */26/** @typedef {import('./SlashCommand.js').NamedArgumentsCapture} NamedArgumentsCapture */
29/** @typedef {import('./SlashCommand.js').NamedArguments} NamedArguments */27/** @typedef {import('./SlashCommand.js').NamedArguments} NamedArguments */
3028
31/**@readonly*/29/**
32/**@enum {Number}*/30 * @enum {Number}
31 * @readonly
32 * @typedef {{[id:PARSER_FLAG]:boolean}} ParserFlags
33 */
33export const PARSER_FLAG = {34export const PARSER_FLAG = {
34 'STRICT_ESCAPING': 1,35 'STRICT_ESCAPING': 1,
35 'REPLACE_GETVAR': 2,36 'REPLACE_GETVAR': 2,
36};37};
3738
38export class SlashCommandParser {39export class SlashCommandParser {
39 // @ts-ignore
40 /** @type {Object.<string, SlashCommand>} */ static commands = {};40 /** @type {Object.<string, SlashCommand>} */ static commands = {};
4141
42 /**42 /**
@@ -101,7 +101,6 @@ export class SlashCommandParser {
101 get commands() {101 get commands() {
102 return SlashCommandParser.commands;102 return SlashCommandParser.commands;
103 }103 }
104 // @ts-ignore
105 /** @type {Object.<string, string>} */ helpStrings = {};104 /** @type {Object.<string, string>} */ helpStrings = {};
106 /** @type {boolean} */ verifyCommandNames = true;105 /** @type {boolean} */ verifyCommandNames = true;
107 /** @type {string} */ text;106 /** @type {string} */ text;
public/scripts/slash-commands/SlashCommandScope.js+0 -0
public/scripts/slash-commands/SlashCommandUnnamedArgumentAssignment.js+0 -0
public/scripts/tags.js+0 -1
@@ -13,7 +13,6 @@ import {
13 DEFAULT_PRINT_TIMEOUT,13 DEFAULT_PRINT_TIMEOUT,
14 printCharacters,14 printCharacters,
15} from '../script.js';15} from '../script.js';
16// eslint-disable-next-line no-unused-vars
17import { FILTER_TYPES, FILTER_STATES, DEFAULT_FILTER_STATE, isFilterState, FilterHelper } from './filters.js';16import { FILTER_TYPES, FILTER_STATES, DEFAULT_FILTER_STATE, isFilterState, FilterHelper } from './filters.js';
1817
19import { groupCandidatesFilter, groups, selected_group } from './group-chats.js';18import { groupCandidatesFilter, groups, selected_group } from './group-chats.js';
public/scripts/variables.js+2 -2
@@ -9,7 +9,7 @@ import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
9import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js';9import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js';
10import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';10import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
11import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';11import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
12import { PARSER_FLAG, SlashCommandParser } from './slash-commands/SlashCommandParser.js';12import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
13import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js';13import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js';
14import { SlashCommandScope } from './slash-commands/SlashCommandScope.js';14import { SlashCommandScope } from './slash-commands/SlashCommandScope.js';
15import { isFalseBoolean, convertValueType, isTrueBoolean } from './utils.js';15import { isFalseBoolean, convertValueType, isTrueBoolean } from './utils.js';
@@ -583,7 +583,7 @@ export function evalBoolean(rule, a, b) {
583 * Executes a slash command from a string (may be enclosed in quotes) and returns the result.583 * Executes a slash command from a string (may be enclosed in quotes) and returns the result.
584 * @param {string} command Command to execute. May contain escaped macro and batch separators.584 * @param {string} command Command to execute. May contain escaped macro and batch separators.
585 * @param {SlashCommandScope} [scope] The scope to use.585 * @param {SlashCommandScope} [scope] The scope to use.
586 * @param {{[id:PARSER_FLAG]:boolean}} [parserFlags] The parser flags to use.586 * @param {import('./slash-commands/SlashCommandParser.js').ParserFlags} [parserFlags] The parser flags to use.
587 * @param {SlashCommandAbortController} [abortController] The abort controller to use.587 * @param {SlashCommandAbortController} [abortController] The abort controller to use.
588 * @returns {Promise<SlashCommandClosureResult>} Closure execution result588 * @returns {Promise<SlashCommandClosureResult>} Closure execution result
589 */589 */
public/scripts/world-info.js+1 -1
@@ -1,6 +1,6 @@
1import { Fuse } from '../lib.js';1import { Fuse } from '../lib.js';
22
3import { saveSettings, callPopup, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types, getExtensionPromptByName, saveMetadata, getCurrentChatId, extension_prompt_roles } from '../script.js';3import { saveSettings, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types, getExtensionPromptByName, saveMetadata, getCurrentChatId, extension_prompt_roles } from '../script.js';
4import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, getSortableDelay, escapeRegex, PAGINATION_TEMPLATE, navigation_option, waitUntilCondition, isTrueBoolean, setValueByPath, flashHighlight, select2ModifyOptions, getSelect2OptionId, dynamicSelect2DataViaAjax, highlightRegex, select2ChoiceClickSubscribe, isFalseBoolean, getSanitizedFilename, checkOverwriteExistingData, getStringHash, parseStringArray, cancelDebounce, findChar, onlyUnique } from './utils.js';4import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, getSortableDelay, escapeRegex, PAGINATION_TEMPLATE, navigation_option, waitUntilCondition, isTrueBoolean, setValueByPath, flashHighlight, select2ModifyOptions, getSelect2OptionId, dynamicSelect2DataViaAjax, highlightRegex, select2ChoiceClickSubscribe, isFalseBoolean, getSanitizedFilename, checkOverwriteExistingData, getStringHash, parseStringArray, cancelDebounce, findChar, onlyUnique } from './utils.js';
5import { extension_settings, getContext } from './extensions.js';5import { extension_settings, getContext } from './extensions.js';
6import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from './authors-note.js';6import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from './authors-note.js';
src/endpoints/backends/chat-completions.js+9 -8
@@ -1048,6 +1048,15 @@ router.post('/generate', function (request, response) {
1048 let bodyParams;1048 let bodyParams;
1049 const isTextCompletion = Boolean(request.body.model && TEXT_COMPLETION_MODELS.includes(request.body.model)) || typeof request.body.messages === 'string';1049 const isTextCompletion = Boolean(request.body.model && TEXT_COMPLETION_MODELS.includes(request.body.model)) || typeof request.body.messages === 'string';
10501050
1051 const postProcessTypes = [CHAT_COMPLETION_SOURCES.CUSTOM, CHAT_COMPLETION_SOURCES.OPENROUTER];
1052 if (Array.isArray(request.body.messages) && postProcessTypes.includes(request.body.chat_completion_source) && request.body.custom_prompt_post_processing) {
1053 console.info('Applying custom prompt post-processing of type', request.body.custom_prompt_post_processing);
1054 request.body.messages = postProcessPrompt(
1055 request.body.messages,
1056 request.body.custom_prompt_post_processing,
1057 getPromptNames(request));
1058 }
1059
1051 if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.OPENAI) {1060 if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.OPENAI) {
1052 apiUrl = new URL(request.body.reverse_proxy || API_OPENAI).toString();1061 apiUrl = new URL(request.body.reverse_proxy || API_OPENAI).toString();
1053 apiKey = request.body.reverse_proxy ? request.body.proxy_password : readSecret(request.user.directories, SECRET_KEYS.OPENAI);1062 apiKey = request.body.reverse_proxy ? request.body.proxy_password : readSecret(request.user.directories, SECRET_KEYS.OPENAI);
@@ -1121,14 +1130,6 @@ router.post('/generate', function (request, response) {
11211130
1122 mergeObjectWithYaml(bodyParams, request.body.custom_include_body);1131 mergeObjectWithYaml(bodyParams, request.body.custom_include_body);
1123 mergeObjectWithYaml(headers, request.body.custom_include_headers);1132 mergeObjectWithYaml(headers, request.body.custom_include_headers);
1124
1125 if (request.body.custom_prompt_post_processing) {
1126 console.info('Applying custom prompt post-processing of type', request.body.custom_prompt_post_processing);
1127 request.body.messages = postProcessPrompt(
1128 request.body.messages,
1129 request.body.custom_prompt_post_processing,
1130 getPromptNames(request));
1131 }
1132 } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.PERPLEXITY) {1133 } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.PERPLEXITY) {
1133 apiUrl = API_PERPLEXITY;1134 apiUrl = API_PERPLEXITY;
1134 apiKey = readSecret(request.user.directories, SECRET_KEYS.PERPLEXITY);1135 apiKey = readSecret(request.user.directories, SECRET_KEYS.PERPLEXITY);
src/endpoints/chats.js+4 -5
@@ -783,12 +783,11 @@ router.post('/search', validateAvatarUrlMiddleware, function (request, response)
783 continue;783 continue;
784 }784 }
785785
786 // Search through messages786 // Search through title and messages of the chat
787 const fragments = query.trim().toLowerCase().split(/\s+/).filter(x => x);787 const fragments = query.trim().toLowerCase().split(/\s+/).filter(x => x);
788 const hasMatch = messages.some(message => {788 const text = [path.parse(chatFile.path).name,
789 const text = message?.mes?.toLowerCase();789 ...messages.map(message => message?.mes)].join('\n').toLowerCase();
790 return text && fragments.every(fragment => text.includes(fragment));790 const hasMatch = fragments.every(fragment => text.includes(fragment));
791 });
792791
793 if (hasMatch) {792 if (hasMatch) {
794 results.push({793 results.push({