diff --git a/.eslintrc.js b/.eslintrc.js index f05a857ad..8d9e36fe3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -55,6 +55,7 @@ module.exports = { isProbablyReaderable: 'readonly', ePub: 'readonly', diff_match_patch: 'readonly', + SillyTavern: 'readonly', }, }, ], diff --git a/default/config.yaml b/default/config.yaml index 0a6ee7df8..0ff6d101f 100644 --- a/default/config.yaml +++ b/default/config.yaml @@ -4,8 +4,22 @@ dataRoot: ./data # -- SERVER CONFIGURATION -- # Listen for incoming connections listen: false +# Enables IPv6 and/or IPv4 protocols. Need to have at least one enabled! +protocol: + ipv4: true + ipv6: false +# Prefers IPv6 for DNS. Enable this on ISPs that don't have issues with IPv6 +dnsPreferIPv6: false +# The hostname that autorun opens. +# - Use "auto" to let the server decide +# - Use options like 'localhost', 'st.example.com' +autorunHostname: "auto" # Server port port: 8000 +# Overrides the port for autorun in browser. +# - Use -1 to use the server port. +# - Specify a port to override the default. +autorunPortOverride: -1 # -- SECURITY CONFIGURATION -- # Toggle whitelist mode whitelistMode: true @@ -13,6 +27,7 @@ whitelistMode: true enableForwardedWhitelist: true # Whitelist of allowed IP addresses whitelist: + - ::1 - 127.0.0.1 # Toggle basic authentication for endpoints basicAuthMode: false @@ -26,6 +41,11 @@ enableCorsProxy: false enableUserAccounts: false # Enable discreet login mode: hides user list on the login screen enableDiscreetLogin: false +# User session timeout *in seconds* (defaults to 24 hours). +## Set to a positive number to expire session after a certain time of inactivity +## Set to 0 to expire session when the browser is closed +## Set to a negative number to disable session expiration +sessionTimeout: 86400 # Used to sign session cookies. Will be auto-generated if not set cookieSecret: '' # Disable CSRF protection - NOT RECOMMENDED @@ -35,6 +55,9 @@ securityOverride: false # -- ADVANCED CONFIGURATION -- # Open the browser automatically autorun: true +# Avoids using 'localhost' for autorun in auto mode. +# use if you don't have 'localhost' in your hosts file +avoidLocalhost: false # Disable thumbnail generation disableThumbnails: false # Thumbnail quality (0-100) @@ -98,10 +121,21 @@ mistral: # Enables prefilling of the reply with the last assistant message in the prompt # CAUTION: The prefix is echoed into the completion. You may want to use regex to trim it out. enablePrefix: false +# -- OLLAMA API CONFIGURATION -- +ollama: + # Controls how long the model will stay loaded into memory following the request + # * -1: Keep the model loaded indefinitely + # * 0: Unload the model immediately after the request + # * N (any positive number): Keep the model loaded for N seconds after the request. + keepAlive: -1 +# -- ANTHROPIC CLAUDE API CONFIGURATION -- +claude: + # Enables caching of the system prompt (if supported). + # https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching + # -- IMPORTANT! -- + # Use only when the prompt before the chat history is static and doesn't change between requests + # (e.g {{random}} macro or lorebooks not as in-chat injections). + # Otherwise, you'll just waste money on cache misses. + enableSystemPromptCache: false # -- SERVER PLUGIN CONFIGURATION -- enableServerPlugins: false -# User session timeout *in seconds* (defaults to 24 hours). -## Set to a positive number to expire session after a certain time of inactivity -## Set to 0 to expire session when the browser is closed -## Set to a negative number to disable session expiration -sessionTimeout: 86400 diff --git a/default/content/presets/openai/Default.json b/default/content/presets/openai/Default.json index 6c3823086..e2345c687 100644 --- a/default/content/presets/openai/Default.json +++ b/default/content/presets/openai/Default.json @@ -1,7 +1,7 @@ { "chat_completion_source": "openai", - "openai_model": "gpt-3.5-turbo", - "claude_model": "claude-instant-v1", + "openai_model": "gpt-4-turbo", + "claude_model": "claude-3-5-sonnet-20240620", "windowai_model": "", "openrouter_model": "OR_Website", "openrouter_use_fallback": false, @@ -9,7 +9,7 @@ "openrouter_group_models": false, "openrouter_sort_models": "alphabetically", "ai21_model": "j2-ultra", - "mistralai_model": "mistral-medium-latest", + "mistralai_model": "mistral-large-latest", "custom_model": "", "custom_url": "", "custom_include_body": "", @@ -22,7 +22,7 @@ "count_penalty": 0, "top_p": 1, "top_k": 0, - "top_a": 1, + "top_a": 0, "min_p": 0, "repetition_penalty": 1, "openai_max_context": 4095, diff --git a/default/content/settings.json b/default/content/settings.json index 1a62513a3..1140accb0 100644 --- a/default/content/settings.json +++ b/default/content/settings.json @@ -610,9 +610,9 @@ } ] }, - "wi_format": "[Details of the fictional world the RP is set in:\n{0}]\n", - "openai_model": "gpt-3.5-turbo", - "claude_model": "claude-instant-v1", + "wi_format": "{0}", + "openai_model": "gpt-4-turbo", + "claude_model": "claude-3-5-sonnet-20240620", "ai21_model": "j2-ultra", "windowai_model": "", "openrouter_model": "OR_Website", diff --git a/index.d.ts b/index.d.ts index 2769df508..015d8e353 100644 --- a/index.d.ts +++ b/index.d.ts @@ -9,6 +9,11 @@ declare global { }; } } + + /** + * The root directory for user data. + */ + var DATA_ROOT: string; } declare module 'express-session' { diff --git a/package-lock.json b/package-lock.json index 3862aa21f..187efe823 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sillytavern", - "version": "1.12.4", + "version": "1.12.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "sillytavern", - "version": "1.12.4", + "version": "1.12.5", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { @@ -27,6 +27,7 @@ "google-translate-api-browser": "^3.0.1", "he": "^1.2.0", "helmet": "^7.1.0", + "iconv-lite": "^0.6.3", "ip-matching": "^2.1.2", "ipaddr.js": "^2.0.1", "jimp": "^0.22.10", @@ -42,7 +43,7 @@ "rate-limiter-flexible": "^5.0.0", "response-time": "^2.3.2", "sanitize-filename": "^1.6.3", - "sillytavern-transformers": "^2.14.6", + "sillytavern-transformers": "2.14.6", "simple-git": "^3.19.1", "tiktoken": "^1.0.15", "vectra": "^0.2.2", @@ -58,7 +59,7 @@ }, "devDependencies": { "@types/jquery": "^3.5.29", - "eslint": "^8.55.0", + "eslint": "^8.57.0", "jquery": "^3.6.4" }, "engines": { @@ -166,9 +167,9 @@ "license": "MIT" }, "node_modules/@eslint/js": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", - "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "license": "MIT", "engines": { @@ -185,14 +186,15 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "deprecated": "Use @eslint/config-array instead", "dev": true, "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -200,9 +202,9 @@ } }, "node_modules/@humanwhocodes/config-array/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", "dev": true, "license": "MIT", "dependencies": { @@ -239,9 +241,10 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", "dev": true, "license": "BSD-3-Clause" }, @@ -1490,6 +1493,18 @@ "node": ">= 0.8" } }, + "node_modules/body-parser/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -2455,17 +2470,17 @@ } }, "node_modules/eslint": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", - "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.55.0", - "@humanwhocodes/config-array": "^0.11.13", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", @@ -3280,12 +3295,12 @@ } }, "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "license": "MIT", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" + "safer-buffer": ">= 2.1.2 < 3.0.0" }, "engines": { "node": ">=0.10.0" @@ -4616,6 +4631,18 @@ "node": ">= 0.8" } }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", diff --git a/package.json b/package.json index 7ef4da6b6..93c240873 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "google-translate-api-browser": "^3.0.1", "he": "^1.2.0", "helmet": "^7.1.0", + "iconv-lite": "^0.6.3", "ip-matching": "^2.1.2", "ipaddr.js": "^2.0.1", "jimp": "^0.22.10", @@ -32,7 +33,7 @@ "rate-limiter-flexible": "^5.0.0", "response-time": "^2.3.2", "sanitize-filename": "^1.6.3", - "sillytavern-transformers": "^2.14.6", + "sillytavern-transformers": "2.14.6", "simple-git": "^3.19.1", "tiktoken": "^1.0.15", "vectra": "^0.2.2", @@ -70,7 +71,7 @@ "type": "git", "url": "https://github.com/SillyTavern/SillyTavern.git" }, - "version": "1.12.4", + "version": "1.12.5", "scripts": { "start": "node server.js", "start:no-csrf": "node server.js --disableCsrf", @@ -90,7 +91,7 @@ "main": "server.js", "devDependencies": { "@types/jquery": "^3.5.29", - "eslint": "^8.55.0", + "eslint": "^8.57.0", "jquery": "^3.6.4" } } diff --git a/public/css/character-group-overlay.css b/public/css/character-group-overlay.css index b0d4b4a14..5327694a8 100644 --- a/public/css/character-group-overlay.css +++ b/public/css/character-group-overlay.css @@ -99,6 +99,6 @@ } #bulk_tag_shadow_popup #bulk_tag_popup #dialogue_popup_controls .menu_button { - width: 100px; + width: unset; padding: 0.25em; } diff --git a/public/css/world-info.css b/public/css/world-info.css index 6aab4efcb..3da519c02 100644 --- a/public/css/world-info.css +++ b/public/css/world-info.css @@ -120,6 +120,14 @@ flex-wrap: wrap; } +.world_entry .inline-drawer-header { + cursor: initial; +} + +.world_entry .killSwitch { + cursor: pointer; +} + .world_entry_form_control input[type=button] { cursor: pointer; } @@ -173,6 +181,10 @@ width: 7em; } +.world_entry .killSwitch.fa-toggle-on { + color: var(--SmartThemeQuoteColor); +} + .wi-card-entry { border: 1px solid; border-color: var(--SmartThemeBorderColor); diff --git a/public/global.d.ts b/public/global.d.ts index 1a5ee091b..c8bfe14c2 100644 --- a/public/global.d.ts +++ b/public/global.d.ts @@ -14,6 +14,11 @@ declare var isProbablyReaderable; declare var ePub; declare var ai; +declare var SillyTavern: { + getContext(): any; + llm: any; +}; + // Jquery plugins interface JQuery { nanogallery2(options?: any): JQuery; diff --git a/public/img/blockentropy.svg b/public/img/blockentropy.svg new file mode 100644 index 000000000..fa52c3ea8 --- /dev/null +++ b/public/img/blockentropy.svg @@ -0,0 +1,3 @@ + diff --git a/public/img/step-into.svg b/public/img/step-into.svg new file mode 100644 index 000000000..fcfa7ef16 --- /dev/null +++ b/public/img/step-into.svg @@ -0,0 +1,149 @@ + + + + diff --git a/public/img/step-out.svg b/public/img/step-out.svg new file mode 100644 index 000000000..aa7dd3ea2 --- /dev/null +++ b/public/img/step-out.svg @@ -0,0 +1,149 @@ + + + + diff --git a/public/img/step-over.svg b/public/img/step-over.svg new file mode 100644 index 000000000..6f23ff22a --- /dev/null +++ b/public/img/step-over.svg @@ -0,0 +1,149 @@ + + + + diff --git a/public/img/step-resume.svg b/public/img/step-resume.svg new file mode 100644 index 000000000..bf3e0647f --- /dev/null +++ b/public/img/step-resume.svg @@ -0,0 +1,218 @@ + + + + diff --git a/public/index.html b/public/index.html index f59c28e7e..2232d558d 100644 --- a/public/index.html +++ b/public/index.html @@ -383,7 +383,7 @@ Max Response Length (tokens)