diff --git a/.dockerignore b/.dockerignore index 482a98310..c09fb4d2a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,5 @@ node_modules npm-debug.log readme* -Start.bat \ No newline at end of file +Start.bat +/dist \ No newline at end of file diff --git a/.github/workflows/build-and-publish-release-dev.yml b/.github/workflows/build-and-publish-release-dev.yml new file mode 100644 index 000000000..0c740892b --- /dev/null +++ b/.github/workflows/build-and-publish-release-dev.yml @@ -0,0 +1,37 @@ +name: Build and Publish Release (Dev) + +on: + push: + branches: + - dev + +jobs: + build_and_publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + + - name: Install dependencies + run: npm ci + + - name: Build and package with pkg + run: | + npm install -g pkg + npm run pkg + + - name: Upload binaries to release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + tag_name: ci-dev + name: Continuous Release (Dev) + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-and-publish-release-main.yml b/.github/workflows/build-and-publish-release-main.yml new file mode 100644 index 000000000..ac8eeb03b --- /dev/null +++ b/.github/workflows/build-and-publish-release-main.yml @@ -0,0 +1,37 @@ +name: Build and Publish Release (Main) + +on: + push: + branches: + - main + +jobs: + build_and_publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + + - name: Install dependencies + run: npm ci + + - name: Build and package with pkg + run: | + npm install -g pkg + npm run pkg + + - name: Upload binaries to release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + tag_name: ci-main + name: Continuous Release (Main) + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 46eeaf2a6..531d61538 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ public/settings.json whitelist.txt .vscode secrets.json +/dist \ No newline at end of file diff --git a/.npmignore b/.npmignore index 3311d99ac..56439f095 100644 --- a/.npmignore +++ b/.npmignore @@ -2,3 +2,5 @@ node_modules/ /uploads/ .DS_Store /thumbnails +secrets.json +/dist \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index bb3573a7f..ea8a4457f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "AGPL-3.0", "dependencies": { "@dqbd/tiktoken": "^1.0.2", - "axios": "^1.3.4", + "axios": "^0.27.2", "command-exists": "^1.2.9", "compression": "^1", "cookie-parser": "^1.4.6", @@ -42,6 +42,68 @@ }, "bin": { "sillytavern": "server.js" + }, + "devDependencies": { + "pkg": "^5.8.1", + "pkg-fetch": "^3.5.2" + } + }, + "node_modules/@babel/generator": { + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.2.tgz", + "integrity": "sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.18.2", + "@jridgewell/gen-mapping": "^0.3.0", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz", + "integrity": "sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.18.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.4.tgz", + "integrity": "sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.0.tgz", + "integrity": "sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.18.10", + "@babel/helper-validator-identifier": "^7.18.6", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@dqbd/tiktoken": { @@ -419,6 +481,95 @@ "regenerator-runtime": "^0.13.3" } }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@tokenizer/token": { "version": "0.3.0", "license": "MIT" @@ -446,6 +597,18 @@ "node": ">= 0.6" } }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "license": "MIT", @@ -482,17 +645,35 @@ "version": "2.1.3", "license": "ISC" }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/asynckit": { "version": "0.4.0", "license": "MIT" }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/axios": { - "version": "1.3.4", - "license": "MIT", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" } }, "node_modules/balanced-match": { @@ -517,6 +698,31 @@ ], "license": "MIT" }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/bmp-js": { "version": "0.1.0", "license": "MIT" @@ -562,6 +768,18 @@ "concat-map": "0.0.1" } }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/buffer": { "version": "5.7.1", "funding": [ @@ -622,6 +840,28 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, "node_modules/cliui": { "version": "8.0.1", "license": "ISC", @@ -818,6 +1058,30 @@ } } }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/define-lazy-prop": { "version": "2.0.0", "license": "MIT", @@ -847,6 +1111,15 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/detect-libc": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz", + "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/device-detector-js": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/device-detector-js/-/device-detector-js-3.0.3.tgz", @@ -855,6 +1128,18 @@ "node": ">= 8.11.4" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/dom-walk": { "version": "0.1.2" }, @@ -873,6 +1158,15 @@ "node": ">= 0.8" } }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/escalade": { "version": "3.1.1", "license": "MIT", @@ -902,6 +1196,15 @@ "@xmldom/xmldom": "^0.7.8" } }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/express": { "version": "4.18.2", "license": "MIT", @@ -953,6 +1256,31 @@ "version": "2.0.0", "license": "MIT" }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/file-type": { "version": "16.5.4", "license": "MIT", @@ -968,6 +1296,18 @@ "url": "https://github.com/sindresorhus/file-type?sponsor=1" } }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/finalhandler": { "version": "1.2.0", "license": "MIT", @@ -1039,6 +1379,37 @@ "node": ">= 0.6" } }, + "node_modules/from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "license": "ISC" @@ -1074,6 +1445,12 @@ "omggif": "^1.0.10" } }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "dev": true + }, "node_modules/glob": { "version": "7.2.3", "license": "ISC", @@ -1092,6 +1469,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/global": { "version": "4.4.0", "license": "MIT", @@ -1100,6 +1489,26 @@ "process": "^0.11.10" } }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/gpt3-tokenizer": { "version": "1.1.5", "license": "MIT", @@ -1110,6 +1519,12 @@ "node": ">=12" } }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "license": "MIT", @@ -1120,6 +1535,15 @@ "node": ">= 0.4.0" } }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "license": "MIT", @@ -1144,6 +1568,19 @@ "node": ">= 0.8" } }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "license": "MIT", @@ -1172,6 +1609,15 @@ ], "license": "BSD-3-Clause" }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/image-q": { "version": "4.0.0", "license": "MIT", @@ -1191,6 +1637,28 @@ "version": "2.0.4", "license": "ISC" }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/into-stream": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-6.0.0.tgz", + "integrity": "sha512-XHbaOAvP+uFKUFsOgoNPRjLkwB+I22JFPFe5OjTkQ0nwgj6+pSjb4NmB6VMxaPshLiOf+zcpOCBQuLwC1KHhZA==", + "dev": true, + "dependencies": { + "from2": "^2.3.0", + "p-is-promise": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ip-matching": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ip-matching/-/ip-matching-2.1.2.tgz", @@ -1203,6 +1671,18 @@ "node": ">= 10" } }, + "node_modules/is-core-module": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-docker": { "version": "2.2.1", "license": "MIT", @@ -1216,6 +1696,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "license": "MIT", @@ -1227,6 +1716,27 @@ "version": "1.0.2", "license": "MIT" }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-wsl": { "version": "2.2.0", "license": "MIT", @@ -1268,6 +1778,18 @@ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.4.tgz", "integrity": "sha512-v28EW9DWDFpzcD9O5iyJXg3R3+q+mET5JhnjJzQUZMHOv67bpSIHq81GEYpPNZHG+XXHsfSme3nxp/hndKEcsQ==" }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/json5": { "version": "2.2.3", "license": "MIT", @@ -1278,6 +1800,18 @@ "node": ">=6" } }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/load-bmfont": { "version": "1.4.1", "license": "MIT", @@ -1292,6 +1826,18 @@ "xtend": "^4.0.0" } }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/media-typer": { "version": "0.3.0", "license": "MIT", @@ -1303,6 +1849,15 @@ "version": "1.0.1", "license": "MIT" }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/methods": { "version": "1.1.2", "license": "MIT", @@ -1310,6 +1865,19 @@ "node": ">= 0.6" } }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime": { "version": "1.6.0", "license": "MIT", @@ -1337,6 +1905,18 @@ "node": ">= 0.6" } }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/min-document": { "version": "2.19.0", "dependencies": { @@ -1370,6 +1950,12 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true + }, "node_modules/ms": { "version": "2.1.2", "license": "MIT" @@ -1390,6 +1976,50 @@ "node": ">= 6.0.0" } }, + "node_modules/multistream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/multistream/-/multistream-4.1.0.tgz", + "integrity": "sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "once": "^1.4.0", + "readable-stream": "^3.6.0" + } + }, + "node_modules/multistream/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "license": "MIT", @@ -1397,6 +2027,18 @@ "node": ">= 0.6" } }, + "node_modules/node-abi": { + "version": "3.40.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.40.0.tgz", + "integrity": "sha512-zNy02qivjjRosswoYmPi8hIKJRr8MpQyeKT6qlcq/OnOgA3Rhoae+IYOqsM9V5+JnHWmxKnWOT2GxvtqdtOCXA==", + "dev": true, + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/node-fetch": { "version": "2.6.9", "license": "MIT", @@ -1485,6 +2127,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-is-promise": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", + "integrity": "sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/pako": { "version": "1.0.11", "license": "(MIT AND Zlib)" @@ -1523,10 +2174,25 @@ "node": ">=0.10.0" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "node_modules/path-to-regexp": { "version": "0.1.7", "license": "MIT" }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/peek-readable": { "version": "4.1.0", "license": "MIT", @@ -1542,6 +2208,18 @@ "version": "2.9.3", "license": "MIT" }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/piexifjs": { "version": "1.0.6", "license": "MIT" @@ -1563,6 +2241,153 @@ "node": ">=4.0.0" } }, + "node_modules/pkg": { + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/pkg/-/pkg-5.8.1.tgz", + "integrity": "sha512-CjBWtFStCfIiT4Bde9QpJy0KeH19jCfwZRJqHFDFXfhUklCx8JoFmMj3wgnEYIwGmZVNkhsStPHEOnrtrQhEXA==", + "dev": true, + "dependencies": { + "@babel/generator": "7.18.2", + "@babel/parser": "7.18.4", + "@babel/types": "7.19.0", + "chalk": "^4.1.2", + "fs-extra": "^9.1.0", + "globby": "^11.1.0", + "into-stream": "^6.0.0", + "is-core-module": "2.9.0", + "minimist": "^1.2.6", + "multistream": "^4.1.0", + "pkg-fetch": "3.4.2", + "prebuild-install": "7.1.1", + "resolve": "^1.22.0", + "stream-meter": "^1.0.4" + }, + "bin": { + "pkg": "lib-es5/bin.js" + }, + "peerDependencies": { + "node-notifier": ">=9.0.1" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/pkg-fetch": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/pkg-fetch/-/pkg-fetch-3.5.2.tgz", + "integrity": "sha512-KlRF3cDS4J5PRTKh5dkF5s+CYKa+4eUXzymWqTKPU/p3WmYlWZu7AS0dH8moPxg+QcJNB4/wu1wVO2a0Asv2Dw==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "fs-extra": "^9.1.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.6", + "progress": "^2.0.3", + "semver": "^7.3.5", + "tar-fs": "^2.1.1", + "yargs": "^16.2.0" + }, + "bin": { + "pkg-fetch": "lib-es5/bin.js" + } + }, + "node_modules/pkg-fetch/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/pkg-fetch/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pkg-fetch/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/pkg/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/pkg/node_modules/pkg-fetch": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/pkg-fetch/-/pkg-fetch-3.4.2.tgz", + "integrity": "sha512-0+uijmzYcnhC0hStDjm/cl2VYdrmVVBpe7Q8k9YBojxmR5tG8mvR9/nooQq3QSXiQqORDVOTY3XqMEqJVIzkHA==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "fs-extra": "^9.1.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.6", + "progress": "^2.0.3", + "semver": "^7.3.5", + "tar-fs": "^2.1.1", + "yargs": "^16.2.0" + }, + "bin": { + "pkg-fetch": "lib-es5/bin.js" + } + }, + "node_modules/pkg/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pkg/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/png-chunk-text": { "version": "1.0.0", "license": "MIT" @@ -1589,6 +2414,32 @@ "node": ">=12.13.0" } }, + "node_modules/prebuild-install": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", + "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "dev": true, + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/process": { "version": "0.11.10", "license": "MIT", @@ -1600,6 +2451,15 @@ "version": "2.0.1", "license": "MIT" }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "license": "MIT", @@ -1618,9 +2478,15 @@ "node": ">= 0.10" } }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "license": "MIT" + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } }, "node_modules/qs": { "version": "6.11.0", @@ -1635,6 +2501,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/range-parser": { "version": "1.2.1", "license": "MIT", @@ -1655,6 +2541,21 @@ "node": ">= 0.8" } }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, "node_modules/readable-stream": { "version": "2.3.7", "license": "MIT", @@ -1709,6 +2610,45 @@ "node": ">=0.10.0" } }, + "node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve/node_modules/is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rimraf": { "version": "3.0.2", "license": "ISC", @@ -1722,6 +2662,29 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "funding": [ @@ -1755,6 +2718,21 @@ "version": "1.2.4", "license": "ISC" }, + "node_modules/semver": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/send": { "version": "0.18.0", "license": "MIT", @@ -1821,6 +2799,60 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/sliced": { "version": "1.0.1", "license": "MIT" @@ -1832,6 +2864,15 @@ "node": ">= 0.8" } }, + "node_modules/stream-meter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.4.tgz", + "integrity": "sha512-4sOEtrbgFotXwnEuzzsQBYEV1elAeFSO8rSGeTwabuX1RRn/kEq9JVH7I0MRBhKVRR0sJkr0M0QCH7yOLf9fhQ==", + "dev": true, + "dependencies": { + "readable-stream": "^2.1.4" + } + }, "node_modules/streamsearch": { "version": "1.1.0", "engines": { @@ -1871,6 +2912,15 @@ "node": ">=8" } }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/strtok3": { "version": "6.3.0", "license": "MIT", @@ -1886,6 +2936,72 @@ "url": "https://github.com/sponsors/Borewit" } }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/timm": { "version": "1.7.1", "license": "MIT" @@ -1894,6 +3010,27 @@ "version": "1.6.0", "license": "MIT" }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/toidentifier": { "version": "1.0.1", "license": "MIT", @@ -1927,6 +3064,18 @@ "utf8-byte-length": "^1.0.1" } }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, "node_modules/type-is": { "version": "1.6.18", "license": "MIT", @@ -1947,6 +3096,15 @@ "resolved": "https://registry.npmjs.org/uniqolor/-/uniqolor-1.1.0.tgz", "integrity": "sha512-j2XyokF24fsj+L5u6fbu4rM3RQc6VWJuAngYM2k0ZdG3yiVxt0smLkps2GmQIYqK8VkELGdM9vFU/HfOkK/zoQ==" }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/unpipe": { "version": "1.0.0", "license": "MIT", @@ -2087,6 +3245,12 @@ "node": ">=10" } }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/package.json b/package.json index 42aaf0150..48bbccd0f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "dependencies": { "@dqbd/tiktoken": "^1.0.2", - "axios": "^1.3.4", + "axios": "^0.27.2", "command-exists": "^1.2.9", "compression": "^1", "cookie-parser": "^1.4.6", @@ -44,7 +44,8 @@ }, "version": "1.5.4", "scripts": { - "start": "node server.js" + "start": "node server.js", + "pkg": "pkg --compress Gzip ." }, "bin": { "sillytavern": "./server.js" @@ -53,11 +54,24 @@ "no-path-concat": "off", "no-var": "off" }, + "main": "server.js", "pkg": { + "targets": [ + "node18-linux-x64", + "node18-macos-x64", + "node18-windows-x64" + ], "assets": [ - "node_modules/open/xdg-open/", - "public", - "uploads" + "node_modules/**/*", + "poe_graphql/**/*" + ], + "outputPath": "dist", + "scripts": [ + "server.js" ] + }, + "devDependencies": { + "pkg": "^5.8.1", + "pkg-fetch": "^3.5.2" } } diff --git a/public/index.html b/public/index.html index 11662d5a6..4d231c692 100644 --- a/public/index.html +++ b/public/index.html @@ -1019,7 +1019,7 @@ Enter 0000000000 to use anonymous mode.
- +
For privacy reasons, your API key will be hidden after you reload the page.
@@ -1053,7 +1053,7 @@
- +
For privacy reasons, your API key will be hidden after you reload the page.
@@ -1088,13 +1088,12 @@

Blocking API url

Example: http://127.0.0.1:5000/
- +

Streaming API url

Example: ws://127.0.0.1:5005/api/v1/stream
- +
@@ -1117,7 +1116,7 @@
- +
For privacy reasons, your API key will be hidden after you reload the page.
@@ -1157,7 +1156,7 @@
- +
For privacy reasons, your API key will be hidden after you reload the page.
@@ -2394,6 +2393,7 @@ ${characterName}
+
@@ -2409,6 +2409,13 @@
+
+
+
+
+
+ +
@@ -2487,7 +2494,6 @@
-
diff --git a/public/script.js b/public/script.js index c9e76f522..a20c74c51 100644 --- a/public/script.js +++ b/public/script.js @@ -261,7 +261,7 @@ let fav_ch_checked = false; //initialize global var for future cropped blobs let currentCroppedAvatar = ''; -const durationSaveEdit = 200; +const durationSaveEdit = 500; const saveSettingsDebounced = debounce(() => saveSettings(), durationSaveEdit); const saveCharacterDebounced = debounce(() => $("#create_button").trigger('click'), durationSaveEdit); const getStatusDebounced = debounce(() => getStatus(), 90000); @@ -446,7 +446,7 @@ function getTokenCount(str, padding = undefined) { let tokenCount = 0; jQuery.ajax({ async: false, - type: 'POST', // + type: 'POST', // url: `/tokenize_llama`, data: JSON.stringify({ text: str }), dataType: "json", @@ -588,7 +588,7 @@ $.get("/csrf-token").then(async (data) => { }); function checkOnlineStatus() { - ///////// REMOVED LINES THAT DUPLICATE RA_CHeckOnlineStatus FEATURES + ///////// REMOVED LINES THAT DUPLICATE RA_CHeckOnlineStatus FEATURES if (online_status == "no_connection") { $("#online_status_indicator2").css("background-color", "red"); //Kobold @@ -948,7 +948,7 @@ function printMessages() { function clearChat() { count_view_mes = 0; extension_prompts = {}; - $("#chat").html(""); + $("#chat").children().remove(); } function deleteLastMessage() { @@ -1030,13 +1030,14 @@ function getMessageFromTemplate({ mesId, characterName, isUser, avatarImg, bias, return mes; } -function appendImageToMessage(mes, messageElement) { +export function appendImageToMessage(mes, messageElement) { if (mes.extra?.image) { - const image = document.createElement("img"); - image.src = mes.extra?.image; - image.title = mes.extra?.title || mes.title; - image.classList.add("img_extra"); - messageElement.find(".mes_text").prepend(image); + const image = messageElement.find('.mes_img'); + const isInline = !!mes.extra?.inline_image; + image.attr('src', mes.extra?.image); + image.attr('title', mes.extra?.title || mes.title); + messageElement.find(".mes_img_container").addClass("img_extra"); + image.toggleClass("img_inline", isInline); } } @@ -1094,7 +1095,7 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true avatarImg = default_avatar; } } - //old processing: + //old processing: //if messge is from sytem, use the name provided in the message JSONL to proceed, //if not system message, use name2 (char's name) to proceed //characterName = mes.is_system || mes.force_avatar ? mes.name : name2; @@ -1963,7 +1964,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, // where it left off by removing the trailing newline at the end // that was added by chat2 generator. This causes problems with // instruct mode that could not have a trailing newline. So we're - // removing a newline ONLY at the end of the string if it exists. + // removing a newline ONLY at the end of the string if it exists. item = item.replace(/\n?$/, ''); //item = item.substr(0, item.length - 1); } @@ -2192,8 +2193,8 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, } else { jQuery.ajax({ - type: 'POST', // - url: generate_url, // + type: 'POST', // + url: generate_url, // data: JSON.stringify(generate_data), beforeSend: function () { @@ -4479,6 +4480,40 @@ export function cancelTtsPlay() { } } +async function deleteMessageImage() { + const value = await callPopup("

Delete image from message?
This action can't be undone.

", 'confirm'); + + if (!value) { + return; + } + + const mesBlock = $(this).closest('.mes'); + const mesId = mesBlock.attr('mesid'); + const message = chat[mesId]; + delete message.extra.image; + delete message.extra.inline_image; + mesBlock.find('.mes_img_container').removeClass('img_extra'); + mesBlock.find('.mes_img').attr('src', ''); + saveChatConditional(); +} + +function enlargeMessageImage() { + const mesBlock = $(this).closest('.mes'); + const mesId = mesBlock.attr('mesid'); + const message = chat[mesId]; + const imgSrc = message?.extra?.image; + + if (!imgSrc) { + return; + } + + const img = document.createElement('img'); + img.classList.add('img_enlarged'); + img.src = imgSrc; + $('#dialogue_popup').addClass('wide_dialogue_popup'); + callPopup(img.outerHTML, 'text'); +} + window["SillyTavern"].getContext = function () { return { chat: chat, @@ -6433,6 +6468,9 @@ $(document).ready(function () { $('.code-copied').css({ 'display': 'none' }); }); + $(document).on('click', '.mes_img_enlarge', enlargeMessageImage); + $(document).on('click', '.mes_img_delete', deleteMessageImage); + $(window).on('beforeunload', () => { cancelTtsPlay(); if (streamingProcessor) { diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index 651629bcf..cdd2cf607 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -370,7 +370,8 @@ function RA_checkOnlineStatus() { //Auto-connect to API (when set to kobold, API URL exists, and auto_connect is true) function RA_autoconnect(PrevApi) { - if (online_status === undefined) { + // secrets.js or script.js not loaded + if (SECRET_KEYS === undefined || online_status === undefined) { setTimeout(RA_autoconnect, 100); return; } @@ -404,7 +405,6 @@ function RA_autoconnect(PrevApi) { } if (!connection_made) { - RA_AC_retries++; retry_delay = Math.min(retry_delay * 2, 30000); // double retry delay up to to 30 secs //console.log('connection attempts: ' + RA_AC_retries + ' delay: ' + (retry_delay / 1000) + 's'); diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index b658dca06..579ca1cfa 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -7,7 +7,8 @@ import { callPopup, getRequestHeaders, event_types, - eventSource + eventSource, + appendImageToMessage } from "../../../script.js"; import { getApiUrl, getContext, extension_settings, defaultRequestArgs, modules } from "../../extensions.js"; import { stringFormat, initScrollHeight, resetScrollHeight } from "../../utils.js"; @@ -41,24 +42,22 @@ const triggerWords = { [generationMode.CHARACTER]: ['you'], [generationMode.USER]: ['me'], [generationMode.SCENARIO]: ['scene'], + [generationMode.FREE]: ['raw_last'], [generationMode.NOW]: ['last'], [generationMode.FACE]: ['face'], } const quietPrompts = { + /*OLD: [generationMode.CHARACTER]: "Pause your roleplay and provide comma-delimited list of phrases and keywords which describe {{char}}'s physical appearance and clothing. Ignore {{char}}'s personality traits, and chat history when crafting this description. End your response once the comma-delimited list is complete. Do not roleplay when writing this description, and do not attempt to continue the story.", */ + [generationMode.CHARACTER]: "[In the next response I want you to provide only a detailed comma-delimited list of keywords and phrases which describe {{char}}. The list must include all of the following items in this order: name, species and race, gender, age, clothing, occupation, physical features and appearances. Do not include descriptions of non-visual qualities such as personality, movements, scents, mental traits, or anything which could not be seen in a still photograph. Do not write in full sentences. Prefix your description with the phrase 'full body portrait:']", //face-specific prompt [generationMode.FACE]: "[In the next response I want you to provide only a detailed comma-delimited list of keywords and phrases which describe {{char}}. The list must include all of the following items in this order: name, species and race, gender, age, facial features and expressions, occupation, hair and hair accessories (if any), what they are wearing on their upper body (if anything). Do not describe anything below their neck. Do not include descriptions of non-visual qualities such as personality, movements, scents, mental traits, or anything which could not be seen in a still photograph. Do not write in full sentences. Prefix your description with the phrase 'close up facial portrait:']", //prompt for only the last message - [generationMode.NOW]: "[Pause your roleplay and provide a brief description of the last chat message. Focus on visual details, clothing, actions. Ignore the emotions and thoughts of {{char}} and {{user}} as well as any spoken dialog. Do not roleplay as {{char}} while writing this description. Do not continue the roleplay story.]", - - [generationMode.CHARACTER]: "[In the next response I want you to provide only a detailed comma-delimited list of keywords and phrases which describe {{char}}. The list must include all of the following items in this order: name, species and race, gender, age, clothing, occupation, physical features and appearances. Do not include descriptions of non-visual qualities such as personality, movements, scents, mental traits, or anything which could not be seen in a still photograph. Do not write in full sentences. Prefix your description with the phrase 'full body portrait:']", - - /*OLD: [generationMode.CHARACTER]: "Pause your roleplay and provide comma-delimited list of phrases and keywords which describe {{char}}'s physical appearance and clothing. Ignore {{char}}'s personality traits, and chat history when crafting this description. End your response once the comma-delimited list is complete. Do not roleplay when writing this description, and do not attempt to continue the story.", */ - [generationMode.USER]: "[Pause your roleplay and provide a detailed description of {{user}}'s appearance from the perspective of {{char}} in the form of a comma-delimited list of keywords and phrases. Ignore the rest of the story when crafting this description. Do not roleplay as {{char}}}} when writing this description, and do not attempt to continue the story.]", [generationMode.SCENARIO]: "[Pause your roleplay and provide a detailed description for all of the following: a brief recap of recent events in the story, {{char}}'s appearance, and {{char}}'s surroundings. Do not roleplay while writing this description.]", - [generationMode.FREE]: "[Pause your roleplay and provide ONLY an echo this string back to me verbatim: {0}. Do not write anything after the string. Do not roleplay at all in your response.]", + [generationMode.NOW]: "[Pause your roleplay and provide a brief description of the last chat message. Focus on visual details, clothing, actions. Ignore the emotions and thoughts of {{char}} and {{user}} as well as any spoken dialog. Do not roleplay as {{char}} while writing this description. Do not continue the roleplay story.]", + [generationMode.FREE]: "[Pause your roleplay and provide ONLY the last chat message string back to me verbatim. Do not write anything after the string. Do not roleplay at all in your response. Do not continue the roleplay story.]", } const helpString = [ @@ -69,8 +68,9 @@ const helpString = [ `
  • ${m(j(triggerWords[generationMode.USER]))} – user character full body selfie
  • `, `
  • ${m(j(triggerWords[generationMode.SCENARIO]))} – visual recap of the whole chat scenario
  • `, `
  • ${m(j(triggerWords[generationMode.NOW]))} – visual recap of the last chat message
  • `, + `
  • ${m(j(triggerWords[generationMode.FREE]))} – visual recap of the last chat message with no summary
  • `, '', - `Anything else would trigger a "free mode" to make SD generate whatever you prompted.
    + `Anything else would trigger a "free mode" to make SD generate whatever you prompted.
    example: '/sd apple tree' would generate a picture of an apple tree.`, ].join('
    '); @@ -340,7 +340,14 @@ function processReply(str) { return str; } -async function generatePicture(_, trigger) { +function getRawLastMessage(context) { + const lastMessage = context.chat.slice(-1)[0].mes, + characterDescription = context.characters[context.characterId].description, + situation = context.characters[context.characterId].scenario; + return `((${lastMessage})), (${situation}:0.7), (${characterDescription}:0.5)` +} + +async function generatePicture(_, trigger, message, callback) { if (!trigger || trigger.trim().length === 0) { console.log('Trigger word empty, aborting'); return; @@ -361,7 +368,7 @@ async function generatePicture(_, trigger) { const context = getContext(); try { - const prompt = processReply(await new Promise( + const prompt = trigger == 'raw_last' ? message || getRawLastMessage(context) : processReply(await new Promise( async function promptPromise(resolve, reject) { try { await context.generate('quiet', { resolve, reject, quiet_prompt, force_name2: true, }); @@ -377,9 +384,9 @@ async function generatePicture(_, trigger) { console.log('Processed Stable Diffusion prompt:', prompt); if (extension_settings.sd.horde) { - await generateHordeImage(prompt); + await generateHordeImage(prompt, callback); } else { - await generateExtrasImage(prompt); + await generateExtrasImage(prompt, callback); } } catch (err) { console.trace(err); @@ -391,7 +398,7 @@ async function generatePicture(_, trigger) { } } -async function generateExtrasImage(prompt) { +async function generateExtrasImage(prompt, callback) { const url = new URL(getApiUrl()); url.pathname = '/api/image'; const result = await fetch(url, { @@ -414,13 +421,13 @@ async function generateExtrasImage(prompt) { if (result.ok) { const data = await result.json(); const base64Image = `data:image/jpeg;base64,${data.image}`; - sendMessage(prompt, base64Image); + callback ? callback(prompt, base64Image) : sendMessage(prompt, base64Image); } else { callPopup('Image generation has failed. Please try again.', 'text'); } } -async function generateHordeImage(prompt) { +async function generateHordeImage(prompt, callback) { const result = await fetch('/horde_generateimage', { method: 'POST', headers: getRequestHeaders(), @@ -441,7 +448,7 @@ async function generateHordeImage(prompt) { if (result.ok) { const data = await result.text(); const base64Image = `data:image/webp;base64,${data}`; - sendMessage(prompt, base64Image); + callback ? callback(prompt, base64Image) : sendMessage(prompt, base64Image); } else { callPopup('Image generation has failed. Please try again.', 'text'); } @@ -468,6 +475,7 @@ async function sendMessage(prompt, image) { } function addSDGenButtons() { + const buttonHtml = `
    `; @@ -484,24 +492,29 @@ function addSDGenButtons() {
  • Me
  • The Whole Story
  • The Last Message
  • +
  • Raw Last Message
  • `; $('#send_but_sheld').prepend(buttonHtml); $('#send_but_sheld').prepend(waitButtonHtml); - $(document.body).append(dropdownHtml) + $(document.body).append(dropdownHtml); + const messageButton = $('.sd_message_gen'); const button = $('#sd_gen'); const waitButton = $("#sd_gen_wait"); const dropdown = $('#sd_dropdown'); waitButton.hide(); dropdown.hide(); button.hide(); + messageButton.hide(); let popper = Popper.createPopper(button.get(0), dropdown.get(0), { - placement: 'top-start', + placement: 'top-end', }); + $(document).on('click', '.sd_message_gen', sdMessageButton); + $(document).on('click touchend', function (e) { const target = $(e.target); if (target.is(dropdown)) return; @@ -519,14 +532,47 @@ function addSDGenButtons() { async function moduleWorker() { const context = getContext(); - context.onlineStatus === 'no_connection' - ? $('#sd_gen').hide(200) - : $('#sd_gen').show(200) + if (context.onlineStatus === 'no_connection') { + $('#sd_gen').hide(200); + $('.sd_message_gen').hide(); + } + else { + $('#sd_gen').show(200); + $('.sd_message_gen').show(); + } } addSDGenButtons(); + setInterval(moduleWorker, UPDATE_INTERVAL); +function sdMessageButton(e) { + const $mes = $(e.currentTarget).closest('.mes'); + const character = $mes.find('.name_text').text(), + message = $mes.find('.mes_text').text(); + + console.log("doing /sd raw last"); + generatePicture('sd', 'raw_last', `${character} said: ${message}`, saveGeneratedImage); + + function saveGeneratedImage(prompt, image) { + const context = getContext(); + const message_id = $mes.attr('mesid'); + const message = context.chat[message_id]; + + // Some message sources may not create the extra object + if (typeof message.extra !== 'object') { + message.extra = {}; + } + + message.extra.inline_image = true; + message.extra.image = image; + message.extra.title = prompt; + appendImageToMessage(message, $mes); + + context.saveChat(); + } +}; + $("#sd_dropdown [id]").on("click", function () { var id = $(this).attr("id"); if (id == "sd_you") { @@ -553,6 +599,11 @@ $("#sd_dropdown [id]").on("click", function () { console.log("doing /sd last"); generatePicture('sd', 'last'); } + + else if (id == "sd_raw_last") { + console.log("doing /sd raw last"); + generatePicture('sd', 'raw_last'); + } }); jQuery(async () => { @@ -618,4 +669,5 @@ jQuery(async () => { }); await loadSettings(); -}); \ No newline at end of file + $('body').addClass('sd'); +}); diff --git a/public/scripts/poe.js b/public/scripts/poe.js index 3e2568a19..de4e191ac 100644 --- a/public/scripts/poe.js +++ b/public/scripts/poe.js @@ -39,7 +39,7 @@ If you have any objections to these requirements, please mention them specifical If you accept the requriements, please confirm this by replying with "${DEFAULT_JAILBREAK_RESPONSE}", and nothing more. Upon receiving your accurate confirmation message, I will specify the context of the scene and {{char}}'s characteristics, background, and personality in the next message.`; -const DEFAULT_CHARACTER_NUDGE_MESSAGE = "[Your the next response shall only be written from the point of view of {{char}}. Do not seek approval of your writing style at the end of the response.]"; +const DEFAULT_CHARACTER_NUDGE_MESSAGE = "[Unless otherwise stated by {{user}}, your the next response shall only be written from the point of view of {{char}}. Do not seek approval of your writing style at the end of the response.]"; const DEFAULT_IMPERSONATION_PROMPT = "[Write 1 reply only in internet RP style from the point of view of {{user}}, using the chat history so far as a guideline for the writing style of {{user}}. Don't write as {{char}} or system.]"; const poe_settings = { @@ -210,7 +210,7 @@ async function sendMessage(prompt, withStreaming, signal) { async function onConnectClick() { const api_key_poe = $('#poe_token').val().trim(); - + if (api_key_poe.length) { await writeSecret(SECRET_KEYS.POE, api_key_poe); } @@ -220,7 +220,7 @@ async function onConnectClick() { return; } - if ( is_poe_button_press) { + if (is_poe_button_press) { console.log('Poe API button is pressed'); return; } diff --git a/public/style.css b/public/style.css index b6480a705..ef4381831 100644 --- a/public/style.css +++ b/public/style.css @@ -204,12 +204,14 @@ table.responsiveTable { text-align: center; } +.sd_message_gen, .mes_narrate, body.tts .mes[is_user="true"] .mes_narrate, body.tts .mes[is_system="true"] .mes_narrate { display: none; } +body.sd .sd_message_gen, body.tts .mes_narrate { display: inline-block; } @@ -297,8 +299,8 @@ code { text-align: center; border-radius: 5px; vertical-align: middle; - right: 5px; - top: 5px; + right: 0px; + top: 0px; opacity: 0.5; cursor: grab; border: 1px solid var(--white30a); @@ -1255,7 +1257,7 @@ input[type=search]:focus::-webkit-search-cancel-button { background-repeat: no-repeat; background-size: cover; background-position: center; - border-radius: 20px; + border-radius: 10px; border: 1px solid var(--black50a); box-shadow: 0 0 7px var(--black50a); margin: 5px; @@ -2187,6 +2189,7 @@ input[type="range"]::-webkit-slider-thumb { .mes_prompt, .mes_narrate, +.sd_message_gen, .mes_copy, .mes_edit { cursor: pointer; @@ -2199,11 +2202,13 @@ input[type="range"]::-webkit-slider-thumb { .mes_edit:hover, .mes_copy:hover, +.sd_message_gen:hover, .mes_narrate:hover, .mes_stop:hover { opacity: 1; } +.last_mes .sd_message_gen, .last_mes .mes_copy, .last_mes .mes_narrate, .last_mes .mes_prompt { @@ -2431,7 +2436,7 @@ h5 { box-shadow: 0px 0px 20px black; padding: 10px; background-color: var(--SmartThemeBlurTintColor); - border-radius: 20px; + border-radius: 10px; overflow-y: auto; border: 1px solid var(--grey30); } @@ -3307,16 +3312,58 @@ a { } /* Message images */ -.mes img.img_extra { +.mes .mes_img_container { max-width: 100%; - max-height: 60svh; /*to fit inside single window height of mobile landscape*/ - border-radius: 10px; - display: block; + display: none; + position: relative; + width: fit-content; + transition: all 0.1s; } -.mes img.img_extra~* { +.mes_img { + border-radius: 10px; + width: 100%; +} + +.mes_img_controls { + position: absolute; + top: 0.5em; + left: 0; + width: 100%; display: none; + flex-direction: row; + justify-content: space-between; + padding: 0.75em; +} + +.mes_img_controls .right_menu_button { + padding: 0; + filter: brightness(80%); +} + +.mes_img_controls .right_menu_button:hover { + filter: brightness(150%); +} + +/* +.mes_img_container:hover .mes_img { + opacity: 0.9; +} +*/ + +.mes_img_container:hover .mes_img_controls { + display: flex; +} + +.mes .mes_img_container.img_extra { + display: flex; +} + +.img_enlarged { + width: 100%; + padding: 10px 0; + border-radius: 2px; } /* Extensions */ @@ -3510,13 +3557,13 @@ label[for="extensions_autoconnect"] { .drawer-content { background-color: var(--SmartThemeBlurTintColor); color: var(--SmartThemeBodyColor); - border-radius: 20px; + border-radius: 10px; padding: 10px; border: 1px solid var(--grey30a); box-shadow: 0 0 20px black; min-width: 450px; width: var(--sheldWidth); - overflow-y: scroll; + overflow-y: auto; max-height: calc(100svh - 70px); display: none; position: absolute; @@ -3595,6 +3642,10 @@ toolcool-color-picker { padding: 5px; } +.padding10 { + padding: 10px; +} + .margin0 { margin: 0; } @@ -3805,7 +3856,7 @@ toolcool-color-picker { body.bubblechat .mes { padding: 10px; - border-radius: 20px; + border-radius: 10px; background-color: var(--SmartThemeBlurTintColor); margin-bottom: 5px; border: 1px solid var(--white30a); @@ -3894,6 +3945,16 @@ body.movingUI #floatingPrompt { resize: both; } +body.movingUI #chat::-webkit-scrollbar-thumb { + background-color: var(--grey7070a); + border: 2px solid transparent; + border-top: 20px solid transparent; + box-shadow: inset 0 0 0 1px var(--black50a); + border-radius: 10px; + background-clip: content-box; +} + + #expression-image.default, #expression-holder:has(.default) { height: 120px; @@ -4142,11 +4203,12 @@ body.waifuMode #avatar_zoom_popup { } #right-nav-panel, - #left-nav-panel { + #left-nav-panel, + #floatingPrompt { height: calc(100svh - 45px); - min-width: 100%; - width: 100%; - max-width: 100%; + min-width: 100% !important; + width: 100% !important; + max-width: 100% !important; overflow-y: hidden; border-left: 1px solid var(--grey30); border-right: 1px solid var(--grey30); @@ -4157,6 +4219,10 @@ body.waifuMode #avatar_zoom_popup { backdrop-filter: blur(calc(var(--SmartThemeBlurStrength) * 2)); } + #floatingPrompt { + height: min-content; + } + #right-nav-panel h4 { margin: 5px auto; } diff --git a/server.js b/server.js index 784402968..d5adec676 100644 --- a/server.js +++ b/server.js @@ -20,7 +20,10 @@ const cliArguments = yargs(hideBin(process.argv)) }).argv; // change all relative paths -process.chdir(__dirname) +const path = require('path'); +const directory = process.pkg ? path.dirname(process.execPath) : __dirname; +console.log(process.pkg ? 'Running from binary' : 'Running from source'); +process.chdir(directory); const express = require('express'); const compression = require('compression'); @@ -42,7 +45,7 @@ const encode = require('png-chunks-encode'); const PNGtext = require('png-chunk-text'); const jimp = require('jimp'); -const path = require('path'); +//const path = require('path'); const sanitize = require('sanitize-filename'); const mime = require('mime-types'); @@ -60,10 +63,10 @@ const utf8Encode = new TextEncoder(); const utf8Decode = new TextDecoder('utf-8', { ignoreBOM: true }); const commandExistsSync = require('command-exists').sync; -const config = require(path.join(__dirname, './config.conf')); +const config = require(path.join(process.cwd(), './config.conf')); const server_port = process.env.SILLY_TAVERN_PORT || config.port; -const whitelistPath = path.join(__dirname, "./whitelist.txt"); +const whitelistPath = path.join(process.cwd(), "./whitelist.txt"); let whitelist = config.whitelist; if (fs.existsSync(whitelistPath)) { @@ -259,7 +262,7 @@ app.use((req, res, next) => { console.log(filePath); fs.access(filePath, fs.constants.R_OK, (err) => { if (!err) { - res.sendFile(filePath, { root: __dirname }); + res.sendFile(filePath, { root: process.cwd() }); } else { res.send('Character not found: ' + filePath); //next(); @@ -270,10 +273,10 @@ app.use((req, res, next) => { } }); -app.use(express.static(__dirname + "/public", { refresh: true })); +app.use(express.static(process.cwd() + "/public", { refresh: true })); app.use('/backgrounds', (req, res) => { - const filePath = decodeURIComponent(path.join(__dirname, 'public/backgrounds', req.url.replace(/%20/g, ' '))); + const filePath = decodeURIComponent(path.join(process.cwd(), 'public/backgrounds', req.url.replace(/%20/g, ' '))); fs.readFile(filePath, (err, data) => { if (err) { res.status(404).send('File not found'); @@ -285,7 +288,7 @@ app.use('/backgrounds', (req, res) => { }); app.use('/characters', (req, res) => { - const filePath = decodeURIComponent(path.join(__dirname, charactersPath, req.url.replace(/%20/g, ' '))); + const filePath = decodeURIComponent(path.join(process.cwd(), charactersPath, req.url.replace(/%20/g, ' '))); fs.readFile(filePath, (err, data) => { if (err) { res.status(404).send('File not found'); @@ -296,16 +299,16 @@ app.use('/characters', (req, res) => { }); app.use(multer({ dest: "uploads" }).single("avatar")); app.get("/", function (request, response) { - response.sendFile(__dirname + "/public/index.html"); + response.sendFile(process.cwd() + "/public/index.html"); }); app.get("/notes/*", function (request, response) { - response.sendFile(__dirname + "/public" + request.url + ".html"); + response.sendFile(process.cwd() + "/public" + request.url + ".html"); }); app.get('/get_faq', function (_, response) { - response.sendFile(__dirname + "/faq.md"); + response.sendFile(process.cwd() + "/faq.md"); }); app.get('/get_readme', function (_, response) { - response.sendFile(__dirname + "/readme.md"); + response.sendFile(process.cwd() + "/readme.md"); }); app.get('/deviceinfo', function (request, response) { const userAgent = request.header('user-agent'); @@ -658,13 +661,13 @@ function getVersion() { try { const pkgJson = require('./package.json'); pkgVersion = pkgJson.version; - if (commandExistsSync('git')) { + if (!process.pkg && commandExistsSync('git')) { gitRevision = require('child_process') - .execSync('git rev-parse --short HEAD', { cwd: __dirname }) + .execSync('git rev-parse --short HEAD', { cwd: process.cwd() }) .toString().trim(); gitBranch = require('child_process') - .execSync('git rev-parse --abbrev-ref HEAD', { cwd: __dirname }) + .execSync('git rev-parse --abbrev-ref HEAD', { cwd: process.cwd() }) .toString().trim(); } } @@ -1694,7 +1697,7 @@ app.post("/exportcharacter", jsonParser, async function (request, response) { switch (request.body.format) { case 'png': - return response.sendFile(filename, { root: __dirname }); + return response.sendFile(filename, { root: process.cwd() }); case 'json': { try { let json = await charaRead(filename); @@ -1724,7 +1727,7 @@ app.post("/exportcharacter", jsonParser, async function (request, response) { await webp.cwebp(filename, inputWebpPath, '-q 95'); await webp.webpmux_add(inputWebpPath, outputWebpPath, metadataPath, 'exif'); - response.sendFile(outputWebpPath, { root: __dirname }, () => { + response.sendFile(outputWebpPath, { root: process.cwd() }, () => { fs.rmSync(inputWebpPath); fs.rmSync(metadataPath); fs.rmSync(outputWebpPath); @@ -2369,7 +2372,7 @@ app.get('/thumbnail', jsonParser, async function (request, response) { if (config.disableThumbnails == true) { const pathToOriginalFile = path.join(getOriginalFolder(type), file); - return response.sendFile(pathToOriginalFile, { root: __dirname }); + return response.sendFile(pathToOriginalFile, { root: process.cwd() }); } const pathToCachedFile = await generateThumbnail(type, file); @@ -2378,7 +2381,7 @@ app.get('/thumbnail', jsonParser, async function (request, response) { return response.sendStatus(404); } - return response.sendFile(pathToCachedFile, { root: __dirname }); + return response.sendFile(pathToCachedFile, { root: process.cwd() }); }); /* OpenAI */ diff --git a/src/middleware/basicAuthMiddleware.js b/src/middleware/basicAuthMiddleware.js index 2f368214c..a5b1b3459 100644 --- a/src/middleware/basicAuthMiddleware.js +++ b/src/middleware/basicAuthMiddleware.js @@ -3,9 +3,11 @@ * allow access to the endpoint after successful authentication. */ -const {dirname} = require('path'); -const appDir = dirname(require.main.filename); -const config = require(appDir + '/config.conf'); +//const {dirname} = require('path'); +//const appDir = dirname(require.main.filename); +//const config = require(appDir + '/config.conf'); +const path = require('path'); +const config = require(path.join(process.cwd(), './config.conf')); const unauthorizedResponse = (res) => { res.set('WWW-Authenticate', 'Basic realm="SillyTavern", charset="UTF-8"'); @@ -36,4 +38,4 @@ const basicAuthMiddleware = function (request, response, callback) { } } -module.exports = basicAuthMiddleware; \ No newline at end of file +module.exports = basicAuthMiddleware;