sillytavern 1.10.3 → 1.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/.github/ISSUE_TEMPLATE/bug-report.yml +90 -0
  2. package/.github/ISSUE_TEMPLATE/feature-request.yml +91 -0
  3. package/.github/readme.md +1 -0
  4. package/.github/workflows/docker-publish.yml +45 -0
  5. package/Dockerfile +1 -1
  6. package/colab/GPU.ipynb +9 -0
  7. package/config.conf +52 -0
  8. package/default/config.conf +18 -1
  9. package/default/settings.json +0 -4
  10. package/docker/docker-compose.yml +1 -0
  11. package/package.json +7 -5
  12. package/post-install.js +81 -0
  13. package/public/KoboldAI Settings/Miro Bronze.settings +25 -0
  14. package/public/KoboldAI Settings/Miro Gold.settings +25 -0
  15. package/public/KoboldAI Settings/Miro Silver.settings +25 -0
  16. package/public/TextGen Settings/Miro Bronze.settings +24 -0
  17. package/public/TextGen Settings/Miro Gold.settings +24 -0
  18. package/public/TextGen Settings/Miro Silver.settings +24 -0
  19. package/public/context/OldDefault.json +6 -0
  20. package/public/context/Pygmalion.json +3 -3
  21. package/public/css/bg_load.css +1 -0
  22. package/public/css/extensions-panel.css +115 -1
  23. package/public/css/mobile-styles.css +15 -14
  24. package/public/css/promptmanager.css +4 -4
  25. package/public/css/rm-groups.css +4 -2
  26. package/public/css/select2-overrides.css +29 -12
  27. package/public/css/st-tailwind.css +4 -0
  28. package/public/css/tags.css +9 -1
  29. package/public/css/toggle-dependent.css +13 -19
  30. package/public/i18n.json +39 -27
  31. package/public/index.html +371 -329
  32. package/public/instruct/Pygmalion.json +17 -0
  33. package/public/lib/select2-search-placeholder.js +25 -0
  34. package/public/script.js +397 -331
  35. package/public/scripts/PromptManager.js +4 -2
  36. package/public/scripts/RossAscends-mods.js +59 -33
  37. package/public/scripts/bookmarks.js +33 -1
  38. package/public/scripts/extensions/assets/index.js +3 -3
  39. package/public/scripts/extensions/audio/index.js +371 -47
  40. package/public/scripts/extensions/audio/style.css +77 -4
  41. package/public/scripts/extensions/audio/window.html +65 -11
  42. package/public/scripts/extensions/backgrounds/style.css +1 -1
  43. package/public/scripts/extensions/caption/index.js +70 -22
  44. package/public/scripts/extensions/caption/manifest.json +2 -2
  45. package/public/scripts/extensions/caption/style.css +3 -3
  46. package/public/scripts/extensions/expressions/add-custom-expression.html +14 -0
  47. package/public/scripts/extensions/expressions/index.js +349 -122
  48. package/public/scripts/extensions/expressions/list-item.html +6 -1
  49. package/public/scripts/extensions/expressions/remove-custom-expression.html +7 -0
  50. package/public/scripts/extensions/expressions/settings.html +46 -24
  51. package/public/scripts/extensions/expressions/style.css +15 -1
  52. package/public/scripts/extensions/gallery/index.js +26 -3
  53. package/public/scripts/extensions/hypebot/index.js +7 -5
  54. package/public/scripts/extensions/idle/dropdown.html +54 -0
  55. package/public/scripts/extensions/idle/index.js +329 -0
  56. package/public/scripts/extensions/idle/manifest.json +12 -0
  57. package/public/scripts/extensions/idle/style.css +3 -0
  58. package/public/scripts/extensions/infinity-context/index.js +1 -6
  59. package/public/scripts/extensions/memory/index.js +16 -2
  60. package/public/scripts/extensions/quick-reply/index.js +56 -4
  61. package/public/scripts/extensions/quick-reply/style.css +3 -3
  62. package/public/scripts/extensions/randomize/index.js +1 -1
  63. package/public/scripts/extensions/regex/style.css +2 -2
  64. package/public/scripts/extensions/settingsearch/index.js +57 -0
  65. package/public/scripts/extensions/settingsearch/manifest.json +11 -0
  66. package/public/scripts/extensions/settingsearch/style.css +5 -0
  67. package/public/scripts/extensions/speech-recognition/index.js +0 -1
  68. package/public/scripts/extensions/stable-diffusion/index.js +3 -4
  69. package/public/scripts/extensions/translate/index.js +85 -8
  70. package/public/scripts/extensions/tts/index.js +1 -6
  71. package/public/scripts/extensions/tts/novel.js +1 -1
  72. package/public/scripts/extensions/vectors/index.js +439 -0
  73. package/public/scripts/extensions/vectors/manifest.json +12 -0
  74. package/public/scripts/extensions/vectors/settings.html +76 -0
  75. package/public/scripts/extensions.js +11 -7
  76. package/public/scripts/group-chats.js +14 -28
  77. package/public/scripts/horde.js +40 -9
  78. package/public/scripts/kai-settings.js +31 -2
  79. package/public/scripts/mancer-settings.js +79 -0
  80. package/public/scripts/nai-settings.js +4 -3
  81. package/public/scripts/openai.js +101 -13
  82. package/public/scripts/power-user.js +206 -71
  83. package/public/scripts/preset-manager.js +2 -2
  84. package/public/scripts/secrets.js +2 -2
  85. package/public/scripts/server-history.js +86 -0
  86. package/public/scripts/slash-commands.js +44 -6
  87. package/public/scripts/stats.js +44 -4
  88. package/public/scripts/tags.js +34 -3
  89. package/public/scripts/templates/itemizationChat.html +1 -0
  90. package/public/scripts/templates/itemizationText.html +1 -0
  91. package/public/scripts/tokenizers.js +14 -14
  92. package/public/scripts/utils.js +32 -3
  93. package/public/scripts/world-info.js +14 -4
  94. package/public/settings.json +604 -0
  95. package/public/style.css +81 -67
  96. package/server.js +202 -2567
  97. package/src/assets.js +250 -0
  98. package/src/caption.js +35 -0
  99. package/src/chat-completion.js +54 -0
  100. package/src/classify.js +53 -0
  101. package/src/constants.js +111 -0
  102. package/src/content-manager.js +132 -78
  103. package/src/embedding.js +17 -0
  104. package/src/extensions.js +250 -0
  105. package/src/horde.js +174 -0
  106. package/src/middleware/basicAuthMiddleware.js +2 -6
  107. package/src/novelai.js +303 -10
  108. package/src/openai-vectors.js +48 -0
  109. package/src/presets.js +111 -0
  110. package/src/secrets.js +199 -0
  111. package/src/sprites.js +269 -0
  112. package/src/stable-diffusion.js +250 -0
  113. package/src/thumbnails.js +202 -0
  114. package/src/tokenizers.js +336 -0
  115. package/src/transformers.mjs +75 -0
  116. package/src/translate.js +248 -0
  117. package/src/util.js +208 -0
  118. package/src/vectors.js +221 -0
  119. package/statsHelpers.js +7 -1
  120. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -45
  121. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
  122. /package/src/{horde → ai_horde}/LICENSE.md +0 -0
  123. /package/src/{horde → ai_horde}/index.d.ts +0 -0
  124. /package/src/{horde → ai_horde}/index.js +0 -0
  125. /package/src/{horde → ai_horde}/index.mjs +0 -0
@@ -0,0 +1,90 @@
1
+ name: Bug Report 🐛
2
+ description: Report something that's not working the way it's (probably) intended to. PAY ATTENTION, Support requests for external programs (reverse proxies, 3rd party servers, other peoples' forks) will be refused!"
3
+ title: '[BUG] <title>'
4
+ labels: ['bug']
5
+ body:
6
+ - type: dropdown
7
+ id: environment
8
+ attributes:
9
+ label: Environment
10
+ description: Where are you running SillyTavern?
11
+ options:
12
+ - Self-Hosted (Bare Metal)
13
+ - Self-Hosted (Docker)
14
+ - Android (Termux)
15
+ - Cloud Service (Static)
16
+ - Other (Specify below)
17
+ validations:
18
+ required: true
19
+
20
+ - type: input
21
+ id: system
22
+ attributes:
23
+ label: System
24
+ description: >-
25
+ For deployment issues, specify your [distro or OS](https://whatsmyos.com/) and/ or Docker version.
26
+ For client-side issues, include your [browser version](https://www.whatsmybrowser.org/)
27
+ placeholder: e.g. Firefox 101, Manjaro Linux 21.3.0, Docker 20.10.16
28
+ validations:
29
+ required: true
30
+
31
+ - type: input
32
+ id: version
33
+ attributes:
34
+ label: Version
35
+ description: What version of SillyTavern are you running?
36
+ placeholder: (check User Settings to see the version)
37
+ validations:
38
+ required: true
39
+
40
+ - type: textarea
41
+ id: desktop
42
+ attributes:
43
+ label: Desktop Information
44
+ description: Please provide details about your desktop environment.
45
+ placeholder: |
46
+ - Node.js version (if applicable): [run `node --version` in cmd]
47
+ - Generation API [e.g. KoboldAI, OpenAI]
48
+ - Branch [staging, release]
49
+ - Model [e.g. Pygmalion 6b, LLaMa 13b]
50
+ validations:
51
+ required: false
52
+
53
+ - type: textarea
54
+ id: repro
55
+ attributes:
56
+ label: Describe the problem
57
+ description: Please describe exactly what is not working, include the steps to reproduce, actual result and expected result
58
+ placeholder: When doing ABC then DEF, I expect to see XYZ, but I actually see ZYX
59
+ validations:
60
+ required: true
61
+
62
+ - type: textarea
63
+ id: logs
64
+ attributes:
65
+ label: Additional info
66
+ description: Logs? Screenshots? Yes, please.
67
+ placeholder: If the issue happens during build-time, include terminal logs. For run-time errors, include browser logs which you can view in the Dev Tools (F12), under the Console tab. Take care to blank out any personal info.
68
+ validations:
69
+ required: false
70
+
71
+ - type: checkboxes
72
+ id: idiot-check
73
+ attributes:
74
+ label: Please tick the boxes
75
+ description: Before submitting, please ensure that
76
+ options:
77
+ - label: You have explained the issue clearly, and included all relevant info
78
+ required: true
79
+ - label: You've checked that this [issue hasn't already been raised](https://github.com/SillyTavern/SillyTavern/issues?q=is%3Aissue)
80
+ required: true
81
+ - label: You've checked the [docs](https://docs.sillytavern.app/) ![important](https://img.shields.io/badge/Important!-F6094E)
82
+ required: true
83
+
84
+ - type: markdown
85
+ attributes:
86
+ value: |-
87
+ ## Thanks 🙏
88
+ Thank you for raising this ticket - in doing so you are helping to make SillyTavern better for everyone.
89
+ validations:
90
+ required: false
@@ -0,0 +1,91 @@
1
+ name: Feature Request ✨
2
+ description: Suggest an idea for future development of this project
3
+ title: '[FEATURE_REQUEST] <title>'
4
+ labels: ['enhancement']
5
+
6
+ body:
7
+
8
+ # Field 1 - Did the user searched for similar requests
9
+ - type: dropdown
10
+ id: similarRequest
11
+ attributes:
12
+ label: Have you searched for similar [requests](https://github.com/SillyTavern/SillyTavern/issues?q=)?
13
+ description:
14
+ options:
15
+ - 'No'
16
+ - 'Yes'
17
+ validations:
18
+ required: false
19
+
20
+ # Field 2 - Is it bug-related
21
+ - type: textarea
22
+ id: issue
23
+ attributes:
24
+ label: Is your feature request related to a problem? If so, please describe.
25
+ description:
26
+ placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
27
+ validations:
28
+ required: false
29
+
30
+ # Field 3 - Describe feature
31
+ - type: textarea
32
+ id: solution
33
+ attributes:
34
+ label: Describe the solution you'd like
35
+ placeholder: An outline of how you would like this to be implemented, include as much details as possible
36
+ validations:
37
+ required: true
38
+
39
+ # Field 4 - Describe alternatives
40
+ - type: textarea
41
+ id: alternatives
42
+ attributes:
43
+ label: Describe alternatives you've considered
44
+ placeholder: A clear and concise description of any alternative solutions or features you've considered.
45
+ validations:
46
+ required: false
47
+
48
+ # Field 5 - Additional context
49
+ - type: textarea
50
+ id: addcontext
51
+ attributes:
52
+ label: Additional context
53
+ placeholder: Add any other context or screenshots about the feature request here.
54
+ validations:
55
+ required: false
56
+
57
+ # Field 6 - Priority
58
+ - type: dropdown
59
+ id: priority
60
+ attributes:
61
+ label: Priority
62
+ description: How urgent is the development of this feature
63
+ options:
64
+ - Low (Nice-to-have)
65
+ - Medium (Would be very useful)
66
+ - High (The app does not function without it)
67
+ validations:
68
+ required: true
69
+
70
+ # Field 7 - Can the user implement
71
+ - type: dropdown
72
+ id: canImplement
73
+ attributes:
74
+ label: Is this something you would be keen to implement?
75
+ description: Are you raising this ticket in order to get an issue number for your PR?
76
+ options:
77
+ - 'No'
78
+ - 'Maybe'
79
+ - 'Yes!'
80
+ validations:
81
+ required: false
82
+
83
+ # Final text
84
+ - type: markdown
85
+ attributes:
86
+ value: |-
87
+ ## Thanks 🙏
88
+ Thank you for your feature suggestion.
89
+ Please note that there is no guarantee that your idea will be implemented.
90
+ validations:
91
+ required: false
package/.github/readme.md CHANGED
@@ -292,6 +292,7 @@ GNU Affero General Public License for more details.**
292
292
  * RossAscends' additions: AGPL v3
293
293
  * Portions of CncAnon's TavernAITurbo mod: Unknown license
294
294
  * kingbri's various commits and suggestions (<https://github.com/bdashore3>)
295
+ * city_unit's extensions and various QoL features (<https://github.com/city-unit>)
295
296
  * StefanDanielSchwarz's various commits and bug reports (<https://github.com/StefanDanielSchwarz>)
296
297
  * Waifu mode inspired by the work of PepperTaco (<https://github.com/peppertaco/Tavern/>)
297
298
  * Thanks Pygmalion University for being awesome testers and suggesting cool features!
@@ -0,0 +1,45 @@
1
+ # This workflow will publish a docker image for every full release to the GitHub package repository
2
+
3
+ name: Create Docker Image on Release
4
+
5
+ on:
6
+ release:
7
+ # Only runs on full releases not pre releases
8
+ types: [released]
9
+
10
+ env:
11
+ # This should allow creation of docker images even in forked repositories
12
+ # Image name may not contain uppercase characters, so we can not use the repository name
13
+ # Creates a string like: ghcr.io/SillyTavern/sillytavern
14
+ image_name: ghcr.io/${{ github.repository_owner }}/sillytavern
15
+
16
+ jobs:
17
+
18
+ build:
19
+
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v3
25
+
26
+ # Build docker image using dockerfile and tag it with branch name
27
+ # Assumes branch name is the version number
28
+ - name: Build the Docker image
29
+ run: |
30
+ docker build . --file Dockerfile --tag $image_name:${{ github.ref_name }}
31
+
32
+ # Login into package repository as the person who created the release
33
+ - name: Login to GitHub Container Registry
34
+ uses: docker/login-action@v1
35
+ with:
36
+ registry: ghcr.io
37
+ username: ${{ github.actor }}
38
+ password: ${{ secrets.GITHUB_TOKEN }}
39
+
40
+ # Assumes release is the latest and marks image as such
41
+ - name: Docker Tag and Push
42
+ run: |
43
+ docker tag $image_name:${{ github.ref_name }} $image_name:latest
44
+ docker push $image_name:${{ github.ref_name }}
45
+ docker push $image_name:latest
package/Dockerfile CHANGED
@@ -13,7 +13,7 @@ ENTRYPOINT [ "tini", "--" ]
13
13
  WORKDIR ${APP_HOME}
14
14
 
15
15
  # Install app dependencies
16
- COPY package*.json ./
16
+ COPY package*.json post-install.js ./
17
17
  RUN \
18
18
  echo "*** Install npm packages ***" && \
19
19
  npm install && npm cache clean --force
package/colab/GPU.ipynb CHANGED
@@ -73,6 +73,7 @@
73
73
  "#@markdown Enables ChromaDB for Infinity Context plugin\n",
74
74
  "\n",
75
75
  "import subprocess\n",
76
+ "import secrets\n",
76
77
  "\n",
77
78
  "# ---\n",
78
79
  "# SillyTavern extras\n",
@@ -116,6 +117,7 @@
116
117
  "!npm install -g localtunnel\n",
117
118
  "!pip install -r requirements-complete.txt\n",
118
119
  "!pip install tensorflow==2.12\n",
120
+ "!pip install colorama\n",
119
121
  "!pip install Flask-Cors\n",
120
122
  "!pip install Flask-Compress\n",
121
123
  "!pip install transformers\n",
@@ -130,6 +132,13 @@
130
132
  "!wget https://github.com/cloudflare/cloudflared/releases/download/2023.5.0/cloudflared-linux-amd64 -O /tmp/cloudflared-linux-amd64\n",
131
133
  "!chmod +x /tmp/cloudflared-linux-amd64\n",
132
134
  "\n",
135
+ "# Generate a random API key\n",
136
+ "api_key = secrets.token_hex(5)\n",
137
+ "\n",
138
+ "# Write the API key to api_key.txt\n",
139
+ "with open('./api_key.txt', 'w') as f:\n",
140
+ " f.write(api_key)\n",
141
+ "print(f\"API Key generated: {api_key}\")\n",
133
142
  "\n",
134
143
  "cmd = f\"python server.py {' '.join(params)}\"\n",
135
144
  "print(cmd)\n",
package/config.conf ADDED
@@ -0,0 +1,52 @@
1
+ const port = 8000;
2
+ const whitelist = ['127.0.0.1']; //Example for add several IP in whitelist: ['127.0.0.1', '192.168.0.10']
3
+ const whitelistMode = true; //Disabling enabling the ip whitelist mode. true/false
4
+ const basicAuthMode = false; //Toggle basic authentication for endpoints.
5
+ const basicAuthUser = {username: "user", password: "password"}; //Login credentials when basicAuthMode is true.
6
+ const disableThumbnails = false; //Disables the generation of thumbnails, opting to use the raw images instead
7
+ const autorun = true; //Autorun in the browser. true/false
8
+ const enableExtensions = true; //Enables support for TavernAI-extras project
9
+ const listen = true; // If true, Can be access from other device or PC. otherwise can be access only from hosting machine.
10
+ const allowKeysExposure = false; // If true, private API keys could be fetched to the frontend.
11
+ const skipContentCheck = false; // If true, no new default content will be delivered to you.
12
+ const thumbnailsQuality = 95; // Quality of thumbnails. 0-100
13
+
14
+ // If true, Allows insecure settings for listen, whitelist, and authentication.
15
+ // Change this setting only on "trusted networks". Do not change this value unless you are aware of the issues that can arise from changing this setting and configuring a insecure setting.
16
+ const securityOverride = false;
17
+
18
+ // Additional settings for extra modules / extensions
19
+ const extras = {
20
+ // Disables auto-download of models from the HuggingFace Hub.
21
+ // You will need to manually download the models and put them into the /cache folder.
22
+ disableAutoDownload: false,
23
+ // Text classification model for sentiment analysis. HuggingFace ID of a model in ONNX format.
24
+ classificationModel: 'Cohee/distilbert-base-uncased-go-emotions-onnx',
25
+ // Image captioning model. HuggingFace ID of a model in ONNX format.
26
+ captioningModel: 'Xenova/vit-gpt2-image-captioning',
27
+ // Feature extraction model. HuggingFace ID of a model in ONNX format.
28
+ embeddingModel: 'Xenova/all-mpnet-base-v2',
29
+ };
30
+
31
+ // Request overrides for additional headers
32
+ // Format is an array of objects:
33
+ // { hosts: [ "<url>" ], headers: { <header>: "<value>" } }
34
+ const requestOverrides = [];
35
+
36
+ module.exports = {
37
+ port,
38
+ whitelist,
39
+ whitelistMode,
40
+ basicAuthMode,
41
+ basicAuthUser,
42
+ autorun,
43
+ enableExtensions,
44
+ listen,
45
+ disableThumbnails,
46
+ allowKeysExposure,
47
+ securityOverride,
48
+ skipContentCheck,
49
+ requestOverrides,
50
+ thumbnailsQuality,
51
+ extras,
52
+ };
@@ -9,13 +9,28 @@ const enableExtensions = true; //Enables support for TavernAI-extras project
9
9
  const listen = true; // If true, Can be access from other device or PC. otherwise can be access only from hosting machine.
10
10
  const allowKeysExposure = false; // If true, private API keys could be fetched to the frontend.
11
11
  const skipContentCheck = false; // If true, no new default content will be delivered to you.
12
-
12
+ const thumbnailsQuality = 95; // Quality of thumbnails. 0-100
13
13
 
14
14
  // If true, Allows insecure settings for listen, whitelist, and authentication.
15
15
  // Change this setting only on "trusted networks". Do not change this value unless you are aware of the issues that can arise from changing this setting and configuring a insecure setting.
16
16
  const securityOverride = false;
17
17
 
18
+ // Additional settings for extra modules / extensions
19
+ const extras = {
20
+ // Disables auto-download of models from the HuggingFace Hub.
21
+ // You will need to manually download the models and put them into the /cache folder.
22
+ disableAutoDownload: false,
23
+ // Text classification model for sentiment analysis. HuggingFace ID of a model in ONNX format.
24
+ classificationModel: 'Cohee/distilbert-base-uncased-go-emotions-onnx',
25
+ // Image captioning model. HuggingFace ID of a model in ONNX format.
26
+ captioningModel: 'Xenova/vit-gpt2-image-captioning',
27
+ // Feature extraction model. HuggingFace ID of a model in ONNX format.
28
+ embeddingModel: 'Xenova/all-mpnet-base-v2',
29
+ };
30
+
18
31
  // Request overrides for additional headers
32
+ // Format is an array of objects:
33
+ // { hosts: [ "<url>" ], headers: { <header>: "<value>" } }
19
34
  const requestOverrides = [];
20
35
 
21
36
  module.exports = {
@@ -32,4 +47,6 @@ module.exports = {
32
47
  securityOverride,
33
48
  skipContentCheck,
34
49
  requestOverrides,
50
+ thumbnailsQuality,
51
+ extras,
35
52
  };
@@ -75,9 +75,6 @@
75
75
  "always_force_name2": true,
76
76
  "user_prompt_bias": "",
77
77
  "show_user_prompt_bias": true,
78
- "multigen": false,
79
- "multigen_first_chunk": 50,
80
- "multigen_next_chunks": 30,
81
78
  "markdown_escape_strings": "",
82
79
  "fast_ui_mode": false,
83
80
  "avatar_style": 0,
@@ -167,7 +164,6 @@
167
164
  "custom_stopping_strings_macro": true,
168
165
  "fuzzy_search": true,
169
166
  "encode_tags": false,
170
- "lazy_load": 100,
171
167
  "ui_mode": 1
172
168
  },
173
169
  "extension_settings": {
@@ -9,4 +9,5 @@ services:
9
9
  - "8000:8000"
10
10
  volumes:
11
11
  - "./config:/home/node/app/config"
12
+ - "./user:/home/node/app/public/user"
12
13
  restart: unless-stopped
package/package.json CHANGED
@@ -14,8 +14,7 @@
14
14
  "gpt3-tokenizer": "^1.1.5",
15
15
  "ip-matching": "^2.1.2",
16
16
  "ipaddr.js": "^2.0.1",
17
- "jimp": "^0.22.7",
18
- "jquery": "^3.6.4",
17
+ "jimp": "^0.22.10",
19
18
  "json5": "^2.2.3",
20
19
  "lodash": "^4.17.21",
21
20
  "mime-types": "^2.1.35",
@@ -27,8 +26,9 @@
27
26
  "png-chunks-extract": "^1.0.0",
28
27
  "response-time": "^2.3.2",
29
28
  "sanitize-filename": "^1.6.3",
29
+ "sillytavern-transformers": "^2.7.3",
30
30
  "simple-git": "^3.19.1",
31
- "uniqolor": "^1.1.0",
31
+ "vectra": "^0.2.2",
32
32
  "write-file-atomic": "^5.0.1",
33
33
  "ws": "^8.13.0",
34
34
  "yargs": "^17.7.1",
@@ -46,11 +46,12 @@
46
46
  "type": "git",
47
47
  "url": "https://github.com/SillyTavern/SillyTavern.git"
48
48
  },
49
- "version": "1.10.3",
49
+ "version": "1.10.4",
50
50
  "scripts": {
51
51
  "start": "node server.js",
52
52
  "start-multi": "node server.js --disableCsrf",
53
- "pkg": "pkg --compress Gzip --no-bytecode --public ."
53
+ "pkg": "pkg --compress Gzip --no-bytecode --public .",
54
+ "postinstall": "node post-install.js"
54
55
  },
55
56
  "bin": {
56
57
  "sillytavern": "./server.js"
@@ -75,6 +76,7 @@
75
76
  ]
76
77
  },
77
78
  "devDependencies": {
79
+ "jquery": "^3.6.4",
78
80
  "pkg": "^5.8.1",
79
81
  "pkg-fetch": "^3.5.2"
80
82
  }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Scripts to be done before starting the server for the first time.
3
+ */
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const crypto = require('crypto');
7
+
8
+ /**
9
+ * Creates the default config files if they don't exist yet.
10
+ */
11
+ function createDefaultFiles() {
12
+ const files = {
13
+ settings: './public/settings.json',
14
+ bg_load: './public/css/bg_load.css',
15
+ config: './config.conf',
16
+ };
17
+
18
+ for (const file of Object.values(files)) {
19
+ try {
20
+ if (!fs.existsSync(file)) {
21
+ const defaultFilePath = path.join('./default', path.parse(file).base);
22
+ fs.copyFileSync(defaultFilePath, file);
23
+ console.log(`Created default file: ${file}`);
24
+ }
25
+ } catch (error) {
26
+ console.error(`FATAL: Could not write default file: ${file}`, error);
27
+ }
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Returns the MD5 hash of the given data.
33
+ * @param {Buffer} data Input data
34
+ * @returns {string} MD5 hash of the input data
35
+ */
36
+ function getMd5Hash(data) {
37
+ return crypto
38
+ .createHash('md5')
39
+ .update(data)
40
+ .digest('hex');
41
+ }
42
+
43
+ /**
44
+ * Copies the WASM binaries from the sillytavern-transformers package to the dist folder.
45
+ */
46
+ function copyWasmFiles() {
47
+ if (!fs.existsSync('./dist')) {
48
+ fs.mkdirSync('./dist');
49
+ }
50
+
51
+ const listDir = fs.readdirSync('./node_modules/sillytavern-transformers/dist');
52
+
53
+ for (const file of listDir) {
54
+ if (file.endsWith('.wasm')) {
55
+ const sourcePath = `./node_modules/sillytavern-transformers/dist/${file}`;
56
+ const targetPath = `./dist/${file}`;
57
+
58
+ // Don't copy if the file already exists and is the same checksum
59
+ if (fs.existsSync(targetPath)) {
60
+ const sourceChecksum = getMd5Hash(fs.readFileSync(sourcePath));
61
+ const targetChecksum = getMd5Hash(fs.readFileSync(targetPath));
62
+
63
+ if (sourceChecksum === targetChecksum) {
64
+ continue;
65
+ }
66
+ }
67
+
68
+ fs.copyFileSync(sourcePath, targetPath);
69
+ console.log(`${file} successfully copied to ./dist/${file}`);
70
+ }
71
+ }
72
+ }
73
+
74
+ try {
75
+ // 1. Create default config files
76
+ createDefaultFiles();
77
+ // 2. Copy transformers WASM binaries from node_modules
78
+ copyWasmFiles();
79
+ } catch (error) {
80
+ console.error(error);
81
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "temp": 1.06,
3
+ "rep_pen": 1,
4
+ "rep_pen_range": 0,
5
+ "top_p": 1,
6
+ "top_a": 0,
7
+ "top_k": 0,
8
+ "typical": 1,
9
+ "tfs": 1,
10
+ "rep_pen_slope": 0.9,
11
+ "single_line": false,
12
+ "sampler_order": [
13
+ 6,
14
+ 0,
15
+ 1,
16
+ 3,
17
+ 4,
18
+ 2,
19
+ 5
20
+ ],
21
+ "mirostat": 2,
22
+ "mirostat_tau": 9.61,
23
+ "mirostat_eta": 1,
24
+ "use_default_badwordsids": true
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "temp": 1.17,
3
+ "rep_pen": 1,
4
+ "rep_pen_range": 0,
5
+ "top_p": 1,
6
+ "top_a": 0,
7
+ "top_k": 0,
8
+ "typical": 1,
9
+ "tfs": 1,
10
+ "rep_pen_slope": 0.9,
11
+ "single_line": false,
12
+ "sampler_order": [
13
+ 6,
14
+ 0,
15
+ 1,
16
+ 3,
17
+ 4,
18
+ 2,
19
+ 5
20
+ ],
21
+ "mirostat": 2,
22
+ "mirostat_tau": 9.91,
23
+ "mirostat_eta": 1,
24
+ "use_default_badwordsids": true
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "temp": 1.17,
3
+ "rep_pen": 1,
4
+ "rep_pen_range": 0,
5
+ "top_p": 1,
6
+ "top_a": 0,
7
+ "top_k": 0,
8
+ "typical": 1,
9
+ "tfs": 1,
10
+ "rep_pen_slope": 0.9,
11
+ "single_line": false,
12
+ "sampler_order": [
13
+ 6,
14
+ 0,
15
+ 1,
16
+ 3,
17
+ 4,
18
+ 2,
19
+ 5
20
+ ],
21
+ "mirostat": 2,
22
+ "mirostat_tau": 9.62,
23
+ "mirostat_eta": 1,
24
+ "use_default_badwordsids": true
25
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "temp": 1.06,
3
+ "top_p": 1,
4
+ "top_k": 0,
5
+ "typical_p": 1,
6
+ "top_a": 0,
7
+ "tfs": 1,
8
+ "epsilon_cutoff": 0,
9
+ "eta_cutoff": 0,
10
+ "rep_pen": 1,
11
+ "rep_pen_range": 0,
12
+ "no_repeat_ngram_size": 0,
13
+ "penalty_alpha": 0,
14
+ "num_beams": 1,
15
+ "length_penalty": 1,
16
+ "min_length": 0,
17
+ "encoder_rep_pen": 1,
18
+ "do_sample": true,
19
+ "early_stopping": false,
20
+ "mirostat_mode": 2,
21
+ "mirostat_tau": 9.61,
22
+ "mirostat_eta": 1,
23
+ "rep_pen_size": 0
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "temp": 1.17,
3
+ "top_p": 1,
4
+ "top_k": 0,
5
+ "typical_p": 1,
6
+ "top_a": 0,
7
+ "tfs": 1,
8
+ "epsilon_cutoff": 0,
9
+ "eta_cutoff": 0,
10
+ "rep_pen": 1,
11
+ "rep_pen_range": 0,
12
+ "no_repeat_ngram_size": 0,
13
+ "penalty_alpha": 0,
14
+ "num_beams": 1,
15
+ "length_penalty": 1,
16
+ "min_length": 0,
17
+ "encoder_rep_pen": 1,
18
+ "do_sample": true,
19
+ "early_stopping": false,
20
+ "mirostat_mode": 2,
21
+ "mirostat_tau": 9.91,
22
+ "mirostat_eta": 1,
23
+ "rep_pen_size": 0
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "temp": 1.17,
3
+ "top_p": 1,
4
+ "top_k": 0,
5
+ "typical_p": 1,
6
+ "top_a": 0,
7
+ "tfs": 1,
8
+ "epsilon_cutoff": 0,
9
+ "eta_cutoff": 0,
10
+ "rep_pen": 1,
11
+ "rep_pen_range": 0,
12
+ "no_repeat_ngram_size": 0,
13
+ "penalty_alpha": 0,
14
+ "num_beams": 1,
15
+ "length_penalty": 1,
16
+ "min_length": 0,
17
+ "encoder_rep_pen": 1,
18
+ "do_sample": true,
19
+ "early_stopping": false,
20
+ "mirostat_mode": 2,
21
+ "mirostat_tau": 9.62,
22
+ "mirostat_eta": 1,
23
+ "rep_pen_size": 0
24
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "story_string": "{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Circumstances and context of the dialogue: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
3
+ "chat_start": "\nThen the roleplay chat between {{user}} and {{char}} begins.\n",
4
+ "example_separator": "This is how {{char}} should talk",
5
+ "name": "OldDefault"
6
+ }