Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68452e6c08 | ||
|
|
b3f495a923 | ||
|
|
3dc13ee272 | ||
|
|
c1cd609ade | ||
|
|
15edcbb4ac | ||
|
|
6177985340 | ||
|
|
2a4a8811f7 | ||
|
|
63409e26f1 | ||
|
|
296deba415 | ||
|
|
54b0628631 | ||
|
|
006ffec1f9 | ||
|
|
379207a3d8 | ||
|
|
43c29b0df9 | ||
|
|
8f81da2363 | ||
|
|
e97546c194 | ||
|
|
f1dab2288c | ||
|
|
66ecd37b4a | ||
|
|
c9e64c8091 | ||
|
|
ad765f2275 | ||
|
|
40e371aa72 | ||
|
|
993d3faa03 | ||
|
|
d964e0d667 | ||
|
|
ba7621f845 | ||
|
|
9886ebb3a1 | ||
|
|
95ca39d8e0 | ||
|
|
971f1c40b7 | ||
|
|
6b623cead9 | ||
|
|
92d4a7f19e | ||
|
|
bf5b2a5c40 | ||
|
|
0fe838223f | ||
|
|
932d2509e1 | ||
|
|
d7547ef869 | ||
|
|
7b6eaf6ed0 | ||
|
|
cddbc60587 | ||
|
|
92637fd1f9 | ||
|
|
4d7c776ecd | ||
|
|
1317889dc4 | ||
|
|
1bc54f06cf | ||
|
|
6bbee41565 | ||
|
|
ca1bed3b47 | ||
|
|
c2006a60ea | ||
|
|
f25a6c6bcc | ||
|
|
c038ebbcfa | ||
|
|
fdeb3f225f | ||
|
|
5c0bb34f69 | ||
|
|
7b065b782b | ||
|
|
54a9f630d0 | ||
|
|
7ae31cf980 | ||
|
|
9d5c1800fa | ||
|
|
f6297ed304 | ||
|
|
4bfd6ded89 | ||
|
|
1cc49e70e7 | ||
|
|
d78bd26977 | ||
|
|
4777531014 | ||
|
|
0a7f06855b | ||
|
|
33659c4e7a | ||
|
|
440c2851f2 | ||
|
|
de27382e50 | ||
|
|
1f959a0e82 | ||
|
|
07c6f09be2 | ||
|
|
12540bfbcd | ||
|
|
ec00cc023f | ||
|
|
839b76dedd | ||
|
|
dfce704278 | ||
|
|
c2bad577ea | ||
|
|
658d046e2f | ||
|
|
bd60065e90 | ||
|
|
5f2c6b8853 | ||
|
|
8beb1ade21 | ||
|
|
2b3910b968 | ||
|
|
ecf991ec81 | ||
|
|
2f2092106e | ||
|
|
9811b0dc3a | ||
|
|
7ff70819c1 | ||
|
|
0942a2012e | ||
|
|
bdd2708f89 | ||
|
|
a894036d34 | ||
|
|
420fb5ef17 | ||
|
|
a89f31d614 | ||
|
|
10a4d39c7e | ||
|
|
b20b865887 | ||
|
|
9ab8ca9b6b | ||
|
|
ef6d0acaed | ||
|
|
b09d7abf49 | ||
|
|
0081f5d0d7 | ||
|
|
5ef3b3417b | ||
|
|
a328058b93 | ||
|
|
c0a285eaa2 | ||
|
|
f6dc978595 | ||
|
|
4ce7fa59be | ||
|
|
4225f217d0 | ||
|
|
2d48a3bd25 | ||
|
|
fb0fd0d242 | ||
|
|
6b1b614045 | ||
|
|
85da761244 | ||
|
|
c617b7e7d5 | ||
|
|
165cad1549 | ||
|
|
2cda80ffe4 | ||
|
|
a79aed4694 | ||
|
|
f558e12bda | ||
|
|
eec9844e39 | ||
|
|
a527ae1ad7 | ||
|
|
0736e72baf | ||
|
|
e85b26d5dc | ||
|
|
15f1d14db2 | ||
|
|
9483ec464a | ||
|
|
34b20b664f | ||
|
|
6d85f527a2 | ||
|
|
16ac0f3a31 | ||
|
|
231ae91ae6 | ||
|
|
0442d39e60 | ||
|
|
cdadad1ede | ||
|
|
5f2882e33f | ||
|
|
c51f63cd7a | ||
|
|
4ea7b22f4b | ||
|
|
7ee05adf9b | ||
|
|
cbcb772a64 | ||
|
|
2434822a44 | ||
|
|
b8c99ef2c1 | ||
|
|
20dc882b75 | ||
|
|
c1699b4193 | ||
|
|
4488110ea0 | ||
|
|
6a5a0efff9 | ||
|
|
61a8c65b2d |
@@ -7,4 +7,5 @@ public/backgrounds/
|
||||
*.jsonl
|
||||
public/settings.json
|
||||
config.conf
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
public/settings.json
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
|
||||
const port = 8000;
|
||||
const whitelist = ['127.0.0.1']; //Example for add several IP in whitelist: ['127.0.0.1', '192.168.0.10']
|
||||
const whitelist = ['127.0.0.1','192.168.0.*']; //Example for add several IP in whitelist: ['127.0.0.1', '192.168.0.10']
|
||||
const whitelistMode = false; //Disabling enabling the ip whitelist mode. true/false
|
||||
const autorun = true; //Autorun in the browser. true/false
|
||||
const enableExtensions = true; //Enables support for TavernAI-extras project
|
||||
const listen = true; // If true, Can be access from other device or PC. otherwise can be access only from hosting machine.
|
||||
|
||||
module.exports = {
|
||||
port, whitelist, whitelistMode, autorun, enableExtensions,
|
||||
port, whitelist, whitelistMode, autorun, enableExtensions, listen
|
||||
};
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
"csrf-csrf": "^2.2.3",
|
||||
"express": "^4.18.2",
|
||||
"ipaddr.js": "^2.0.1",
|
||||
"jimp": "^0.22.7",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"node-rest-client": "^3.1.1",
|
||||
"open": "^8.4.0",
|
||||
"png-chunk-text": "^1.0.0",
|
||||
"png-chunks-encode": "^1.0.0",
|
||||
"png-chunks-extract": "^1.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"sharp": "^0.31.3"
|
||||
"rimraf": "^3.0.2"
|
||||
},
|
||||
"name": "TavernAI",
|
||||
"version": "1.2.8",
|
||||
"version": "1.1.0",
|
||||
"bin": {
|
||||
"TavernAI": "server.js"
|
||||
},
|
||||
@@ -25,8 +25,6 @@
|
||||
},
|
||||
"pkg": {
|
||||
"assets": [
|
||||
"node_modules/sharp/build/Release/**/*",
|
||||
"node_modules/sharp/vendor/lib/**/*",
|
||||
"node_modules/open/xdg-open/",
|
||||
"public",
|
||||
"uploads"
|
||||
|
||||
|
After Width: | Height: | Size: 226 KiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 314 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 219 KiB |
|
Before Width: | Height: | Size: 831 KiB |
|
After Width: | Height: | Size: 331 KiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 463 KiB |
|
Before Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 549 KiB |
|
Before Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 227 KiB |
|
Before Width: | Height: | Size: 872 KiB |
|
After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 208 KiB |
|
Before Width: | Height: | Size: 851 KiB |
|
After Width: | Height: | Size: 454 KiB |
|
Before Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 414 KiB |
|
Before Width: | Height: | Size: 2.1 MiB |
@@ -1 +1 @@
|
||||
#bg1 {background-image: url(../backgrounds/tavern.png);}
|
||||
#bg1 {background-image: url(../backgrounds/tavern.jpg);}
|
||||
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M96 0C43 0 0 43 0 96V416c0 53 43 96 96 96H384h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V384c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32H384 96zm0 384H352v64H96c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16zm16 48H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16s7.2-16 16-16z"/></svg>
|
||||
|
After Width: | Height: | Size: 611 B |
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 2.1 MiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M256 0a256 256 0 1 0 0 512A256 256 0 1 0 256 0zM135 241c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l87 87 87-87c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L273 345c-9.4 9.4-24.6 9.4-33.9 0L135 241z"/></svg>
|
||||
|
After Width: | Height: | Size: 438 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM377 271c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-87-87-87 87c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9L239 167c9.4-9.4 24.6-9.4 33.9 0L377 271z"/></svg>
|
||||
|
After Width: | Height: | Size: 442 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M144 480C64.5 480 0 415.5 0 336c0-62.8 40.2-116.2 96.2-135.9c-.1-2.7-.2-5.4-.2-8.1c0-88.4 71.6-160 160-160c59.3 0 111 32.2 138.7 80.2C409.9 102 428.3 96 448 96c53 0 96 43 96 96c0 12.2-2.3 23.8-6.4 34.6C596 238.4 640 290.1 640 352c0 70.7-57.3 128-128 128H144zm79-217c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l39-39V392c0 13.3 10.7 24 24 24s24-10.7 24-24V257.9l39 39c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0l-80 80z"/></svg>
|
||||
|
After Width: | Height: | Size: 691 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M273.8 45.8l73.7 28L271.2 103 194.8 73.7l73.7-28c1.7-.7 3.6-.7 5.3 0zM128.1 87.1V192.6c-1.2 .4-2.4 .8-3.6 1.2L34.1 228.1c-20.5 7.8-34 27.4-34 49.3V389.5c0 20.9 12.4 39.8 31.5 48.3L122 477.5c13.5 5.9 28.9 5.9 42.4 0l106.8-46.9L378 477.5c13.5 5.9 28.9 5.9 42.4 0l90.4-39.7c19.1-8.4 31.5-27.3 31.5-48.3V277.4c0-21.9-13.5-41.5-34-49.3l-90.4-34.3c-1.2-.5-2.4-.9-3.6-1.2V87.1c0-21.9-13.5-41.5-34-49.3L289.9 3.5c-12-4.6-25.3-4.6-37.4 0L162.1 37.8c-20.5 7.8-34 27.4-34 49.3zM369.1 198.2l-77.5 29.4v-84l77.5-29.7v84.3zM145.8 236.1l73.7 28-76.4 29.3L66.8 264.1l73.7-28c1.7-.7 3.6-.7 5.3 0zm17.7 192.4V333.9l77.5-29.7v90.2l-77.5 34.1zm233-192.4c1.7-.7 3.6-.7 5.3 0l73.7 28-76.4 29.3-76.4-29.3 73.7-28zm96.1 160.3l-73 32.1V333.9l77.5-29.7v85.3c0 3-1.8 5.7-4.5 6.9z"/></svg>
|
||||
|
After Width: | Height: | Size: 1000 B |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M252.3 11.7c-15.6-15.6-40.9-15.6-56.6 0l-184 184c-15.6 15.6-15.6 40.9 0 56.6l184 184c15.6 15.6 40.9 15.6 56.6 0l184-184c15.6-15.6 15.6-40.9 0-56.6l-184-184zM248 224c0 13.3-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24zM96 248c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24zm128 80c13.3 0 24 10.7 24 24s-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24zm128-80c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24zM224 72c13.3 0 24 10.7 24 24s-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24zm96 392c0 26.5 21.5 48 48 48H592c26.5 0 48-21.5 48-48V240c0-26.5-21.5-48-48-48H472.5c13.4 26.9 8.8 60.5-13.6 82.9L320 413.8V464zm160-88c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/></svg>
|
||||
|
After Width: | Height: | Size: 970 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V160H256c-17.7 0-32-14.3-32-32V0H64zM256 0V128H384L256 0zM216 408c0 13.3-10.7 24-24 24s-24-10.7-24-24V305.9l-31 31c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l72-72c9.4-9.4 24.6-9.4 33.9 0l72 72c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-31-31V408z"/></svg>
|
||||
|
After Width: | Height: | Size: 567 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V288H216c-13.3 0-24 10.7-24 24s10.7 24 24 24H384V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM384 336V288H494.1l-39-39c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l80 80c9.4 9.4 9.4 24.6 0 33.9l-80 80c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l39-39H384zm0-208H256V0L384 128z"/></svg>
|
||||
|
After Width: | Height: | Size: 584 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V160H256c-17.7 0-32-14.3-32-32V0H64zM256 0V128H384L256 0zM64 256a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm152 32c5.3 0 10.2 2.6 13.2 6.9l88 128c3.4 4.9 3.7 11.3 1 16.5s-8.2 8.6-14.2 8.6H216 176 128 80c-5.8 0-11.1-3.1-13.9-8.1s-2.8-11.2 .2-16.1l48-80c2.9-4.8 8.1-7.8 13.7-7.8s10.8 2.9 13.7 7.8l12.8 21.4 48.3-70.2c3-4.3 7.9-6.9 13.2-6.9z"/></svg>
|
||||
|
After Width: | Height: | Size: 653 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M481.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-30.9 28.1c-7.7 7.1-11.4 17.5-10.9 27.9c.1 2.9 .2 5.8 .2 8.8s-.1 5.9-.2 8.8c-.5 10.5 3.1 20.9 10.9 27.9l30.9 28.1c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-39.7-12.6c-10-3.2-20.8-1.1-29.7 4.6c-4.9 3.1-9.9 6.1-15.1 8.7c-9.3 4.8-16.5 13.2-18.8 23.4l-8.9 40.7c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-8.9-40.7c-2.2-10.2-9.5-18.6-18.8-23.4c-5.2-2.7-10.2-5.6-15.1-8.7c-8.8-5.7-19.7-7.8-29.7-4.6L69.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l30.9-28.1c7.7-7.1 11.4-17.5 10.9-27.9c-.1-2.9-.2-5.8-.2-8.8s.1-5.9 .2-8.8c.5-10.5-3.1-20.9-10.9-27.9L8.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l39.7 12.6c10 3.2 20.8 1.1 29.7-4.6c4.9-3.1 9.9-6.1 15.1-8.7c9.3-4.8 16.5-13.2 18.8-23.4l8.9-40.7c2-9.1 9-16.3 18.2-17.8C213.3 1.2 227.5 0 242 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l8.9 40.7c2.2 10.2 9.4 18.6 18.8 23.4c5.2 2.7 10.2 5.6 15.1 8.7c8.8 5.7 19.7 7.7 29.7 4.6l39.7-12.6c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM242 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M528 160V416c0 8.8-7.2 16-16 16H320c0-44.2-35.8-80-80-80H176c-44.2 0-80 35.8-80 80H64c-8.8 0-16-7.2-16-16V160H528zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H512c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM272 256a64 64 0 1 0 -128 0 64 64 0 1 0 128 0zm104-48c-13.3 0-24 10.7-24 24s10.7 24 24 24h80c13.3 0 24-10.7 24-24s-10.7-24-24-24H376zm0 96c-13.3 0-24 10.7-24 24s10.7 24 24 24h80c13.3 0 24-10.7 24-24s-10.7-24-24-24H376z"/></svg>
|
||||
|
After Width: | Height: | Size: 684 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>
|
||||
|
After Width: | Height: | Size: 634 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M177.5 414c-8.8 3.8-19 2-26-4.6l-144-136C2.7 268.9 0 262.6 0 256s2.7-12.9 7.5-17.4l144-136c7-6.6 17.2-8.4 26-4.6s14.5 12.5 14.5 22l0 72 288 0c17.7 0 32 14.3 32 32l0 64c0 17.7-14.3 32-32 32l-288 0 0 72c0 9.6-5.7 18.2-14.5 22z"/></svg>
|
||||
|
After Width: | Height: | Size: 472 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M352 144c0-44.2 35.8-80 80-80s80 35.8 80 80v48c0 17.7 14.3 32 32 32s32-14.3 32-32V144C576 64.5 511.5 0 432 0S288 64.5 288 144v48H64c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V256c0-35.3-28.7-64-64-64H352V144z"/></svg>
|
||||
|
After Width: | Height: | Size: 485 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z"/></svg>
|
||||
|
After Width: | Height: | Size: 460 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M304 48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zm0 416c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM48 304c26.5 0 48-21.5 48-48s-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48zm464-48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM142.9 437c18.7-18.7 18.7-49.1 0-67.9s-49.1-18.7-67.9 0s-18.7 49.1 0 67.9s49.1 18.7 67.9 0zm0-294.2c18.7-18.7 18.7-49.1 0-67.9S93.7 56.2 75 75s-18.7 49.1 0 67.9s49.1 18.7 67.9 0zM369.1 437c18.7 18.7 49.1 18.7 67.9 0s18.7-49.1 0-67.9s-49.1-18.7-67.9 0s-18.7 49.1 0 67.9z"/></svg>
|
||||
|
After Width: | Height: | Size: 805 B |
|
Before Width: | Height: | Size: 561 KiB |
|
After Width: | Height: | Size: 497 B |
|
After Width: | Height: | Size: 520 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M135.2 17.7C140.6 6.8 151.7 0 163.8 0H284.2c12.1 0 23.2 6.8 28.6 17.7L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32h96l7.2-14.3zM32 128H416V448c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64V128zm96 64c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16z"/></svg>
|
||||
|
After Width: | Height: | Size: 735 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM625 177L497 305c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L591 143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>
|
||||
|
After Width: | Height: | Size: 569 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H322.8c-3.1-8.8-3.7-18.4-1.4-27.8l15-60.1c2.8-11.3 8.6-21.5 16.8-29.7l40.3-40.3c-32.1-31-75.7-50.1-123.9-50.1H178.3zm435.5-68.3c-15.6-15.6-40.9-15.6-56.6 0l-29.4 29.4 71 71 29.4-29.4c15.6-15.6 15.6-40.9 0-56.6l-14.4-14.4zM375.9 417c-4.1 4.1-7 9.2-8.4 14.9l-15 60.1c-1.4 5.5 .2 11.2 4.2 15.2s9.7 5.6 15.2 4.2l60.1-15c5.6-1.4 10.8-4.3 14.9-8.4L576.1 358.7l-71-71L375.9 417z"/></svg>
|
||||
|
After Width: | Height: | Size: 728 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM504 312V248H440c-13.3 0-24-10.7-24-24s10.7-24 24-24h64V136c0-13.3 10.7-24 24-24s24 10.7 24 24v64h64c13.3 0 24 10.7 24 24s-10.7 24-24 24H552v64c0 13.3-10.7 24-24 24s-24-10.7-24-24z"/></svg>
|
||||
|
After Width: | Height: | Size: 605 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L353.3 251.6C407.9 237 448 187.2 448 128C448 57.3 390.7 0 320 0C250.2 0 193.5 55.8 192 125.2L38.8 5.1zM264.3 304.3C170.5 309.4 96 387.2 96 482.3c0 16.4 13.3 29.7 29.7 29.7H514.3c3.9 0 7.6-.7 11-2.1l-261-205.6z"/></svg>
|
||||
|
After Width: | Height: | Size: 564 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z"/></svg>
|
||||
|
After Width: | Height: | Size: 427 B |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
@@ -4,20 +4,26 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<!--<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">-->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>-->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
|
||||
rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="img/apple-icon-57x57.png" />
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-icon-72x72.png" />
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-icon-114x114.png" />
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="img/apple-icon-144x144.png" />
|
||||
|
||||
<script src="scripts/jquery-3.5.1.min.js"></script>
|
||||
<script src="scripts/jquery.transit.min.js"></script>
|
||||
<script src="scripts/jquery-cookie-1.4.1.min.js"></script>
|
||||
<script src="scripts/showdown.min.js"></script>
|
||||
<script src="scripts/popper.js"></script>
|
||||
<script src="scripts/purify.min.js"></script>
|
||||
<script type="module" src="scripts/RossAscends-mods.js"></script>
|
||||
<script type="module" src="scripts/swiped-events.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<link rel="stylesheet" href="css/bg_load.css">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
@@ -38,6 +44,11 @@
|
||||
<script type=module src="script.js">
|
||||
</script>
|
||||
|
||||
<script type="module" src="scripts/world-info.js"></script>
|
||||
<script type="module" src="scripts/group-chats.js"></script>
|
||||
<script type="module" src="scripts/power-user.js"></script>
|
||||
<script type="module" src="scripts/kai-settings.js"></script>
|
||||
|
||||
<title>Tavern.AI</title>
|
||||
</head>
|
||||
|
||||
@@ -98,7 +109,7 @@
|
||||
|
||||
<div id="talkativeness_div">
|
||||
<h4>Talkativeness</h4>
|
||||
<h5>How often does the character speak randomly. <span class="warning">Affects group chats only!</span>
|
||||
<h5>How often the chracter speaks in <span class="warning">group chats!</span>
|
||||
</h5>
|
||||
<input id="talkativeness_slider" name="talkativeness" type="range" min="0" max="1" step="0.05" value="0.5"
|
||||
form="form_create">
|
||||
@@ -235,13 +246,13 @@
|
||||
<div id="shadow_select_chat_popup">
|
||||
<div id="select_chat_popup">
|
||||
<div id="select_chat_popup_text">
|
||||
<img id="select_chat_cross" src="img/cross.png"
|
||||
style="position: absolute; right: 15px; top:14px; width: 20px; height: 20px; cursor: pointer; opacity: 0.6">
|
||||
<img id="select_chat_cross" src="img/cross.png" alt="Close">
|
||||
|
||||
</div>
|
||||
<div id="select_chat_import"> <!-- import chat popup header -->
|
||||
|
||||
<input id="chat_import_button" class="menu_button" type="submit" value="+Import">
|
||||
<div id="chat_import_button" class="right_menu_button">
|
||||
<img alt="" class="svg_icon" src="img/cloud-arrow-up-solid.svg" />
|
||||
</div>
|
||||
<div>
|
||||
<a href="/notes/10" class="notes-link" target="_blank"><span class="note-link-span">?</span></a>
|
||||
</div>
|
||||
@@ -312,21 +323,33 @@
|
||||
|
||||
<nav id="right-nav-panel">
|
||||
<div id="right-nav-panel-tabs">
|
||||
<div class="right_menu_button" id="rm_button_characters" title="Select/Create Characters">👤</div>
|
||||
<div class="right_menu_button" id="rm_button_settings" title="API and AI Settings">⚙️</div>
|
||||
<div class="right_menu_button" id="rm_button_characters" title="Select/Create Characters">
|
||||
<img alt="" class="svg_icon" src="img/id-card-regular.svg" />
|
||||
</div>
|
||||
<div class="right_menu_button" id="rm_button_settings" title="API and AI Settings">
|
||||
<img alt="" class="svg_icon" src="img/gear-solid.svg" />
|
||||
</div>
|
||||
<div class="right_menu_button" id="rm_button_extensions" title="Extensions">
|
||||
<img alt="" class="svg_icon" src="img/cubes-solid.svg" />
|
||||
</div>
|
||||
<div class="right_menu_button" id="rm_button_selected_ch">
|
||||
<h2></h2>
|
||||
</div>
|
||||
<div class="right_menu_button" id="rm_button_panel_pin_div"><input type="checkbox" id="rm_button_panel_pin"
|
||||
title="Locked = Settings panel stays open"></div>
|
||||
<div class="right_menu_button" id="rm_button_panel_pin_div" title="Locked = Settings panel stays open">
|
||||
<input type="checkbox" id="rm_button_panel_pin">
|
||||
<label for="rm_button_panel_pin">
|
||||
<img class="unchecked svg_icon" alt="" src="img/lock-open-solid.svg" />
|
||||
<img class="checked svg_icon" alt="" src="img/lock-solid.svg" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rm_ch_create_block" class="right_menu" style="display: none;">
|
||||
<form id="form_create" action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
<div id="avatar-and-name-block">
|
||||
<div id="name_div">
|
||||
<h4>Character Name</h4><br>
|
||||
<input id="character_name_pole" name="ch_name" class="text_pole" maxlength="120" value=""
|
||||
<h4>Character Name</h4>
|
||||
<input id="character_name_pole" name="ch_name" class="text_pole" placeholder="Name this character" maxlength="120" value=""
|
||||
autocomplete="off">
|
||||
</div>
|
||||
<div id="avatar_div" class="avatar_div">
|
||||
@@ -337,24 +360,44 @@
|
||||
title="Click to select a new avatar for this character">
|
||||
<input type="file" id="add_avatar_button" name="avatar"
|
||||
accept="image/png, image/jpeg, image/jpg, image/gif, image/bmp">
|
||||
Change Avatar
|
||||
<img alt="" class="svg_icon" src="img/file-image-solid.svg">
|
||||
</label>
|
||||
<div class="form_create_bottom_buttons_block">
|
||||
<div id="rm_button_back" class="menu_button">
|
||||
<img alt="" class="svg_icon" src="img/left-long-solid.svg">
|
||||
</div>
|
||||
<div id="advanced_div" class="menu_button" title="Advanced Definitions">
|
||||
<img alt="" class="svg_icon" src="img/book-solid.svg">
|
||||
</div>
|
||||
<div id="export_button" class="menu_button" title="Export and Download">
|
||||
<img alt="" class="svg_icon" src="img/file-export-solid.svg">
|
||||
</div>
|
||||
<!-- <div id="create_button" class="menu_button" type="submit" title="Create Character">✅</div> -->
|
||||
<label for="create_button" id="create_button_label" class="menu_button" title="Create Character">
|
||||
<input type="submit" id="create_button" name="create_button">
|
||||
<img alt="" class="svg_icon" src="img/user-check-solid.svg">
|
||||
</label>
|
||||
<!-- <input id="create_button" class="menu_button" title="Create Character" type="submit" value="✅"> -->
|
||||
<div id="delete_button" class="menu_button" title="Delete Character" >
|
||||
<img alt="" class="svg_icon" src="img/trash-can-solid.svg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="result_info" style="width: 100px;"> </div>
|
||||
<div id="result_info"></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="description_div" class="margin-bot-10px">
|
||||
<div id="description_div" class="margin-bot-10px">
|
||||
<h4>Description <a href="/notes/1" class="notes-link" target="_blank"><span
|
||||
class="note-link-span">?</span></a></h4>
|
||||
</div>
|
||||
<textarea id="description_textarea" class="margin-bot-10px" name="description"
|
||||
<textarea id="description_textarea" placeholder="Describe your character's physical and mental traits here." class="margin-bot-10px" name="description"
|
||||
placeholder=""></textarea>
|
||||
|
||||
<div id="first_message_div" class="margin-bot-10px">
|
||||
<div id="first_message_div" class="margin-bot-10px">
|
||||
<h4>First message<a href="/notes/3" class="notes-link" target="_blank"><span
|
||||
class="note-link-span">?</span></a></h4>
|
||||
</div>
|
||||
<textarea id="firstmessage_textarea" class="margin-bot-10px" name="first_mes" placeholder=""></textarea>
|
||||
<textarea id="firstmessage_textarea" placeholder="This will be the first message from the character that starts every chat." class="margin-bot-10px" name="first_mes" placeholder=""></textarea>
|
||||
|
||||
<!-- these divs are invisible and used for server communication purposes -->
|
||||
<div id="hidden-divs">
|
||||
@@ -376,23 +419,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- now back to normal divs for display purposes-->
|
||||
|
||||
<input id="advanced_div" class="menu_button" type="button" value="Advanced Edit">
|
||||
|
||||
<div class="form_create_bottom_buttons_block">
|
||||
<div id="rm_button_back" class="menu_button">Go Back</div>
|
||||
<input id="delete_button" class="menu_button" type="button" value="Delete">
|
||||
<input id="export_button" class="menu_button" type="button" value="Export">
|
||||
<input id="create_button" class="menu_button" type="submit" value="Create">
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div id="rm_group_chats_block" class="right_menu">
|
||||
<div id="rm_group_top_bar">
|
||||
<div id="rm_button_back_from_group" class="right_menu_button">
|
||||
<h2 style="color: rgb(188, 193, 200, 0.5);">⇐</h2>
|
||||
<div id="rm_button_back_from_group" class="menu_button">
|
||||
<img alt="" class="svg_icon" src="img/left-long-solid.svg">
|
||||
</div>
|
||||
<input id="rm_group_chat_name" class="text_pole" type="text" name="chat_name"
|
||||
placeholder="Chat Name (Optional)" />
|
||||
@@ -410,12 +442,12 @@
|
||||
<div id="group_member_template">
|
||||
<div class="group_member">
|
||||
<div class="avatar">
|
||||
<img src="" />
|
||||
<img alt="Avatar" src="" />
|
||||
</div>
|
||||
<div class="ch_name"></div>
|
||||
<div class="group_member_icon">
|
||||
<img class="minus" src="img/minus-solid.svg">
|
||||
<img class="plus" src="img/plus-solid.svg">
|
||||
<img alt="Remove" class="minus svg_icon" src="img/minus-solid.svg">
|
||||
<img alt="Add" class="plus svg_icon" src="img/plus-solid.svg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -426,7 +458,7 @@
|
||||
<img src="">
|
||||
</div>
|
||||
<div class="group_icon">
|
||||
<img src="img/user-group-solid.svg">
|
||||
<img class="svg_icon" src="img/user-group-solid.svg">
|
||||
</div>
|
||||
<div class="ch_name"></div>
|
||||
</div>
|
||||
@@ -457,7 +489,7 @@
|
||||
<div id="kobold_api" style="position: relative;"> <!-- shows the kobold settings -->
|
||||
<div class="API-logo">
|
||||
<a href="https://github.com/KoboldAI/KoboldAI-Client" target="_blank">
|
||||
<img src="img/kobold.png" style="width:40px;height:40px;">
|
||||
<img alt="KoboldAI Logo" src="img/kobold.png" style="width:40px;height:40px;">
|
||||
</a>
|
||||
</div>
|
||||
<form action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
@@ -476,8 +508,11 @@
|
||||
<hr>
|
||||
|
||||
<div id="ai-presets-and-config-block">
|
||||
<h4>Preset settings <a href="/notes/4" class="notes-link" target="_blank"><span
|
||||
class="note-link-span">?</span></a></h4>
|
||||
<h3>Preset settings
|
||||
<a href="/notes/4" class="notes-link" target="_blank">
|
||||
<span class="note-link-span">?</span>
|
||||
</a>
|
||||
</h3>
|
||||
<select id="settings_perset">
|
||||
<option value="gui">GUI KoboldAI Settings</option>
|
||||
</select>
|
||||
@@ -507,12 +542,94 @@
|
||||
<h4>Repetition Penalty Range</h4>
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<h5 id="rep_pen_size_counter">select</h5>
|
||||
<h5 id="rep_pen_range_counter">select</h5>
|
||||
</div>
|
||||
<div class="range-block-range"><input type="range" id="rep_pen_size" name="volume"
|
||||
<div class="range-block-range"><input type="range" id="rep_pen_range" name="volume"
|
||||
min="0" max="2048" step="1"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drawer">
|
||||
<div class="drawer-toggle drawer-header">
|
||||
<h3>Advanced Settings
|
||||
<a href="/notes/kai_advanced" class="notes-link" target="_blank">
|
||||
<span class="note-link-span">?</span>
|
||||
</a>
|
||||
</h3>
|
||||
<div class="drawer-icon down"></div>
|
||||
</div>
|
||||
<div class="drawer-content">
|
||||
<label class="checkbox_label" for="single_line">
|
||||
<input id="single_line" type="checkbox" />
|
||||
<h4>Single-line mode</h4>
|
||||
</label>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title">
|
||||
<h4>Top P Sampling</h4>
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<h5 id="top_p_counter">select</h5>
|
||||
</div>
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="top_p" name="volume" min="0" max="1" step="0.01">
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title">
|
||||
<h4>Top A Sampling</h4>
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<h5 id="top_a_counter">select</h5>
|
||||
</div>
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="top_a" name="volume" min="0" max="1" step="0.01">
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title">
|
||||
<h4>Top K Sampling</h4>
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<h5 id="top_k_counter">select</h5>
|
||||
</div>
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="top_k" name="volume" min="0" max="100" step="1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title">
|
||||
<h4>Typical Sampling</h4>
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<h5 id="typical_counter">select</h5>
|
||||
</div>
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="typical" name="volume" min="0" max="1" step="0.01">
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title">
|
||||
<h4>Tail Free Sampling</h4>
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<h5 id="tfs_counter">select</h5>
|
||||
</div>
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="tfs" name="volume" min="0" max="1" step="0.05">
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title">
|
||||
<h4>Repetition Penalty Slope</h4>
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<h5 id="rep_pen_slope_counter">select</h5>
|
||||
</div>
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="rep_pen_slope" name="volume" min="0" max="10" step="0.1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="softprompt_block">
|
||||
<h4>Soft Prompt</h4>
|
||||
@@ -562,19 +679,26 @@
|
||||
<input type="range" id="rep_pen_size_textgenerationwebui" name="volume" min="0" max="2048"
|
||||
step="1">
|
||||
|
||||
<h4>Top K</h4>
|
||||
<h5 id="top_k_counter_textgenerationwebui">select</h5>
|
||||
<input type="range" id="top_k_textgenerationwebui" name="volume" min="0" max="200" step="1">
|
||||
<h4>Top P</h4>
|
||||
<h5 id="top_p_counter_textgenerationwebui">select</h5>
|
||||
<input type="range" id="top_p_textgenerationwebui" name="volume" min="0" max="1" step="0.1">
|
||||
<h4>Typical P</h4>
|
||||
<h5 id="typical_p_counter_textgenerationwebui">select</h5>
|
||||
<input type="range" id="typical_p_textgenerationwebui" name="volume" min="0" max="1" step="0.1">
|
||||
<h4>Penalty Alpha</h4>
|
||||
<h5 id="penalty_alpha_counter_textgenerationwebui">select</h5>
|
||||
<input type="range" id="penalty_alpha_textgenerationwebui" name="volume" min="0" max="5"
|
||||
step="0.05" />
|
||||
<div class="drawer">
|
||||
<div class="drawer-toggle drawer-header">
|
||||
<h3>Advanced Settings</h3>
|
||||
<div class="drawer-icon down"></div>
|
||||
</div>
|
||||
<div class="drawer-content">
|
||||
<h4>Top K</h4>
|
||||
<h5 id="top_k_counter_textgenerationwebui">select</h5>
|
||||
<input type="range" id="top_k_textgenerationwebui" name="volume" min="0" max="200" step="1">
|
||||
<h4>Top P</h4>
|
||||
<h5 id="top_p_counter_textgenerationwebui">select</h5>
|
||||
<input type="range" id="top_p_textgenerationwebui" name="volume" min="0" max="1" step="0.1">
|
||||
<h4>Typical P</h4>
|
||||
<h5 id="typical_p_counter_textgenerationwebui">select</h5>
|
||||
<input type="range" id="typical_p_textgenerationwebui" name="volume" min="0" max="1" step="0.1">
|
||||
<h4>Penalty Alpha</h4>
|
||||
<h5 id="penalty_alpha_counter_textgenerationwebui">select</h5>
|
||||
<input type="range" id="penalty_alpha_textgenerationwebui" name="volume" min="0" max="5" step="0.05" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -635,7 +759,8 @@
|
||||
<input type="file" id="avatar_upload_file" accept="image/png" name="avatar">
|
||||
</form>
|
||||
<form id='form_change_name' action="javascript:void(null);" method="post" enctype="multipart/form-data">
|
||||
<h4>Name</h4><br>
|
||||
<br>
|
||||
<h4>Name</h4>
|
||||
<input id="your_name" name="your_name" class="text_pole" maxlength="35" value=""
|
||||
autocomplete="off"><br>
|
||||
<input id="your_name_button" class="menu_button" type="submit"
|
||||
@@ -698,6 +823,10 @@
|
||||
<h5 id="max_context_counter">select</h5>
|
||||
<input type="range" id="max_context" name="volume" min="512" max="2048" step="1">
|
||||
</div>
|
||||
<label class="checkbox_label" for="pin-examples-checkbox"><input id="pin-examples-checkbox" type="checkbox" />
|
||||
<h4>Pin message examples</h4>
|
||||
</label>
|
||||
<h5>Example dialogues stay in context</h5>
|
||||
<div id="anchors-block">
|
||||
<h4>Anchors Order</h4>
|
||||
<h5>Helps to increase the length of messages <a href="/notes/9" class="notes-link"
|
||||
@@ -715,6 +844,30 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drawer">
|
||||
<div class="drawer-toggle drawer-header">
|
||||
<h3>Advanced Formatting
|
||||
<a href="/notes/advanced_formatting" class="notes-link" target="_blank">
|
||||
<span class="note-link-span">?</span>
|
||||
</a>
|
||||
</h3>
|
||||
<div class="drawer-icon down"></div>
|
||||
</div>
|
||||
<div class="drawer-content">
|
||||
<label class="checkbox_label" for="disable-description-formatting-checkbox">
|
||||
<input id="disable-description-formatting-checkbox" type="checkbox" />
|
||||
<h4>Disable description formatting</h4>
|
||||
</label>
|
||||
<label class="checkbox_label" for="disable-scenario-formatting-checkbox">
|
||||
<input id="disable-scenario-formatting-checkbox" type="checkbox" />
|
||||
<h4>Disable scenario formatting</h4>
|
||||
</label>
|
||||
<label class="checkbox_label" for="disable-personality-formatting-checkbox">
|
||||
<input id="disable-personality-formatting-checkbox" type="checkbox" />
|
||||
<h4>Disable personality formatting</h4>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@@ -731,9 +884,36 @@
|
||||
<label for="collapse-newlines-checkbox"><input id="collapse-newlines-checkbox" type="checkbox" />
|
||||
<h4>Collapse Newlines in Output</h4>
|
||||
</label>
|
||||
<label for="force-pygmalion-formatting-checkbox"><input id="force-pygmalion-formatting-checkbox" type="checkbox" />
|
||||
<h4>Force Pygmalion formatting for any model</h4>
|
||||
</label>
|
||||
<label for="swipes-checkbox"><input id="swipes-checkbox" type="checkbox" />
|
||||
<h4>Swipes</h4>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rm_extensions_block" class="right_menu">
|
||||
<div class="extensions_block">
|
||||
<h3>Extensions API: <a target="_blank" href="https://github.com/SillyLossy/TavernAI-extras">TavernAI-extras</a></h3>
|
||||
<input id="extensions_url" type="text" class="text_pole" />
|
||||
<div class="extensions_url_block">
|
||||
<input id="extensions_connect" class="menu_button" type="submit" value="Connect" />
|
||||
<span class="expander"></span>
|
||||
<label for="extensions_autoconnect"><input id="extensions_autoconnect" type="checkbox"/>Auto-connect</label>
|
||||
</div>
|
||||
<div id="extensions_status">Not connected</div>
|
||||
<div id="extensions_loaded">
|
||||
<h4>Active extensions</h4>
|
||||
<ul id="extensions_list">
|
||||
</ul>
|
||||
<p>Missing something? Press <a id="extensions_details" href="javascript:void">here</a> for more details!</p>
|
||||
</div>
|
||||
<div id="extensions_settings">
|
||||
<h3>Extension settings</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rm_character_import" class="right_menu" style="display: none;">
|
||||
@@ -747,16 +927,19 @@
|
||||
|
||||
<div id="rm_characters_block" class="right_menu">
|
||||
<div class="form_create_bottom_buttons_block">
|
||||
<div id="rm_button_create" class="menu_button">+New Character</div>
|
||||
<div id="character_import_button" class="menu_button">+Import</div>
|
||||
<div id="rm_button_group_chats" class="menu_button">+Group</div>
|
||||
<div id="rm_button_create" title="Create New Character" class="menu_button">
|
||||
<img alt="" class="svg_icon" src="img/user-plus-solid.svg">
|
||||
</div>
|
||||
<div id="character_import_button" title="Import Character from File" class="menu_button">
|
||||
<img alt="" class="svg_icon" src="img/file-arrow-up-solid.svg">
|
||||
</div>
|
||||
<div id="rm_button_group_chats" title="Create New Chat Group" class="menu_button">
|
||||
<img alt="" class="svg_icon" src="img/user-group-solid.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="form_character_search_form" action="javascript:void(null);">
|
||||
<input id="character_search_bar" class="text_pole" type="search" placeholder="Search here..." />
|
||||
<div id="characloud_url" class="menu_button" title="Find more characters on CharaCloud (coming soon)">
|
||||
<img src="img/cloud_logo.png">
|
||||
</div>
|
||||
<input id="character_search_bar" class="text_pole" type="search" placeholder="Character search..." />
|
||||
</form>
|
||||
<div id="rm_print_characters_block"></div>
|
||||
|
||||
@@ -774,6 +957,28 @@
|
||||
<div class="typing_indicator"><span class="typing_indicator_name">CHAR</span> is typing</div>
|
||||
</div>
|
||||
|
||||
<div id="message_template">
|
||||
<div class="mes" mesid="${count_view_mes}" ch_name="${characterName}" is_user="${mes.is_user}">
|
||||
<div class="for_checkbox"></div><input type="checkbox" class="del_checkbox">
|
||||
<div class="avatar"><img src=""></div>
|
||||
<div class="swipe_left"><img src="img/swipe_left.png"></div>
|
||||
<div class="mes_block">
|
||||
<div class="ch_name">
|
||||
<span class="name_text">${characterName}</span>
|
||||
<div title=Edit class=mes_edit></div>
|
||||
<div class=mes_edit_cancel><img src=img/cancel.png></div>
|
||||
<div class=mes_edit_done><img src=img/done.png></div>
|
||||
</div>
|
||||
<div class=mes_text></div>
|
||||
</div>
|
||||
<div class="mes_bias">${bias}</div>
|
||||
<div class="swipe_right">
|
||||
<div class="swipes-counter"></div>
|
||||
<img src="img/swipe_right.png">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="group_avatars_template">
|
||||
<div class="avatar avatar_collage collage_1">
|
||||
<img alt="img1" class="img_1" src="">
|
||||
@@ -807,27 +1012,27 @@
|
||||
<div id="options_button">
|
||||
<div id="options">
|
||||
<div class="options-content">
|
||||
<a id="option_start_new_chat"><img src="img/save_and_start_new_chat.png"><span>Start new
|
||||
chat</span></a>
|
||||
<a id="option_select_chat"><img src="img/book6.png"><span>View Past Chats</span></a>
|
||||
<a id="option_start_new_chat">
|
||||
<img alt="" src="img/save_and_start_new_chat.png">
|
||||
<span>Start new chat</span></a>
|
||||
<a id="option_select_chat">
|
||||
<img alt="" src="img/book6.png">
|
||||
<span>View Past Chats</span>
|
||||
</a>
|
||||
<hr>
|
||||
<a id="option_delete_mes"><img src="img/del_mes.png"><span>Delete messages</span></a>
|
||||
<a id="option_regenerate"><img src="img/regenerate.png"><span>Regenerate</span></a>
|
||||
<a id="option_delete_mes">
|
||||
<img alt="" src="img/del_mes.png">
|
||||
<span>Delete messages</span>
|
||||
</a>
|
||||
<a id="option_regenerate">
|
||||
<img alt="" src="img/regenerate.png">
|
||||
<span>Regenerate</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<textarea id="send_textarea" placeholder="Not connected to API!" name="text"></textarea>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
//RossAscends: this script makes the chat input text area resize vertically to match the text size (limited by CSS at 50% window height)
|
||||
$('#send_textarea').on('input', function () {
|
||||
this.style.height = '40px';
|
||||
this.style.height =
|
||||
(this.scrollHeight) + 'px';
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="send_but_sheld">
|
||||
<div id="loading_mes"></div>
|
||||
<input id="send_but" type="button">
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Advanced Formatting</title>
|
||||
<link rel="stylesheet" href="/css/notes.css">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
|
||||
rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
<h2>Advanced Formatting</h2>
|
||||
<p>
|
||||
The settings provided in this section allow for a more control over the prompt building strategy.
|
||||
</p>
|
||||
<h3>For <u>Pygmalion</u> models</h3>
|
||||
<h4>Disable description formatting</h4>
|
||||
<p>
|
||||
<code><b>NAME's Persona: </b></code> won't be prepended to the content your character's Description box.
|
||||
</p>
|
||||
<h4>Disable scenario formatting</h4>
|
||||
<p>
|
||||
<code><b>Scenario: </b></code> won't be prepended to the content your character's Scenario box.
|
||||
</p>
|
||||
<h4>Disable personality formatting</h4>
|
||||
<p>
|
||||
<code><b>Personality: </b></code> won't be prepended to the content your character's Personality box.
|
||||
</p>
|
||||
<h3>For <u>non-Pygmalion</u> models</h3>
|
||||
<h4>Disable description formatting</h4>
|
||||
<p>
|
||||
Has no effect.
|
||||
</p>
|
||||
<h4>Disable scenario formatting</h4>
|
||||
<p>
|
||||
<code><b>Circumstances and context of the dialogue: </b></code> won't be prepended to the content your character's Scenario box.
|
||||
</p>
|
||||
<h4>Disable personality formatting</h4>
|
||||
<p>
|
||||
<code><b>NAME's personality: </b></code> won't be prepended to the content your character's Personality box.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,83 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Advanced Settings</title>
|
||||
<link rel="stylesheet" href="/css/notes.css">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
|
||||
rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
<h2>Advanced Settings</h2>
|
||||
<p>
|
||||
The settings provided in this section offer a more detailed level of control over the text generation
|
||||
process. It is important to be careful when making changes to these settings without proper
|
||||
consideration, as doing so may result in degraded quality of responses.
|
||||
</p>
|
||||
<h3>Single-line mode</h3>
|
||||
<p>
|
||||
In single-line mode the AI generates only one line per request. This allows for quicker generation of
|
||||
shorter prompts, but it does not produce responses that consist of more than one line.
|
||||
</p>
|
||||
<h3>Top P Sampling</h3>
|
||||
<p>
|
||||
This setting controls how much of the text generated is based on the most likely options.
|
||||
The top P words with the highest probabilities are considered. A word is then chosen at random, with a
|
||||
higher chance of selecting words with higher probabilities.
|
||||
</p>
|
||||
<p>
|
||||
Set value to 1 to disable its effect.
|
||||
</p>
|
||||
<h3>Top K Sampling</h3>
|
||||
<p>
|
||||
This setting limits the number of words to choose from to the top K most likely options. Can be used
|
||||
together with Top P sampling.
|
||||
</p>
|
||||
<p>
|
||||
Set value to 0 to disable its effect.
|
||||
</p>
|
||||
<h3>Top A Sampling</h3>
|
||||
<p>
|
||||
This setting allows for a more flexible version of sampling, where the number of words chosen from
|
||||
the most likely options is automatically determined based on the likelihood distribution of the options,
|
||||
but instead of choosing the top P or K words, it chooses all words with probabilities above a certain
|
||||
threshold.
|
||||
</p>
|
||||
<p>
|
||||
Set value to 0 to disable its effect.
|
||||
</p>
|
||||
<h3>Typical Sampling</h3>
|
||||
<p>
|
||||
This setting selects words randomly from the list of possible words, with each word having an equal
|
||||
chance of being selected. This method can produce text that is more diverse but may also be less
|
||||
coherent.
|
||||
</p>
|
||||
<p>
|
||||
Set value to 1 to disable its effect.
|
||||
</p>
|
||||
<h3>Tail Free Sampling</h3>
|
||||
<p>
|
||||
This setting removes the least probable words from consideration during text generation, which can
|
||||
improve the quality and coherence of the generated text.
|
||||
</p>
|
||||
<p>
|
||||
Set value to 1 to disable its effect.
|
||||
</p>
|
||||
<h3>Repetition Penalty Slope</h3>
|
||||
<p>
|
||||
If both this and Repetition Penalty Range are above 0, then repetition penalty will have more effect
|
||||
closer to the end of the prompt. The higher the value, the stronger the effect.
|
||||
</p>
|
||||
<p>Set value to 1 for linear interpolation or 0 to disable interpolation.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,365 @@
|
||||
import { encode } from "../scripts/gpt-2-3-tokenizer/mod.js";
|
||||
|
||||
import {
|
||||
Generate,
|
||||
this_chid,
|
||||
characters,
|
||||
online_status,
|
||||
main_api,
|
||||
api_server,
|
||||
api_key_novel,
|
||||
is_send_press,
|
||||
|
||||
} from "../script.js";
|
||||
|
||||
import {
|
||||
pin_examples,
|
||||
} from "./power-user.js";
|
||||
|
||||
import { LoadLocal, SaveLocal, ClearLocal, CheckLocal, LoadLocalBool } from "./f-localStorage.js";
|
||||
import { selected_group, is_group_generating } from "./group-chats.js";
|
||||
|
||||
var NavToggle = document.getElementById("nav-toggle");
|
||||
var PanelPin = document.getElementById("rm_button_panel_pin");
|
||||
var SelectedCharacterTab = document.getElementById("rm_button_selected_ch");
|
||||
var RightNavPanel = document.getElementById("right-nav-panel");
|
||||
var AdvancedCharDefsPopup = document.getElementById("character_popup");
|
||||
var ConfirmationPopup = document.getElementById("dialogue_popup");
|
||||
var AutoConnectCheckbox = document.getElementById("auto-connect-checkbox");
|
||||
var AutoLoadChatCheckbox = document.getElementById("auto-load-chat-checkbox");
|
||||
var SelectedNavTab = ("#" + LoadLocal('SelectedNavTab'));
|
||||
|
||||
var create_save_name;
|
||||
var create_save_description;
|
||||
var create_save_personality;
|
||||
var create_save_first_message;
|
||||
var create_save_scenario;
|
||||
var create_save_mes_example;
|
||||
var count_tokens;
|
||||
var perm_tokens;
|
||||
|
||||
const observerConfig = { childList: true, subtree: true };
|
||||
|
||||
const observer = new MutationObserver(function (mutations) {
|
||||
mutations.forEach(function (mutation) {
|
||||
if (mutation.target.id === "online_status_text2") {
|
||||
RA_checkOnlineStatus();
|
||||
} else if (mutation.target.parentNode === SelectedCharacterTab) {
|
||||
setTimeout(RA_CountCharTokens, 200);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.documentElement, observerConfig);
|
||||
|
||||
|
||||
//RossAscends: Added function to format dates used in files and chat timestamps to a humanized format.
|
||||
//Mostly I wanted this to be for file names, but couldn't figure out exactly where the filename save code was as everything seemed to be connected.
|
||||
//Does not break old characters/chats, as the code just uses whatever timestamp exists in the chat.
|
||||
//New chats made with characters will use this new formatting.
|
||||
export function humanizedDateTime() {
|
||||
let baseDate = new Date(Date.now());
|
||||
let humanYear = baseDate.getFullYear();
|
||||
let humanMonth = baseDate.getMonth() + 1;
|
||||
let humanDate = baseDate.getDate();
|
||||
let humanHour = (baseDate.getHours() < 10 ? "0" : "") + baseDate.getHours();
|
||||
let humanMinute =
|
||||
(baseDate.getMinutes() < 10 ? "0" : "") + baseDate.getMinutes();
|
||||
let humanSecond =
|
||||
(baseDate.getSeconds() < 10 ? "0" : "") + baseDate.getSeconds();
|
||||
let humanMillisecond =
|
||||
(baseDate.getMilliseconds() < 10 ? "0" : "") + baseDate.getMilliseconds();
|
||||
let HumanizedDateTime =
|
||||
humanYear + "-" + humanMonth + "-" + humanDate + " @" + humanHour + "h " + humanMinute + "m " + humanSecond + "s " + humanMillisecond + "ms";
|
||||
return HumanizedDateTime;
|
||||
}
|
||||
|
||||
|
||||
// triggers:
|
||||
$("#rm_button_create").on("click", function () { //when "+New Character" is clicked
|
||||
$(SelectedCharacterTab).children("h2").html(''); // empty nav's 3rd panel tab
|
||||
|
||||
//empty temp vars to store new char data for counting
|
||||
create_save_name = "";
|
||||
create_save_description = "";
|
||||
create_save_personality = "";
|
||||
create_save_first_message = "";
|
||||
create_save_scenario = "";
|
||||
create_save_mes_example = "";
|
||||
$("#result_info").html('Type to start counting tokens!');
|
||||
});
|
||||
$("#rm_ch_create_block").on("input", function () { RA_CountCharTokens(); }); //when any input is made to the create/edit character form textareas
|
||||
$("#character_popup").on("input", function () { RA_CountCharTokens(); }); //when any input is made to the advanced editing popup textareas
|
||||
//function:
|
||||
function RA_CountCharTokens() {
|
||||
$("#result_info").html("");
|
||||
console.log('RA_TC -- starting with this_chid = ' + this_chid);
|
||||
if (document.getElementById('name_div').style.display == "block") { //if new char
|
||||
|
||||
$("#form_create").on("input", function () { //fill temp vars with form_create values
|
||||
create_save_name = $("#character_name_pole").val();
|
||||
create_save_description = $("#description_textarea").val();
|
||||
create_save_first_message = $("#firstmessage_textarea").val();
|
||||
});
|
||||
$("#character_popup").on("input", function () { //fill temp vars with advanced popup values
|
||||
create_save_personality = $("#personality_textarea").val();
|
||||
create_save_scenario = $("#scenario_pole").val();
|
||||
create_save_mes_example = $("#mes_example_textarea").val();
|
||||
|
||||
});
|
||||
|
||||
//count total tokens, including those that will be removed from context once chat history is long
|
||||
count_tokens = encode(JSON.stringify(
|
||||
create_save_name +
|
||||
create_save_description +
|
||||
create_save_personality +
|
||||
create_save_scenario +
|
||||
create_save_first_message +
|
||||
create_save_mes_example
|
||||
)).length;
|
||||
|
||||
//count permanent tokens that will never get flushed out of context
|
||||
perm_tokens = encode(JSON.stringify(
|
||||
create_save_name +
|
||||
create_save_description +
|
||||
create_save_personality +
|
||||
create_save_scenario
|
||||
)).length;
|
||||
|
||||
} else {
|
||||
if (this_chid !== undefined && this_chid !== "invalid-safety-id") { // if we are counting a valid pre-saved char
|
||||
|
||||
//same as above, all tokens including temporary ones
|
||||
count_tokens = encode(
|
||||
JSON.stringify(
|
||||
characters[this_chid].description +
|
||||
characters[this_chid].personality +
|
||||
characters[this_chid].scenario +
|
||||
characters[this_chid].first_mes +
|
||||
characters[this_chid].mes_example
|
||||
)).length;
|
||||
|
||||
//permanent tokens count
|
||||
perm_tokens = encode(
|
||||
JSON.stringify(
|
||||
characters[this_chid].name +
|
||||
characters[this_chid].description +
|
||||
characters[this_chid].personality +
|
||||
characters[this_chid].scenario +
|
||||
(pin_examples ? characters[this_chid].mes_example : '') // add examples to permanent if they are pinned
|
||||
)).length;
|
||||
} else { console.log("RA_TC -- no valid char found, closing."); } // if neither, probably safety char or some error in loading
|
||||
}
|
||||
// display the counted tokens
|
||||
if (count_tokens < 1024 && perm_tokens < 1024) {
|
||||
$("#result_info").html(count_tokens + " Tokens (" + perm_tokens + " Permanent Tokens)"); //display normal if both counts are under 1024
|
||||
} else { $("#result_info").html("<font color=red>" + count_tokens + " Tokens (" + perm_tokens + " Permanent Tokens)(TOO MANY)</font>"); } //warn if either are over 1024
|
||||
}
|
||||
//Auto Load Last Charcter -- (fires when active_character is defined and auto_load_chat is true)
|
||||
async function RA_autoloadchat() {
|
||||
if (document.getElementById('CharID0') !== null) {
|
||||
console.log('char list loaded! clicking activeChar')
|
||||
var CharToAutoLoad = document.getElementById('CharID' + LoadLocal('ActiveChar'));
|
||||
if (CharToAutoLoad != null) {
|
||||
CharToAutoLoad.click();
|
||||
} else {
|
||||
console.log(CharToAutoLoad + ' ActiveChar local var - not found: ' + LoadLocal('ActiveChar'));
|
||||
}
|
||||
RestoreNavTab();
|
||||
} else {
|
||||
console.log('no char list yet..')
|
||||
setTimeout(RA_autoloadchat, 100) // if the charcter list hadn't been loaded yet, try again.
|
||||
}
|
||||
}
|
||||
//only triggers when AutoLoadChat is enabled, consider adding this as an independent feature later.
|
||||
function RestoreNavTab() {
|
||||
if ($(rm_button_selected_ch).children("h2").text() !== '') { //check for a change in the character edit tab name
|
||||
console.log('detected ALC char finished loaded, proceeding to restore tab.');
|
||||
$(SelectedNavTab).click() //click to restore saved tab when name has changed (signalling char load is done)
|
||||
} else {
|
||||
setTimeout(RestoreNavTab, 100) //if not changed yet, check again after 100ms
|
||||
}
|
||||
}
|
||||
//changes input bar and send button display depending on connection status
|
||||
function RA_checkOnlineStatus() {
|
||||
if (online_status == "no_connection") {
|
||||
$("#send_textarea").attr("placeholder", "Not connected to API!"); //Input bar placeholder tells users they are not connected
|
||||
$("#send_form").css("background-color", "rgba(100,0,0,0.7)"); //entire input form area is red when not connected
|
||||
$("#send_but").css("display", "none"); //send button is hidden when not connected;
|
||||
} else {
|
||||
if (online_status !== undefined && online_status !== "no_connection") {
|
||||
$("#send_textarea").attr("placeholder", "Type a message..."); //on connect, placeholder tells user to type message
|
||||
$("#send_form").css("background-color", "rgba(0,0,0,0.7)"); //on connect, form BG changes to transprent black
|
||||
|
||||
if (!is_send_press && !(selected_group && is_group_generating)) {
|
||||
$("#send_but").css("display", "inline"); //on connect, send button shows
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Auto-connect to API (when set to kobold, API URL exists, and auto_connect is true)
|
||||
|
||||
function RA_autoconnect() {
|
||||
if (typeof online_status !== 'undefined' && (api_server !== '' || api_key_novel !== '')) {
|
||||
if (online_status === "no_connection" && LoadLocalBool('AutoConnectEnabled')) {
|
||||
if (isUrlOrAPIKey(api_server) && main_api === "kobold") {
|
||||
$("#api_url_text").val(api_server);
|
||||
$("#api_button").click();
|
||||
//} else if (isUrlOrAPIKey(api_key_novel) && main_api === "novel") {
|
||||
// $("#api_key_novel").val(api_key_novel);
|
||||
// $("#api_button").click();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setTimeout(RA_autoconnect, 100);
|
||||
}
|
||||
}
|
||||
|
||||
function isUrlOrAPIKey(string) {
|
||||
//const pattern = /^\d{3}-\d{3}-\d{3}-\d{3}$/; //need a sample novelAI key to set this format
|
||||
try {
|
||||
new URL(string);
|
||||
return true;
|
||||
} catch (_) {
|
||||
// return pattern.test(string);
|
||||
}
|
||||
}
|
||||
|
||||
$("document").ready(function () {
|
||||
|
||||
// read the state of Nav Lock and whether the nav was open or not before page load.
|
||||
$(PanelPin).prop('checked', LoadLocalBool("NavLockOn"));
|
||||
if (LoadLocalBool("NavLockOn") == true) { $(NavToggle).prop("checked", LoadLocalBool("NavOpened")); }
|
||||
// read the state of AutoConnect and AutoLoadChat.
|
||||
$(AutoConnectCheckbox).prop("checked", LoadLocalBool("AutoConnectEnabled"));
|
||||
$(AutoLoadChatCheckbox).prop("checked", LoadLocalBool("AutoLoadChatEnabled"));
|
||||
|
||||
if (LoadLocalBool('AutoLoadChatEnabled') == true) { RA_autoloadchat(); }
|
||||
//Autoconnect on page load if enabled, or when api type is changed
|
||||
if (LoadLocalBool("AutoConnectEnabled") == true) { RA_autoconnect() }
|
||||
$("#main_api").change(function () { RA_autoconnect(); });
|
||||
$("#api_button").click(function () { setTimeout(RA_checkOnlineStatus, 100); });
|
||||
|
||||
//close the RightNav panel when user clicks outside of it or related panels (adv editing popup, or dialog popups)
|
||||
$("html").click(function (e) {
|
||||
if ($(NavToggle).prop("checked") &&
|
||||
!$(PanelPin).prop("checked") &&
|
||||
$(e.target).attr("id") !== "nav-toggle" &&
|
||||
!RightNavPanel.contains(e.target) &&
|
||||
!AdvancedCharDefsPopup.contains(e.target) &&
|
||||
!ConfirmationPopup.contains(e.target)) {
|
||||
NavToggle.click();
|
||||
}
|
||||
});
|
||||
|
||||
//save NavLock prefs and record state of the Nav being open or closed
|
||||
$(NavToggle).on("change", function () { SaveLocal("NavOpened", $(NavToggle).prop("checked")); });
|
||||
$(PanelPin).on("change", function () { SaveLocal("NavLockOn", $(PanelPin).prop("checked")); });
|
||||
|
||||
//save AutoConnect and AutoLoadChat prefs
|
||||
$(AutoConnectCheckbox).on("change", function () { SaveLocal("AutoConnectEnabled", $(AutoConnectCheckbox).prop("checked")); });
|
||||
$(AutoLoadChatCheckbox).on("change", function () { SaveLocal("AutoLoadChatEnabled", $(AutoLoadChatCheckbox).prop("checked")); });
|
||||
|
||||
$("#rm_button_extensions").click(function () {
|
||||
SaveLocal('SelectedNavTab', 'rm_button_extensions');
|
||||
});
|
||||
$("#rm_button_settings").click(function () { SaveLocal('SelectedNavTab', 'rm_button_settings'); });
|
||||
$(SelectedCharacterTab).click(function () { SaveLocal('SelectedNavTab', 'rm_button_selected_ch'); });
|
||||
$("#rm_button_characters").click(function () { //if char list is clicked, in addition to saving it...
|
||||
SaveLocal('SelectedNavTab', 'rm_button_characters');
|
||||
characters.sort(Intl.Collator().compare); // we sort the list
|
||||
});
|
||||
// when a char is selected from the list, save them as the auto-load character for next page load
|
||||
$(document).on("click", ".character_select", function () { SaveLocal('ActiveChar', $(this).attr('chid')); });
|
||||
|
||||
//this makes the chat input text area resize vertically to match the text size (limited by CSS at 50% window height)
|
||||
$('#send_textarea').on('input', function () {
|
||||
this.style.height = '40px';
|
||||
this.style.height = (this.scrollHeight) + 'px';
|
||||
});
|
||||
|
||||
//Regenerate if user swipes on the last mesage in chat
|
||||
|
||||
document.addEventListener('swiped-left', function (e) {
|
||||
var SwipeButR = $('.swipe_right:last');
|
||||
var SwipeTargetMesClassParent = e.target.closest('.last_mes');
|
||||
if (SwipeTargetMesClassParent !== null) {
|
||||
if (SwipeButR.css('display') === 'flex') {
|
||||
//if (SwipeButR.attr('style') == 'display: flex;' == true) {
|
||||
SwipeButR.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
document.addEventListener('swiped-right', function (e) {
|
||||
var SwipeButL = $('.swipe_left:last');
|
||||
var SwipeTargetMesClassParent = e.target.closest('.last_mes');
|
||||
//console.log('Touch swipe check -- closest last_mes = "' + (SwipeTargetMesClassParent !== null) + ' Button display = ' + (SwipeButL.attr('style') == 'display: flex;' == true));
|
||||
if (SwipeTargetMesClassParent !== null) {
|
||||
if (SwipeButL.css('display') === 'flex') {
|
||||
//if (SwipeButL.attr('style') == 'display: flex;' == true) {
|
||||
SwipeButL.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function isInputElementInFocus() {
|
||||
return $(document.activeElement).is(":input");
|
||||
}
|
||||
|
||||
//Additional hotkeys CTRL+ENTER and CTRL+UPARROW
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.ctrlKey && event.key == "Enter") {
|
||||
// Ctrl+Enter for Regeneration Last Response
|
||||
if (is_send_press == false) {
|
||||
|
||||
Generate("regenerate");
|
||||
}
|
||||
}
|
||||
if (event.ctrlKey && event.key == "ArrowUp") {
|
||||
//Ctrl+UpArrow for Connect to last server
|
||||
if (online_status === "no_connection") {
|
||||
document.getElementById("api_button").click();
|
||||
}
|
||||
}
|
||||
if (event.ctrlKey && event.key == "ArrowLeft") { //for debug, show all local stored vars
|
||||
CheckLocal();
|
||||
}
|
||||
if (event.ctrlKey && event.key == "ArrowRight") { //for debug, empty local storage state
|
||||
ClearLocal();
|
||||
}
|
||||
if (event.key == "ArrowLeft") { //swipes left
|
||||
/* console.log('SWIPE FILTER -- ' +
|
||||
$("#send_textarea").val() + ' ' +
|
||||
$("#character_popup").css("display") + ' ' +
|
||||
$("#shadow_select_chat_popup").css("display") + ' ' +
|
||||
isInputElementInFocus()); */
|
||||
if (
|
||||
|
||||
$(".swipe_left:last").css("display") === "flex" &&
|
||||
$("#send_textarea").val() === '' &&
|
||||
$("#character_popup").css("display") === "none" &&
|
||||
$("#shadow_select_chat_popup").css("display") === "none" &&
|
||||
!isInputElementInFocus()
|
||||
) {
|
||||
$('.swipe_left:last').click();
|
||||
}
|
||||
}
|
||||
if (event.key == "ArrowRight") { //swipes right
|
||||
/* console.log('SWIPE FILTER -- ' +
|
||||
$("#send_textarea").val() + ' ' +
|
||||
$("#character_popup").css("display") + ' ' +
|
||||
$("#shadow_select_chat_popup").css("display") + ' ' +
|
||||
isInputElementInFocus()); */
|
||||
if (
|
||||
|
||||
$(".swipe_right:last").css("display") === "flex" &&
|
||||
$("#send_textarea").val() === '' &&
|
||||
$("#character_popup").css("display") === "none" &&
|
||||
$("#shadow_select_chat_popup").css("display") === "none" &&
|
||||
!isInputElementInFocus()
|
||||
) {
|
||||
$('.swipe_right:last').click();
|
||||
}
|
||||
};
|
||||
})
|
||||
});
|
||||
@@ -1,217 +1,241 @@
|
||||
import { callPopup } from "../script.js";
|
||||
import { isSubsetOf } from "./utils.js";
|
||||
export {
|
||||
getContext,
|
||||
getApiUrl,
|
||||
defaultRequestArgs,
|
||||
};
|
||||
|
||||
const extensionNames = ['caption', 'dice', 'expressions', 'floating-prompt', 'memory'];
|
||||
const manifests = await getManifests(extensionNames);
|
||||
const extensions_urlKey = 'extensions_url';
|
||||
const extensions_autoConnectKey = 'extensions_autoconnect';
|
||||
let extensions = [];
|
||||
const extensions_disabledKey = 'extensions_disabled';
|
||||
|
||||
(function () {
|
||||
const settings_html = `
|
||||
<div class="extensions_block">
|
||||
<hr>
|
||||
<h3>Extensions: <a target="_blank" href="https://github.com/SillyLossy/TavernAI-extras">TavernAI-extras</a></h3>
|
||||
<input id="extensions_url" type="text" class="text_pole" />
|
||||
<div class="extensions_url_block">
|
||||
<input id="extensions_connect" class="menu_button" type="submit" value="Connect" />
|
||||
<span class="expander"></span>
|
||||
<label for="extensions_autoconnect"><input id="extensions_autoconnect" type="checkbox"/>Auto-connect</label>
|
||||
</div>
|
||||
<div id="extensions_status">Not connected</div>
|
||||
<div id="extensions_loaded">
|
||||
<h4>Active extensions</h4>
|
||||
<ul id="extensions_list">
|
||||
</ul>
|
||||
</div>
|
||||
<div id="extensions_settings">
|
||||
<h3>Extension settings</h3>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
let modules = [];
|
||||
let disabledExtensions = getDisabledExtensions();
|
||||
let activeExtensions = new Set();
|
||||
|
||||
const settings_style = `
|
||||
<style>
|
||||
#extensions_url {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#extensions_loaded {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#extensions_status {
|
||||
margin-bottom: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.extensions_block input[type="submit"]:hover{
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.extensions_block input[type="checkbox"] {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
label[for="extensions_autoconnect"] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 !important;
|
||||
}
|
||||
const getContext = () => window['TavernAI'].getContext();
|
||||
const getApiUrl = () => localStorage.getItem('extensions_url');
|
||||
const defaultUrl = "http://localhost:5100";
|
||||
const defaultRequestArgs = { method: 'GET', headers: { 'Bypass-Tunnel-Reminder': 'bypass' } };
|
||||
let connectedToApi = false;
|
||||
|
||||
.extensions_url_block {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.extensions_url_block h4 {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.extensions_block {
|
||||
clear: both;
|
||||
padding: 0.05px; /* clear fix */
|
||||
}
|
||||
|
||||
.success {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.failure {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.expander {
|
||||
flex-grow: 1;
|
||||
}
|
||||
</style>
|
||||
`;
|
||||
function getDisabledExtensions() {
|
||||
const value = localStorage.getItem(extensions_disabledKey);
|
||||
return value ? JSON.parse(value) : [];
|
||||
}
|
||||
|
||||
const defaultUrl = "http://localhost:5100";
|
||||
let connectedToApi = false;
|
||||
function onDisableExtensionClick() {
|
||||
const name = $(this).data('name');
|
||||
disableExtension(name);
|
||||
}
|
||||
|
||||
async function connectClickHandler() {
|
||||
const baseUrl = $("#extensions_url").val();
|
||||
localStorage.setItem(extensions_urlKey, baseUrl);
|
||||
await connectToApi(baseUrl);
|
||||
}
|
||||
function onEnableExtensionClick() {
|
||||
const name = $(this).data('name');
|
||||
enableExtension(name);
|
||||
}
|
||||
|
||||
function autoConnectInputHandler() {
|
||||
const value = $(this).prop('checked');
|
||||
localStorage.setItem(extensions_autoConnectKey, value.toString());
|
||||
function enableExtension(name) {
|
||||
disabledExtensions = disabledExtensions.filter(x => x !== name);
|
||||
localStorage.setItem(extensions_disabledKey, JSON.stringify(disabledExtensions));
|
||||
location.reload();
|
||||
}
|
||||
|
||||
if (value && !connectedToApi) {
|
||||
$("#extensions_connect").trigger('click');
|
||||
function disableExtension(name) {
|
||||
disabledExtensions.push(name);
|
||||
localStorage.setItem(extensions_disabledKey, JSON.stringify(disabledExtensions));
|
||||
location.reload();
|
||||
}
|
||||
|
||||
async function getManifests(names) {
|
||||
const obj = {};
|
||||
for (const name of names) {
|
||||
const response = await fetch(`/scripts/extensions/${name}/manifest.json`);
|
||||
|
||||
if (response.ok) {
|
||||
const json = await response.json();
|
||||
obj[name] = json;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
async function connectToApi(baseUrl) {
|
||||
const url = new URL(baseUrl);
|
||||
url.pathname = '/api/extensions';
|
||||
async function activateExtensions() {
|
||||
const extensions = Object.entries(manifests).sort((a, b) => a[1].loading_order - b[1].loading_order);
|
||||
|
||||
try {
|
||||
const getExtensionsResult = await fetch(url, { method: 'GET', headers: { 'Bypass-Tunnel-Reminder': 'bypass' } });
|
||||
for (let entry of extensions) {
|
||||
const name = entry[0];
|
||||
const manifest = entry[1];
|
||||
|
||||
if (getExtensionsResult.ok) {
|
||||
const data = await getExtensionsResult.json();
|
||||
extensions = data.extensions;
|
||||
applyExtensions(baseUrl);
|
||||
if (activeExtensions.has(name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// all required modules are active (offline extensions require none)
|
||||
if (isSubsetOf(modules, manifest.requires)) {
|
||||
try {
|
||||
const isDisabled = disabledExtensions.includes(name);
|
||||
const li = document.createElement('li');
|
||||
|
||||
if (!isDisabled) {
|
||||
await addExtensionScript(name, manifest);
|
||||
await addExtensionStyle(name, manifest);
|
||||
activeExtensions.add(name);
|
||||
}
|
||||
else {
|
||||
li.classList.add('disabled');
|
||||
}
|
||||
|
||||
li.id = name;
|
||||
li.innerText = manifest.display_name;
|
||||
|
||||
$('#extensions_list').append(li);
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`Could not activate extension: ${name}`);
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
updateStatus(getExtensionsResult.ok);
|
||||
}
|
||||
catch {
|
||||
updateStatus(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateStatus(success) {
|
||||
connectedToApi = success;
|
||||
const _text = success ? 'Connected to API' : 'Could not connect to API';
|
||||
const _class = success ? 'success' : 'failure';
|
||||
$('#extensions_status').text(_text);
|
||||
$('#extensions_status').attr('class', _class);
|
||||
async function connectClickHandler() {
|
||||
const baseUrl = $("#extensions_url").val();
|
||||
localStorage.setItem(extensions_urlKey, baseUrl);
|
||||
await connectToApi(baseUrl);
|
||||
}
|
||||
|
||||
if (success && extensions.length) {
|
||||
$('#extensions_loaded').show(200);
|
||||
$('#extensions_settings').show(200);
|
||||
$('#extensions_list').empty();
|
||||
function autoConnectInputHandler() {
|
||||
const value = $(this).prop('checked');
|
||||
localStorage.setItem(extensions_autoConnectKey, value.toString());
|
||||
|
||||
for (let extension of extensions) {
|
||||
$('#extensions_list').append(`<li id="${extension.name}">${extension.metadata.display_name}</li>`);
|
||||
if (value && !connectedToApi) {
|
||||
$("#extensions_connect").trigger('click');
|
||||
}
|
||||
}
|
||||
|
||||
async function connectToApi(baseUrl) {
|
||||
const url = new URL(baseUrl);
|
||||
url.pathname = '/api/modules';
|
||||
|
||||
try {
|
||||
const getExtensionsResult = await fetch(url, defaultRequestArgs);
|
||||
|
||||
if (getExtensionsResult.ok) {
|
||||
const data = await getExtensionsResult.json();
|
||||
modules = data.modules;
|
||||
activateExtensions();
|
||||
}
|
||||
|
||||
updateStatus(getExtensionsResult.ok);
|
||||
}
|
||||
catch {
|
||||
updateStatus(false);
|
||||
}
|
||||
}
|
||||
|
||||
function updateStatus(success) {
|
||||
connectedToApi = success;
|
||||
const _text = success ? 'Connected to API' : 'Could not connect to API';
|
||||
const _class = success ? 'success' : 'failure';
|
||||
$('#extensions_status').text(_text);
|
||||
$('#extensions_status').attr('class', _class);
|
||||
}
|
||||
|
||||
function addExtensionStyle(name, manifest) {
|
||||
if (manifest.css) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const url = `/scripts/extensions/${name}/${manifest.css}`;
|
||||
|
||||
if ($(`link[id="${name}"]`).length === 0) {
|
||||
const link = document.createElement('link');
|
||||
link.id = name;
|
||||
link.rel = "stylesheet";
|
||||
link.type = "text/css";
|
||||
link.href = url;
|
||||
link.onload = function () {
|
||||
resolve();
|
||||
}
|
||||
link.onerror = function (e) {
|
||||
reject(e);
|
||||
}
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
function addExtensionScript(name, manifest) {
|
||||
if (manifest.js) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const url = `/scripts/extensions/${name}/${manifest.js}`;
|
||||
let ready = false;
|
||||
|
||||
if ($(`script[id="${name}"]`).length === 0) {
|
||||
const script = document.createElement('script');
|
||||
script.id = name;
|
||||
script.type = 'module';
|
||||
script.src = url;
|
||||
script.async = true;
|
||||
script.onerror = function (err) {
|
||||
reject(err, script);
|
||||
};
|
||||
script.onload = script.onreadystatechange = function () {
|
||||
// console.log(this.readyState); // uncomment this line to see which ready states are called.
|
||||
if (!ready && (!this.readyState || this.readyState == 'complete')) {
|
||||
ready = true;
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
function showExtensionsDetails() {
|
||||
let html = '<h3>Modules provided by your Extensions API:</h3>';
|
||||
html += modules.length ? DOMPurify.sanitize(modules.join(', ')) : '<p class="failure">Not connected to the API!</p>';
|
||||
html += '<h3>Available extensions:</h3>';
|
||||
|
||||
Object.entries(manifests).sort((a, b) => a[1].loading_order - b[1].loading_order).forEach(extension => {
|
||||
const name = extension[0];
|
||||
const manifest = extension[1];
|
||||
html += `<h4>${DOMPurify.sanitize(manifest.display_name)}</h4>`;
|
||||
if (activeExtensions.has(name)) {
|
||||
html += `<p class="success">Extension is active. <a href="javascript:void" data-name="${name}" class="disable_extension">Disable</a></p>`;
|
||||
}
|
||||
else if (disabledExtensions.includes(name)) {
|
||||
html += `<p class="disabled">Extension is disabled. <a href="javascript:void" data-name=${name} class="enable_extension">Enable</a></p>`;
|
||||
}
|
||||
else {
|
||||
$('#extensions_loaded').hide(200);
|
||||
$('#extensions_settings').hide(200);
|
||||
$('#extensions_list').empty();
|
||||
const requirements = new Set(manifest.requires);
|
||||
modules.forEach(x => requirements.delete(x));
|
||||
const requirementsString = DOMPurify.sanitize([...requirements].join(', '));
|
||||
html += `<p>Missing modules: <span class="failure">${requirementsString}</span></p>`
|
||||
}
|
||||
}
|
||||
|
||||
function applyExtensions(baseUrl) {
|
||||
const url = new URL(baseUrl);
|
||||
|
||||
if (!Array.isArray(extensions) || extensions.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let extension of extensions) {
|
||||
addExtensionStyle(extension);
|
||||
addExtensionScript(extension);
|
||||
}
|
||||
|
||||
async function addExtensionStyle(extension) {
|
||||
if (extension.metadata.css) {
|
||||
try {
|
||||
url.pathname = `/api/style/${extension.name}`;
|
||||
const link = url.toString();
|
||||
|
||||
const result = await fetch(link, { method: 'GET', headers: { 'Bypass-Tunnel-Reminder': 'bypass' } });
|
||||
const text = await result.text();
|
||||
|
||||
if ($(`style[id="${link}"]`).length === 0) {
|
||||
const style = document.createElement('style');
|
||||
style.id = link;
|
||||
style.innerHTML = text;
|
||||
$('head').append(style);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function addExtensionScript(extension) {
|
||||
if (extension.metadata.js) {
|
||||
try {
|
||||
url.pathname = `/api/script/${extension.name}`;
|
||||
const link = url.toString();
|
||||
|
||||
const result = await fetch(link, { method: 'GET', headers: { 'Bypass-Tunnel-Reminder': 'bypass' } });
|
||||
const text = await result.text();
|
||||
|
||||
if ($(`script[id="${link}"]`).length === 0) {
|
||||
const script = document.createElement('script');
|
||||
script.id = link;
|
||||
script.type = 'module';
|
||||
script.innerHTML = text;
|
||||
$('body').append(script);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(async function () {
|
||||
const url = localStorage.getItem(extensions_urlKey) ?? defaultUrl;
|
||||
const autoConnect = localStorage.getItem(extensions_autoConnectKey) == 'true';
|
||||
$('#rm_api_block').append(settings_html);
|
||||
$('head').append(settings_style);
|
||||
$("#extensions_url").val(url);
|
||||
$("#extensions_connect").on('click', connectClickHandler);
|
||||
$("#extensions_autoconnect").on('input', autoConnectInputHandler);
|
||||
$("#extensions_autoconnect").prop('checked', autoConnect).trigger('input');
|
||||
});
|
||||
})();
|
||||
|
||||
callPopup(`<div class="extensions_info">${html}</div>`, 'text');
|
||||
}
|
||||
|
||||
$(document).ready(async function () {
|
||||
const url = localStorage.getItem(extensions_urlKey) ?? defaultUrl;
|
||||
const autoConnect = localStorage.getItem(extensions_autoConnectKey) == 'true';
|
||||
$("#extensions_url").val(url);
|
||||
$("#extensions_connect").on('click', connectClickHandler);
|
||||
$("#extensions_autoconnect").on('input', autoConnectInputHandler);
|
||||
$("#extensions_autoconnect").prop('checked', autoConnect).trigger('input');
|
||||
$("#extensions_details").on('click', showExtensionsDetails);
|
||||
$(document).on('click', '.disable_extension', onDisableExtensionClick);
|
||||
$(document).on('click', '.enable_extension', onEnableExtensionClick);
|
||||
|
||||
// Activate offline extensions
|
||||
activateExtensions();
|
||||
});
|
||||
@@ -0,0 +1,122 @@
|
||||
import { getBase64Async } from "../../utils.js";
|
||||
import { getContext, getApiUrl } from "../../extensions.js";
|
||||
export { MODULE_NAME };
|
||||
|
||||
const MODULE_NAME = 'caption';
|
||||
const UPDATE_INTERVAL = 1000;
|
||||
|
||||
async function moduleWorker() {
|
||||
const context = getContext();
|
||||
|
||||
context.onlineStatus === 'no_connection'
|
||||
? $('#send_picture').hide(200)
|
||||
: $('#send_picture').show(200);
|
||||
}
|
||||
|
||||
async function setImageIcon() {
|
||||
try {
|
||||
const sendButton = document.getElementById('send_picture');
|
||||
sendButton.style.backgroundImage = `url('/img/image-solid.svg')`;
|
||||
sendButton.classList.remove('spin');
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function setSpinnerIcon() {
|
||||
try {
|
||||
const sendButton = document.getElementById('send_picture');
|
||||
sendButton.style.backgroundImage = `url('/img/spinner-solid.svg')`;
|
||||
sendButton.classList.add('spin');
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function sendCaptionedMessage(caption, image) {
|
||||
const context = getContext();
|
||||
const messageText = `[${context.name1} sends ${context.name2 ?? ''} a picture that contains: ${caption}]`;
|
||||
const message = {
|
||||
name: context.name1,
|
||||
is_user: true,
|
||||
is_name: true,
|
||||
send_date: Date.now(),
|
||||
mes: messageText,
|
||||
extra: { image: image },
|
||||
};
|
||||
context.chat.push(message);
|
||||
context.addOneMessage(message);
|
||||
await context.generate();
|
||||
}
|
||||
|
||||
async function onSelectImage(e) {
|
||||
setSpinnerIcon();
|
||||
const file = e.target.files[0];
|
||||
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const base64Img = await getBase64Async(file);
|
||||
const url = new URL(getApiUrl());
|
||||
url.pathname = '/api/caption';
|
||||
|
||||
const apiResult = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Bypass-Tunnel-Reminder': 'bypass',
|
||||
},
|
||||
body: JSON.stringify({ image: base64Img.split(',')[1] })
|
||||
});
|
||||
|
||||
if (apiResult.ok) {
|
||||
const data = await apiResult.json();
|
||||
const caption = data.caption;
|
||||
await sendCaptionedMessage(caption, base64Img);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
finally {
|
||||
e.target.form.reset();
|
||||
setImageIcon();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
function patchSendForm() {
|
||||
const columns = $('#send_form').css('grid-template-columns').split(' ');
|
||||
columns[columns.length - 1] = `${parseInt(columns[columns.length - 1]) + 40}px`;
|
||||
columns[1] = 'auto';
|
||||
$('#send_form').css('grid-template-columns', columns.join(' '));
|
||||
}
|
||||
function addSendPictureButton() {
|
||||
const sendButton = document.createElement('input');
|
||||
sendButton.type = 'button';
|
||||
sendButton.id = 'send_picture';
|
||||
$(sendButton).hide();
|
||||
$(sendButton).on('click', () => $('#img_file').click());
|
||||
$('#send_but_sheld').prepend(sendButton);
|
||||
}
|
||||
function addPictureSendForm() {
|
||||
const inputHtml = `<input id="img_file" type="file" accept="image/*">`;
|
||||
const imgForm = document.createElement('form');
|
||||
imgForm.id = 'img_form';
|
||||
$(imgForm).append(inputHtml);
|
||||
$(imgForm).hide();
|
||||
$('#form_sheld').append(imgForm);
|
||||
$('#img_file').on('change', onSelectImage);
|
||||
}
|
||||
|
||||
addPictureSendForm();
|
||||
addSendPictureButton();
|
||||
setImageIcon();
|
||||
patchSendForm();
|
||||
moduleWorker();
|
||||
setInterval(moduleWorker, UPDATE_INTERVAL);
|
||||
});
|
||||