sillytavern 1.14.0 → 1.16.0

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 (225) hide show
  1. package/.dockerignore +55 -11
  2. package/.eslintrc.cjs +1 -1
  3. package/CONTRIBUTING.md +52 -21
  4. package/Dockerfile +16 -12
  5. package/Start.bat +1 -1
  6. package/UpdateAndStart.bat +1 -1
  7. package/UpdateForkAndStart.bat +1 -1
  8. package/config.yaml +35 -2
  9. package/default/config.yaml +35 -2
  10. package/default/content/presets/instruct/Mistral V7-Tekken.json +1 -1
  11. package/default/content/presets/openai/Default.json +4 -3
  12. package/default/content/presets/textgen/Default.json +1 -0
  13. package/default/content/presets/textgen/Deterministic.json +1 -0
  14. package/default/content/presets/textgen/Neutral.json +1 -0
  15. package/default/content/presets/textgen/Universal-Creative.json +1 -0
  16. package/default/content/presets/textgen/Universal-Light.json +1 -0
  17. package/default/content/presets/textgen/Universal-Super-Creative.json +1 -0
  18. package/default/content/settings.json +4 -2
  19. package/docker/docker-compose.yml +7 -0
  20. package/docker/docker-entrypoint.sh +95 -8
  21. package/package.json +7 -7
  22. package/public/css/animations.css +20 -0
  23. package/public/css/backgrounds.css +84 -8
  24. package/public/css/chat-backups.css +54 -0
  25. package/public/css/extensions-panel.css +6 -2
  26. package/public/css/file-form.css +1 -0
  27. package/public/css/macros.css +603 -0
  28. package/public/css/mobile-styles.css +9 -0
  29. package/public/css/rm-groups.css +8 -0
  30. package/public/css/select2-overrides.css +5 -0
  31. package/public/css/tags.css +4 -0
  32. package/public/css/toggle-dependent.css +11 -5
  33. package/public/css/welcome.css +9 -0
  34. package/public/global.d.ts +82 -4
  35. package/public/img/chutes.svg +4 -0
  36. package/public/index.html +370 -191
  37. package/public/jsconfig.json +7 -1
  38. package/public/lib.js +3 -0
  39. package/public/locales/ar-sa.json +6 -6
  40. package/public/locales/de-de.json +6 -6
  41. package/public/locales/es-es.json +6 -6
  42. package/public/locales/fr-fr.json +8 -6
  43. package/public/locales/is-is.json +6 -6
  44. package/public/locales/it-it.json +6 -6
  45. package/public/locales/ja-jp.json +6 -6
  46. package/public/locales/ko-kr.json +6 -6
  47. package/public/locales/nl-nl.json +6 -6
  48. package/public/locales/pt-pt.json +6 -6
  49. package/public/locales/ru-ru.json +5 -7
  50. package/public/locales/th-th.json +6 -6
  51. package/public/locales/uk-ua.json +6 -6
  52. package/public/locales/vi-vn.json +6 -6
  53. package/public/locales/zh-cn.json +163 -183
  54. package/public/locales/zh-tw.json +5 -7
  55. package/public/script.js +1364 -801
  56. package/public/scripts/PromptManager.js +5 -13
  57. package/public/scripts/RossAscends-mods.js +44 -47
  58. package/public/scripts/a11y.js +14 -0
  59. package/public/scripts/authors-note.js +37 -3
  60. package/public/scripts/autocomplete/AutoComplete.js +60 -8
  61. package/public/scripts/autocomplete/AutoCompleteNameResultBase.js +2 -2
  62. package/public/scripts/autocomplete/AutoCompleteOption.js +16 -0
  63. package/public/scripts/autocomplete/EnhancedMacroAutoCompleteOption.js +1872 -0
  64. package/public/scripts/autocomplete/MacroAutoComplete.js +307 -0
  65. package/public/scripts/autocomplete/MacroAutoCompleteHelper.js +1217 -0
  66. package/public/scripts/backgrounds.js +281 -29
  67. package/public/scripts/bookmarks.js +76 -51
  68. package/public/scripts/cfg-scale.js +14 -14
  69. package/public/scripts/chat-backups.js +335 -0
  70. package/public/scripts/chat-templates.js +6 -6
  71. package/public/scripts/chats.js +44 -23
  72. package/public/scripts/constants.js +56 -5
  73. package/public/scripts/custom-request.js +166 -150
  74. package/public/scripts/data-maid.js +1 -1
  75. package/public/scripts/events.js +5 -1
  76. package/public/scripts/extensions/assets/index.js +17 -17
  77. package/public/scripts/extensions/attachments/index.js +1 -1
  78. package/public/scripts/extensions/caption/index.js +18 -9
  79. package/public/scripts/extensions/caption/settings.html +22 -7
  80. package/public/scripts/extensions/expressions/index.js +24 -3
  81. package/public/scripts/extensions/gallery/index.js +46 -18
  82. package/public/scripts/extensions/gallery/style.css +4 -0
  83. package/public/scripts/extensions/memory/index.js +35 -9
  84. package/public/scripts/extensions/quick-reply/index.js +2 -2
  85. package/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js +1 -1
  86. package/public/scripts/extensions/regex/engine.js +63 -8
  87. package/public/scripts/extensions/regex/index.js +3 -1
  88. package/public/scripts/extensions/shared.js +73 -4
  89. package/public/scripts/extensions/stable-diffusion/index.js +868 -95
  90. package/public/scripts/extensions/stable-diffusion/settings.html +96 -19
  91. package/public/scripts/extensions/translate/index.js +2 -2
  92. package/public/scripts/extensions/tts/chutes.js +233 -0
  93. package/public/scripts/extensions/tts/coqui.js +20 -20
  94. package/public/scripts/extensions/tts/cosyvoice.js +1 -1
  95. package/public/scripts/extensions/tts/edge.js +1 -1
  96. package/public/scripts/extensions/tts/electronhub.js +1 -1
  97. package/public/scripts/extensions/tts/elevenlabs.js +133 -108
  98. package/public/scripts/extensions/tts/gpt-sovits-adapter.js +233 -0
  99. package/public/scripts/extensions/tts/index.js +64 -12
  100. package/public/scripts/extensions/tts/settings.html +11 -0
  101. package/public/scripts/extensions/tts/volcengine.js +316 -0
  102. package/public/scripts/extensions/vectors/index.js +270 -5
  103. package/public/scripts/extensions/vectors/settings.html +20 -0
  104. package/public/scripts/extensions-slashcommands.js +22 -37
  105. package/public/scripts/extensions.js +152 -3
  106. package/public/scripts/group-chats.js +458 -188
  107. package/public/scripts/horde.js +8 -8
  108. package/public/scripts/i18n.js +3 -2
  109. package/public/scripts/instruct-mode.js +9 -9
  110. package/public/scripts/itemized-prompts.js +43 -1
  111. package/public/scripts/keyboard.js +1 -0
  112. package/public/scripts/logprobs.js +1 -0
  113. package/public/scripts/macros/definitions/chat-macros.js +136 -0
  114. package/public/scripts/macros/definitions/core-macros.js +460 -0
  115. package/public/scripts/macros/definitions/env-macros.js +181 -0
  116. package/public/scripts/macros/definitions/instruct-macros.js +76 -0
  117. package/public/scripts/macros/definitions/state-macros.js +57 -0
  118. package/public/scripts/macros/definitions/time-macros.js +151 -0
  119. package/public/scripts/macros/definitions/variable-macros.js +305 -0
  120. package/public/scripts/macros/engine/MacroBrowser.js +686 -0
  121. package/public/scripts/macros/engine/MacroCstWalker.js +1365 -0
  122. package/public/scripts/macros/engine/MacroDiagnostics.js +242 -0
  123. package/public/scripts/macros/engine/MacroEngine.js +416 -0
  124. package/public/scripts/macros/engine/MacroEnv.types.js +66 -0
  125. package/public/scripts/macros/engine/MacroEnvBuilder.js +202 -0
  126. package/public/scripts/macros/engine/MacroFlags.js +228 -0
  127. package/public/scripts/macros/engine/MacroLexer.js +393 -0
  128. package/public/scripts/macros/engine/MacroParser.js +227 -0
  129. package/public/scripts/macros/engine/MacroRegistry.js +829 -0
  130. package/public/scripts/macros/macro-system.js +84 -0
  131. package/public/scripts/macros.js +141 -18
  132. package/public/scripts/openai.js +847 -691
  133. package/public/scripts/personas.js +21 -21
  134. package/public/scripts/power-user.js +55 -4
  135. package/public/scripts/preset-manager.js +11 -8
  136. package/public/scripts/reasoning.js +90 -11
  137. package/public/scripts/samplerSelect.js +1 -1
  138. package/public/scripts/scrapers.js +2 -2
  139. package/public/scripts/secrets.js +19 -4
  140. package/public/scripts/slash-commands/SlashCommandClosure.js +102 -0
  141. package/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js +6 -0
  142. package/public/scripts/slash-commands/SlashCommandParser.js +131 -43
  143. package/public/scripts/slash-commands.js +319 -22
  144. package/public/scripts/sse-stream.js +62 -4
  145. package/public/scripts/st-context.js +34 -5
  146. package/public/scripts/system-messages.js +58 -61
  147. package/public/scripts/tags.js +493 -58
  148. package/public/scripts/templates/welcomePanel.html +8 -0
  149. package/public/scripts/textgen-models.js +62 -14
  150. package/public/scripts/textgen-settings.js +228 -132
  151. package/public/scripts/tokenizers.js +28 -1
  152. package/public/scripts/tool-calling.js +70 -54
  153. package/public/scripts/user.js +6 -6
  154. package/public/scripts/util/AccountStorage.js +6 -0
  155. package/public/scripts/utils.js +201 -45
  156. package/public/scripts/variables.js +12 -12
  157. package/public/scripts/welcome-screen.js +176 -10
  158. package/public/scripts/world-info.js +132 -10
  159. package/public/style.css +118 -15
  160. package/src/byaf.js +5 -6
  161. package/src/charx.js +399 -0
  162. package/src/command-line.js +8 -0
  163. package/src/config-init.js +1 -1
  164. package/src/constants.js +24 -0
  165. package/src/electron/Start.bat +1 -1
  166. package/src/electron/start.sh +1 -1
  167. package/src/endpoints/assets.js +35 -23
  168. package/src/endpoints/backends/chat-completions.js +913 -553
  169. package/src/endpoints/backends/kobold.js +1 -1
  170. package/src/endpoints/backends/text-completions.js +19 -8
  171. package/src/endpoints/backgrounds.js +27 -4
  172. package/src/endpoints/backups.js +75 -0
  173. package/src/endpoints/characters.js +49 -57
  174. package/src/endpoints/chats.js +284 -227
  175. package/src/endpoints/content-manager.js +2 -2
  176. package/src/endpoints/data-maid.js +13 -0
  177. package/src/endpoints/google.js +3 -1
  178. package/src/endpoints/groups.js +108 -7
  179. package/src/endpoints/image-metadata.js +494 -0
  180. package/src/endpoints/images.js +3 -2
  181. package/src/endpoints/openai.js +291 -59
  182. package/src/endpoints/openrouter.js +111 -42
  183. package/src/endpoints/search.js +47 -1
  184. package/src/endpoints/secrets.js +6 -0
  185. package/src/endpoints/speech.js +300 -8
  186. package/src/endpoints/sprites.js +34 -14
  187. package/src/endpoints/stable-diffusion.js +471 -17
  188. package/src/endpoints/stats.js +67 -65
  189. package/src/endpoints/thumbnails.js +181 -120
  190. package/src/endpoints/tokenizers.js +2 -2
  191. package/src/endpoints/translate.js +9 -41
  192. package/src/endpoints/users-admin.js +16 -2
  193. package/src/endpoints/vectors.js +20 -0
  194. package/src/endpoints/volcengine.js +136 -0
  195. package/src/endpoints/worldinfo.js +34 -0
  196. package/src/healthcheck.js +40 -0
  197. package/src/middleware/basicAuth.js +2 -1
  198. package/src/prompt-converters.js +232 -22
  199. package/src/server-main.js +68 -18
  200. package/src/server-startup.js +6 -0
  201. package/src/users.js +2 -1
  202. package/src/util.js +290 -34
  203. package/src/vectors/openai-vectors.js +33 -5
  204. package/start.sh +2 -18
  205. package/tests/.eslintrc.cjs +10 -2
  206. package/tests/frontend/MacroEngine.e2e.js +3411 -0
  207. package/tests/frontend/MacroEnvBuilder.e2e.js +497 -0
  208. package/tests/frontend/MacroLexer.e2e.js +1348 -0
  209. package/tests/frontend/MacroParser.e2e.js +975 -0
  210. package/tests/frontend/MacroRegistry.e2e.js +719 -0
  211. package/tests/frontend/MacroSlashCommands.e2e.js +177 -0
  212. package/tests/frontend/MacroStoryString.e2e.js +82 -0
  213. package/tests/frontend/MacrosParser.e2e.js +50 -0
  214. package/tests/frontend/frontent-test-utils.js +22 -0
  215. package/tests/jsconfig.json +5 -0
  216. package/tests/mock-server.test.js +34 -0
  217. package/tests/package-lock.json +70 -1417
  218. package/tests/package.json +5 -3
  219. package/tests/playwright.config.js +12 -0
  220. package/tests/sample.e2e.js +7 -5
  221. package/tests/util/mock-server.js +101 -0
  222. package/tests/util.test.js +5 -5
  223. package/public/scripts/templates/macros.html +0 -104
  224. package/tests/jest-e2e.config.json +0 -11
  225. package/tests/jest.setup.js +0 -2
package/.dockerignore CHANGED
@@ -1,17 +1,61 @@
1
+ # --- Git & CI ---
1
2
  .git
2
3
  .github
3
- .vscode
4
- node_modules
5
- npm-debug.log
6
- readme*
7
- Start.bat
8
- /dist
4
+ .gitignore
5
+
6
+ # --- Docker ---
7
+ /Dockerfile
8
+ /.dockerignore
9
+ /docker/docker-compose.yml
10
+ /docker/config
11
+ /docker/extensions
12
+ /docker/data
13
+ /docker/plugins
14
+ /public/scripts/extensions/third-party
15
+
16
+ # --- Plugins (keep only package files) ---
17
+ /plugins/*
18
+ !/plugins/package.json
19
+ !/plugins/package-lock.json
20
+
21
+ # --- The Folders ---
9
22
  /backups
10
- cloudflared.exe
11
- access.log
12
- /data
13
23
  /cache
14
- .DS_Store
15
- /public/scripts/extensions/third-party
16
24
  /colab
25
+ /data
26
+ /dist
27
+ /node_modules
28
+ /tests
29
+
30
+ # --- Sensitive Info ---
31
+ **/.env*
32
+ **/*.pem
33
+ **/certs
34
+
35
+ # --- Documentation ---
36
+ readme*
37
+ *.md
38
+ Update-Instructions.txt
39
+
40
+ # --- OS & System Junk ---
41
+ **/.DS_Store
42
+ *.bat
43
+ *.cmd
44
+ *.exe
45
+ start.sh
46
+
47
+ # --- Dev Config ---
48
+ .editorconfig
49
+ .eslintrc.cjs
50
+ .eslintrc*
51
+ .vscode
52
+ **/jsconfig.json
53
+ .npmignore
17
54
  .gemini
55
+ replit.nix
56
+ .replit
57
+ .nomedia
58
+
59
+ # -- Logs & Temp ---
60
+ *.log
61
+ **/tmp
package/.eslintrc.cjs CHANGED
@@ -98,7 +98,7 @@ module.exports = {
98
98
  'no-cond-assign': 'error',
99
99
  'no-unneeded-ternary': 'error',
100
100
  'no-irregular-whitespace': ['error', { skipStrings: true, skipTemplates: true }],
101
-
101
+ 'dot-notation': ['error', { 'allowPattern': '[A-Z]\\w*$' }],
102
102
  // These rules should eventually be enabled.
103
103
  'no-async-promise-executor': 'off',
104
104
  'no-inner-declarations': 'off',
package/CONTRIBUTING.md CHANGED
@@ -12,32 +12,63 @@
12
12
  2. Fork this repository under your account.
13
13
  3. Clone the fork onto your machine.
14
14
  4. Open the cloned repository in the code editor.
15
- 5. Create a git branch (recommended).
15
+ 5. Create a git branch (recommended), review the [git book](https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control) if you haven't.
16
16
  6. Make your changes and test them locally.
17
17
  7. Commit the changes and push the branch to the remote repo.
18
- 8. Go to GitHub, and open a pull request, targeting the upstream branch.
18
+ 8. Go to GitHub, and open a pull request, targeting the appropriate upstream branch.
19
19
 
20
20
  ## Contribution guidelines
21
21
 
22
- 1. Our standards are pretty low, but make sure the code is not too ugly:
23
- - Run VS Code's autoformat when you're done.
24
- - Check with ESLint by running `npm run lint`, then fix the errors.
25
- - Use common sense and follow existing naming conventions.
26
- 2. Create pull requests for the staging branch, 99% of contributions should go there. That way people could test your code before the next stable release.
27
- 3. You can still send a pull request for release in the following scenarios:
28
- - Updating README.
29
- - Updating GitHub Actions.
30
- - Hotfixing a critical bug.
31
- 4. Project maintainers will test and can change your code before merging. To keep our workflow smooth, please ensure the following:
32
- - The "Allow edits from maintainers" option is checked.
33
- - Avoid force-pushing your branch once the PR is out of draft state.
34
- 5. To make sure that your contribution remains testable and reviewable, try not to exceed a soft limit of **200 lines of code** (both additions and deletions) per pull request. If you have more to contribute, split it into multiple pull requests. We can also consider creating a separate feature branch for more substantial changes, but please discuss it with the maintainers first.
35
- 6. Write at least somewhat meaningful PR descriptions and commit messages. There's no "right" way to do it, but the following may help with outlining a general structure:
36
- - What is the reason for a change?
37
- - What did you do to achieve this?
38
- - How would a reviewer test the change?
39
- 7. English is the primary language of communication in this project. Please use only English when writing commit messages, PR descriptions, comments and other text. This does not apply to contributions to localization files.
40
- 8. Mind the license. Your contributions will be licensed under the GNU Affero General Public License. If you don't know what that implies, consult your lawyer.
22
+ ### Maintain code quality
23
+
24
+ Our standards are pretty low, but make sure the code is not too ugly:
25
+
26
+ - Run VS Code's autoformat when you're done.
27
+ - Check with ESLint by running `npm run lint`, then fix the errors.
28
+ - Use common sense and follow existing naming conventions.
29
+
30
+ ### Use the correct target branch
31
+
32
+ Create pull requests for the `staging` branch, 99% of contributions should go there. That way people could test your code before the next stable release.
33
+
34
+ You can still send a pull request for `release` in the following scenarios:
35
+
36
+ - Updating README.
37
+ - Updating GitHub Actions.
38
+ - Hotfixing a critical bug.
39
+
40
+ Project maintainers will test and can change your code before merging. To keep our workflow smooth, please ensure the following:
41
+
42
+ - The "Allow edits from maintainers" option is checked.
43
+ - Avoid force-pushing your branch once the PR is out of draft state.
44
+
45
+ ### Make contributions small and testable
46
+
47
+ To make sure that your contribution remains testable and reviewable, try not to exceed a soft limit of **200 lines of code** (both additions and deletions) per pull request. If you have more to contribute, split it into multiple pull requests.
48
+
49
+ We can also consider creating a separate feature branch for more substantial changes, but please discuss it with the maintainers first. For example:
50
+
51
+ - Leave the main larger PR as a draft so it can be used to discuss the implementation.
52
+ - Split each group of functions or features into a ~200 line PR so it can be properly reviewed and merged to staging or a feature branch.
53
+ - If there are large codependent changes that cannot be split, start with the most utilized dependencies and stub dependent functions.
54
+ - Each will be reviewed and tested one by one, merging into the feature branch as they're ready.
55
+ - Do not create all branches in advance, as subsequent changes made in previous commits as a result of test/review may create a lot of merge conflicts.
56
+
57
+ ### Provide clear descriptions of your changes
58
+
59
+ Write at least somewhat meaningful PR descriptions and commit messages. There's no "right" way to do it, but the following may help with outlining a general structure:
60
+
61
+ - What is the reason for a change?
62
+ - What did you do to achieve this?
63
+ - How would a reviewer test the change?
64
+
65
+ ### We (likely) don't speak your language
66
+
67
+ English is the primary language of communication in this project. Please use only English when writing commit messages, PR descriptions, comments and other text. This does not apply to contributions to localization files.
68
+
69
+ ### Legal stuff
70
+
71
+ Mind the license. Your contributions will be licensed under the GNU Affero General Public License. If you don't know what that implies, consult your lawyer.
41
72
 
42
73
  ## Use of AI coding assistance tools ("Vibe Coding")
43
74
 
package/Dockerfile CHANGED
@@ -1,44 +1,48 @@
1
- FROM node:lts-alpine3.22
1
+ FROM node:lts-alpine3.23
2
2
 
3
3
  # Arguments
4
4
  ARG APP_HOME=/home/node/app
5
5
 
6
6
  # Install system dependencies
7
- RUN apk add --no-cache gcompat tini git git-lfs
7
+ # "Don't rely on the base image for tools; if you call it, you install it." ;)
8
+ RUN apk add --no-cache gcompat tini git git-lfs su-exec shadow dos2unix
8
9
 
9
- # Create app directory
10
+ # Create app directory and set ownership
10
11
  WORKDIR ${APP_HOME}
12
+ RUN chown node:node ${APP_HOME}
11
13
 
12
14
  # Set NODE_ENV to production
13
15
  ENV NODE_ENV=production
14
16
 
15
- # Bundle app source
16
- COPY . ./
17
+ # Bundle app source and set ownership
18
+ COPY --chown=node:node . ./
17
19
 
18
20
  RUN \
19
21
  echo "*** Install npm packages ***" && \
20
- npm i --no-audit --no-fund --loglevel=error --no-progress --omit=dev && npm cache clean --force
22
+ npm ci --no-audit --no-fund --loglevel=error --no-progress --omit=dev && npm cache clean --force
21
23
 
22
- # Create config directory and link config.yaml
24
+ # Create config directory and link config.yaml. Added hardcoded dirs(constants.js?)
25
+ # that must be present for Non-Root Mode and volumeless docker runs.
23
26
  RUN \
24
27
  rm -f "config.yaml" || true && \
25
- ln -s "./config/config.yaml" "config.yaml" || true && \
26
- mkdir "config" || true
28
+ mkdir -p config data plugins public/scripts/extensions/third-party backups && \
29
+ chown -R node:node config data plugins public/scripts/extensions/third-party backups && \
30
+ ln -s "./config/config.yaml" "config.yaml"
27
31
 
28
32
  # Pre-compile public libraries
29
33
  RUN \
30
34
  echo "*** Run Webpack ***" && \
31
35
  node "./docker/build-lib.js"
32
36
 
33
- # Set the entrypoint script
37
+ # Set the entrypoint script and cleanup
34
38
  RUN \
35
39
  echo "*** Cleanup ***" && \
36
40
  mv "./docker/docker-entrypoint.sh" "./" && \
37
- rm -rf "./docker" && \
38
41
  echo "*** Make docker-entrypoint.sh executable ***" && \
39
42
  chmod +x "./docker-entrypoint.sh" && \
40
43
  echo "*** Convert line endings to Unix format ***" && \
41
- dos2unix "./docker-entrypoint.sh"
44
+ dos2unix "./docker-entrypoint.sh" && \
45
+ rm -rf "./docker"
42
46
 
43
47
  # Fix extension repos permissions
44
48
  RUN git config --global --add safe.directory "*"
package/Start.bat CHANGED
@@ -1,7 +1,7 @@
1
1
  @echo off
2
2
  pushd %~dp0
3
3
  set NODE_ENV=production
4
- call npm install --no-audit --no-fund --loglevel=error --no-progress --omit=dev
4
+ call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev
5
5
  node server.js %*
6
6
  pause
7
7
  popd
@@ -20,7 +20,7 @@ if %errorlevel% neq 0 (
20
20
  )
21
21
  )
22
22
  set NODE_ENV=production
23
- call npm install --no-audit --no-fund --loglevel=error --no-progress --omit=dev
23
+ call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev
24
24
  node server.js %*
25
25
  :end
26
26
  pause
@@ -102,7 +102,7 @@ if %errorlevel% neq 0 (
102
102
 
103
103
  echo Installing npm packages and starting server
104
104
  set NODE_ENV=production
105
- call npm install --no-audit --no-fund --loglevel=error --no-progress --omit=dev
105
+ call npm install --no-save --no-audit --no-fund --loglevel=error --no-progress --omit=dev
106
106
  node server.js %*
107
107
 
108
108
  :end
package/config.yaml CHANGED
@@ -38,6 +38,9 @@ browserLaunch:
38
38
  avoidLocalhost: false
39
39
  # Server port
40
40
  port: 8000
41
+ # Interval in seconds to write a heartbeat file. Set to 0 to disable.
42
+ # This is used primarily for Docker healthchecks.
43
+ heartbeatInterval: 0
41
44
  # -- SSL options --
42
45
  ssl:
43
46
  # Enable SSL/TLS encryption
@@ -68,6 +71,25 @@ basicAuthUser:
68
71
  password: "password"
69
72
  # Enables CORS proxy middleware
70
73
  enableCorsProxy: false
74
+ # CORS settings (applied to all routes)
75
+ cors:
76
+ # Enable or disable CORS middleware
77
+ enabled: true
78
+ # Allowed origins. Use "null" to match the default browser file origin.
79
+ # You can set "*" to allow any origin, or a list of allowed origins.
80
+ origin:
81
+ - "null"
82
+ # Allowed methods
83
+ methods:
84
+ - "OPTIONS"
85
+ # Allowed request headers (optional)
86
+ allowedHeaders: []
87
+ # Exposed response headers (optional)
88
+ exposedHeaders: []
89
+ # Allow credentials (cookies, authorization headers)
90
+ credentials: false
91
+ # Preflight cache max age in seconds (optional)
92
+ maxAge: null
71
93
  # -- REQUEST PROXY CONFIGURATION --
72
94
  requestProxy:
73
95
  # If a proxy is enabled, all outgoing HTTP/HTTPS requests will be routed through it.
@@ -200,7 +222,6 @@ whitelistImportDomains:
200
222
  - cdn.discordapp.com
201
223
  - files.catbox.moe
202
224
  - raw.githubusercontent.com
203
- - char-archive.evulid.cc
204
225
  # API request overrides (for KoboldAI and Text Completion APIs)
205
226
  ## Note: host includes the port number if it's not the default (80 or 443)
206
227
  ## Format is an array of objects:
@@ -265,7 +286,7 @@ ollama:
265
286
  # -- ANTHROPIC CLAUDE API CONFIGURATION --
266
287
  claude:
267
288
  # Enables caching of the system prompt (if supported).
268
- # https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
289
+ # https://platform.claude.com/docs/en/build-with-claude/prompt-caching
269
290
  # -- IMPORTANT! --
270
291
  # Use only when the prompt before the chat history is static and doesn't change between requests
271
292
  # (e.g {{random}} macro or lorebooks not as in-chat injections).
@@ -287,6 +308,18 @@ claude:
287
308
  gemini:
288
309
  # API endpoint version ("v1beta" or "v1alpha")
289
310
  apiVersion: 'v1beta'
311
+ # Adds thought signatures to requests (if available). Only for Gemini 3 and above.
312
+ thoughtSignatures: true
313
+ # Enables caching of the system prompt (if supported). Only for OpenRouter.
314
+ # -- IMPORTANT! --
315
+ # Use only when the prompt before the chat history is static and doesn't change between requests
316
+ # (e.g {{random}} macro or lorebooks not as in-chat injections).
317
+ # Otherwise, you'll just waste money on cache misses.
318
+ enableSystemPromptCache: false
319
+ # https://ai.google.dev/gemini-api/docs/imagen#imagen-configuration
320
+ image:
321
+ # Leave empty to use the API-default value.
322
+ personGeneration: 'allow_adult'
290
323
  # -- SERVER PLUGIN CONFIGURATION --
291
324
  enableServerPlugins: false
292
325
  # Attempt to automatically update server plugins on startup
@@ -38,6 +38,9 @@ browserLaunch:
38
38
  avoidLocalhost: false
39
39
  # Server port
40
40
  port: 8000
41
+ # Interval in seconds to write a heartbeat file. Set to 0 to disable.
42
+ # This is used primarily for Docker healthchecks.
43
+ heartbeatInterval: 0
41
44
  # -- SSL options --
42
45
  ssl:
43
46
  # Enable SSL/TLS encryption
@@ -68,6 +71,25 @@ basicAuthUser:
68
71
  password: "password"
69
72
  # Enables CORS proxy middleware
70
73
  enableCorsProxy: false
74
+ # CORS settings (applied to all routes)
75
+ cors:
76
+ # Enable or disable CORS middleware
77
+ enabled: true
78
+ # Allowed origins. Use "null" to match the default browser file origin.
79
+ # You can set "*" to allow any origin, or a list of allowed origins.
80
+ origin:
81
+ - "null"
82
+ # Allowed methods
83
+ methods:
84
+ - "OPTIONS"
85
+ # Allowed request headers (optional)
86
+ allowedHeaders: []
87
+ # Exposed response headers (optional)
88
+ exposedHeaders: []
89
+ # Allow credentials (cookies, authorization headers)
90
+ credentials: false
91
+ # Preflight cache max age in seconds (optional)
92
+ maxAge: null
71
93
  # -- REQUEST PROXY CONFIGURATION --
72
94
  requestProxy:
73
95
  # If a proxy is enabled, all outgoing HTTP/HTTPS requests will be routed through it.
@@ -200,7 +222,6 @@ whitelistImportDomains:
200
222
  - cdn.discordapp.com
201
223
  - files.catbox.moe
202
224
  - raw.githubusercontent.com
203
- - char-archive.evulid.cc
204
225
  # API request overrides (for KoboldAI and Text Completion APIs)
205
226
  ## Note: host includes the port number if it's not the default (80 or 443)
206
227
  ## Format is an array of objects:
@@ -265,7 +286,7 @@ ollama:
265
286
  # -- ANTHROPIC CLAUDE API CONFIGURATION --
266
287
  claude:
267
288
  # Enables caching of the system prompt (if supported).
268
- # https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
289
+ # https://platform.claude.com/docs/en/build-with-claude/prompt-caching
269
290
  # -- IMPORTANT! --
270
291
  # Use only when the prompt before the chat history is static and doesn't change between requests
271
292
  # (e.g {{random}} macro or lorebooks not as in-chat injections).
@@ -287,6 +308,18 @@ claude:
287
308
  gemini:
288
309
  # API endpoint version ("v1beta" or "v1alpha")
289
310
  apiVersion: 'v1beta'
311
+ # Adds thought signatures to requests (if available). Only for Gemini 3 and above.
312
+ thoughtSignatures: true
313
+ # Enables caching of the system prompt (if supported). Only for OpenRouter.
314
+ # -- IMPORTANT! --
315
+ # Use only when the prompt before the chat history is static and doesn't change between requests
316
+ # (e.g {{random}} macro or lorebooks not as in-chat injections).
317
+ # Otherwise, you'll just waste money on cache misses.
318
+ enableSystemPromptCache: false
319
+ # https://ai.google.dev/gemini-api/docs/imagen#imagen-configuration
320
+ image:
321
+ # Leave empty to use the API-default value.
322
+ personGeneration: 'allow_adult'
290
323
  # -- SERVER PLUGIN CONFIGURATION --
291
324
  enableServerPlugins: false
292
325
  # Attempt to automatically update server plugins on startup
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "input_sequence": "[INST]",
3
- "output_sequence": " ",
3
+ "output_sequence": "",
4
4
  "last_output_sequence": "",
5
5
  "system_sequence": "[SYSTEM_PROMPT]",
6
6
  "stop_sequence": "</s>",
@@ -8,6 +8,8 @@
8
8
  "openrouter_sort_models": "alphabetically",
9
9
  "ai21_model": "jamba-large",
10
10
  "mistralai_model": "mistral-large-latest",
11
+ "chutes_model": "deepseek-ai/DeepSeek-V3-0324",
12
+ "chutes_sort_models": "alphabetically",
11
13
  "electronhub_model": "gpt-4o-mini",
12
14
  "electronhub_sort_models": "alphabetically",
13
15
  "electronhub_group_models": false,
@@ -28,7 +30,6 @@
28
30
  "repetition_penalty": 1,
29
31
  "openai_max_context": 4095,
30
32
  "openai_max_tokens": 300,
31
- "wrap_in_quotes": false,
32
33
  "names_behavior": 0,
33
34
  "send_if_empty": "",
34
35
  "impersonation_prompt": "[Write your next reply from the point of view of {{user}}, using the chat history so far as a guideline for the writing style of {{user}}. Don't write as {{char}} or system. Don't describe actions of {{char}}.]",
@@ -231,9 +232,9 @@
231
232
  "show_external_models": false,
232
233
  "assistant_prefill": "",
233
234
  "assistant_impersonation": "",
234
- "claude_use_sysprompt": false,
235
+ "use_sysprompt": false,
235
236
  "squash_system_messages": false,
236
- "image_inlining": false,
237
+ "media_inlining": true,
237
238
  "bypass_status_check": false,
238
239
  "continue_prefill": false,
239
240
  "continue_postfix": " ",
@@ -45,6 +45,7 @@
45
45
  "negative_prompt": "",
46
46
  "grammar_string": "",
47
47
  "json_schema": null,
48
+ "json_schema_allow_empty": false,
48
49
  "banned_tokens": "",
49
50
  "sampler_priority": [
50
51
  "repetition_penalty",
@@ -45,6 +45,7 @@
45
45
  "negative_prompt": "",
46
46
  "grammar_string": "",
47
47
  "json_schema": null,
48
+ "json_schema_allow_empty": false,
48
49
  "banned_tokens": "",
49
50
  "sampler_priority": [
50
51
  "repetition_penalty",
@@ -45,6 +45,7 @@
45
45
  "negative_prompt": "",
46
46
  "grammar_string": "",
47
47
  "json_schema": null,
48
+ "json_schema_allow_empty": false,
48
49
  "banned_tokens": "",
49
50
  "sampler_priority": [
50
51
  "repetition_penalty",
@@ -45,6 +45,7 @@
45
45
  "negative_prompt": "",
46
46
  "grammar_string": "",
47
47
  "json_schema": null,
48
+ "json_schema_allow_empty": false,
48
49
  "banned_tokens": "",
49
50
  "sampler_priority": [
50
51
  "repetition_penalty",
@@ -45,6 +45,7 @@
45
45
  "negative_prompt": "",
46
46
  "grammar_string": "",
47
47
  "json_schema": null,
48
+ "json_schema_allow_empty": false,
48
49
  "banned_tokens": "",
49
50
  "sampler_priority": [
50
51
  "repetition_penalty",
@@ -45,6 +45,7 @@
45
45
  "negative_prompt": "",
46
46
  "grammar_string": "",
47
47
  "json_schema": null,
48
+ "json_schema_allow_empty": false,
48
49
  "banned_tokens": "",
49
50
  "sampler_priority": [
50
51
  "repetition_penalty",
@@ -191,6 +191,7 @@
191
191
  "custom_stopping_strings_macro": true,
192
192
  "fuzzy_search": true,
193
193
  "encode_tags": false,
194
+ "experimental_macro_engine": false,
194
195
  "enableLabMode": false,
195
196
  "enableZenSliders": false,
196
197
  "ui_mode": 1,
@@ -463,7 +464,6 @@
463
464
  "stream_openai": true,
464
465
  "openai_max_context": 4095,
465
466
  "openai_max_tokens": 300,
466
- "wrap_in_quotes": false,
467
467
  "prompts": [
468
468
  {
469
469
  "name": "Main Prompt",
@@ -632,6 +632,8 @@
632
632
  "show_external_models": false,
633
633
  "proxy_password": "",
634
634
  "assistant_prefill": "",
635
- "assistant_impersonation": ""
635
+ "assistant_impersonation": "",
636
+ "use_sysprompt": false,
637
+ "squash_system_messages": false
636
638
  }
637
639
  }
@@ -7,6 +7,7 @@ services:
7
7
  environment:
8
8
  - NODE_ENV=production
9
9
  - FORCE_COLOR=1
10
+ - SILLYTAVERN_HEARTBEATINTERVAL=30
10
11
  ports:
11
12
  - "8000:8000"
12
13
  volumes:
@@ -14,4 +15,10 @@ services:
14
15
  - "./data:/home/node/app/data"
15
16
  - "./plugins:/home/node/app/plugins"
16
17
  - "./extensions:/home/node/app/public/scripts/extensions/third-party"
18
+ healthcheck:
19
+ test: ["CMD", "node", "src/healthcheck.js"]
20
+ interval: 30s
21
+ timeout: 10s
22
+ start_period: 20s
23
+ retries: 3
17
24
  restart: unless-stopped
@@ -1,12 +1,99 @@
1
1
  #!/bin/sh
2
2
 
3
- if [ ! -e "config/config.yaml" ]; then
4
- echo "Resource not found, copying from defaults: config.yaml"
5
- cp -r "default/config.yaml" "config/config.yaml"
6
- fi
3
+ # Function to handle startup logic (Config check + Postinstall + Start)
4
+ start_sillytavern() {
5
+ local PREFIX="$1"
6
+ shift # Remove the first argument (PREFIX) so $@ contains the rest
7
+
8
+ # Config Check
9
+ if [ ! -e "config/config.yaml" ]; then
10
+ echo "Resource not found, copying from defaults: config.yaml"
11
+ $PREFIX cp "default/config.yaml" "config/config.yaml"
12
+ fi
13
+
14
+ # Execute postinstall to auto-populate config.yaml with missing values
15
+ $PREFIX npm run postinstall
16
+
17
+ # Start the server
18
+ exec $PREFIX node server.js --listen "$@"
19
+ }
20
+
21
+ # Dirs that MUST be present at this point (e.g for volumeless docker runs).
22
+ # Please update list, if in the future a related perm issue appear.
23
+ CORE_DIRS="config data plugins public/scripts/extensions/third-party backups"
24
+
25
+ # Mounted Volumes (External)
26
+ # Parse mounts, handling files vs directories
27
+ RAW_MOUNTS=$(awk -v app_path="/home/node/app" '$2 ~ "^" app_path {print $2}' /proc/mounts)
28
+ MOUNTED_DIRS=""
29
+
30
+ for mount in $RAW_MOUNTS; do
31
+ if [ -f "$mount" ]; then
32
+ # If it is a mounted file (e.g. cert.pem), we want to check its PARENT directory
33
+ # so that the app can write adjacent files (e.g. key.pem).
34
+ PARENT_DIR=$(dirname "$mount")
35
+
36
+ # Performance Safety: If the file is in the root of the app,
37
+ # we do NOT add the parent (App Root), or we will recursively scan the whole app.
38
+ [ "$PARENT_DIR" != "/home/node/app" ] && MOUNTED_DIRS="$MOUNTED_DIRS $PARENT_DIR" || MOUNTED_DIRS="$MOUNTED_DIRS $mount"
39
+ else
40
+ # It is a directory, add it directly
41
+ MOUNTED_DIRS="$MOUNTED_DIRS $mount"
42
+ fi
43
+ done
44
+
45
+ # Combine dirs for checks
46
+ CHECK_DIRS=$(echo "$CORE_DIRS $MOUNTED_DIRS" | tr ' ' '\n' | sort -u)
7
47
 
8
- # Execute postinstall to auto-populate config.yaml with missing values
9
- npm run postinstall
48
+ # Ensure the needed directories exist
49
+ for dir in $CHECK_DIRS; do
50
+ if [ ! -e "$dir" ]; then
51
+ echo "Creating missing directory: $dir"
52
+ mkdir -p "$dir" 2>/dev/null || echo "Warning: Could not create $dir" >&2
53
+ fi
54
+ done
55
+
56
+ # Mode Selection
57
+ if [ "$(id -u)" = "0" ]; then
58
+ # Check if PUID/PGID variables are provided
59
+ if [ -n "$PUID" ] && [ -n "$PGID" ]; then
60
+ echo "Mode: PUID/PGID (UID:$PUID GID:$PGID)"
61
+
62
+ # Update the internal 'node' user to match requested IDs
63
+ groupmod -o -g "$PGID" node
64
+ usermod -o -u "$PUID" -g "$PGID" node
65
+
66
+ for dir in $CHECK_DIRS; do
67
+ if [ -d "$dir" ]; then
68
+ # Runs chown only if there is an mismatch
69
+ DIR_UID=$(stat -c '%u' "$dir")
70
+ DIR_GID=$(stat -c '%g' "$dir")
71
+
72
+ if [ "$DIR_UID" != "$PUID" ] || [ "$DIR_GID" != "$PGID" ]; then
73
+ echo "(Detected mismatch) Adjusting permissions for: $dir."
74
+ chown -R node:node "$dir" || echo "Warning: Failed to update permissions for '$dir'." >&2
75
+ fi
76
+ fi
77
+ done
78
+
79
+ # Fix config file specifically
80
+ chown node:node "config/config.yaml" 2>/dev/null
81
+
82
+ # Set execution prefix to run as 'node' user
83
+ EXEC_PREFIX="su-exec node:node"
84
+ else
85
+ # Default: Run as Root (original behavior)
86
+ echo "Mode: Default (Root)"
87
+ EXEC_PREFIX=""
88
+ fi
89
+
90
+ else
91
+ # Non-Root Mode (Docker CLI --user flag)
92
+ echo "Mode: Strict Non-Root (UID: $(id -u))"
93
+ # We CANNOT auto-fix permissions in this mode because we lack privileges.
94
+ # Relying solely on the user configuring their host permissions correctly.
95
+ EXEC_PREFIX=""
96
+ fi
10
97
 
11
- # Start the server
12
- exec node server.js --listen "$@"
98
+ # Calling function with the determined prefix
99
+ start_sillytavern "$EXEC_PREFIX" "$@"