Merge branch 'staging' into enable-autoselect-inputs
This commit is contained in:
commit
321f0500e0
|
@ -55,6 +55,7 @@ module.exports = {
|
|||
isProbablyReaderable: 'readonly',
|
||||
ePub: 'readonly',
|
||||
diff_match_patch: 'readonly',
|
||||
SillyTavern: 'readonly',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -16,21 +16,21 @@ jobs:
|
|||
uses: actions/stale@v4
|
||||
with:
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 360
|
||||
days-before-close: 5
|
||||
days-before-stale: 183
|
||||
days-before-close: 7
|
||||
operations-per-run: 30
|
||||
remove-stale-when-updated: true
|
||||
enable-statistics: true
|
||||
stale-issue-message: >
|
||||
This issue has gone 3 months without an update. To keep the ticket open, please indicate that it is still relevant in a comment below.
|
||||
Otherwise it will be closed in 5 working days.
|
||||
This issue has gone 6 months without an update. To keep the ticket open, please indicate that it is still relevant in a comment below.
|
||||
Otherwise it will be closed in 7 days.
|
||||
stale-pr-message: >
|
||||
This PR is stale because it has been open 6 weeks with no activity. Either remove the stale label or comment below with a short update,
|
||||
otherwise this PR will be closed in 5 days.
|
||||
This PR is stale because it has been open 6 months with no activity. Either remove the stale label or comment below with a short update,
|
||||
otherwise this PR will be closed in 7 days.
|
||||
close-issue-message: >
|
||||
This issue was automatically closed because it has been stalled for over 1 year with no activity.
|
||||
This issue was automatically closed because it has been stalled for over 6 months with no activity.
|
||||
close-pr-message: >
|
||||
This pull request was automatically closed because it has been stalled for over 1 year with no activity.
|
||||
This pull request was automatically closed because it has been stalled for over 6 months with no activity.
|
||||
stale-issue-label: '⚰️ Stale'
|
||||
close-issue-label: '🕸️ Inactive'
|
||||
stale-pr-label: '⚰️ Stale'
|
||||
|
@ -44,8 +44,8 @@ jobs:
|
|||
uses: actions/stale@v4
|
||||
with:
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 5
|
||||
days-before-close: 3
|
||||
days-before-stale: 7
|
||||
days-before-close: 7
|
||||
operations-per-run: 30
|
||||
remove-stale-when-updated: true
|
||||
stale-issue-message: >
|
||||
|
@ -65,7 +65,7 @@ jobs:
|
|||
with:
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 7
|
||||
days-before-close: 365
|
||||
days-before-close: 183
|
||||
operations-per-run: 30
|
||||
remove-stale-when-updated: true
|
||||
stale-issue-message: Hey SillyTavern, - Don't forget to respond!
|
||||
|
@ -79,4 +79,4 @@ jobs:
|
|||
close-issue-label: '🕸️ Inactive'
|
||||
close-pr-label: '🕸️ Inactive'
|
||||
exempt-issue-labels: '📌 Keep Open'
|
||||
exempt-pr-labels: '📌 Keep Open'
|
||||
exempt-pr-labels: '📌 Keep Open'
|
||||
|
|
|
@ -29,4 +29,13 @@
|
|||
- Updating GitHub Actions.
|
||||
- Hotfixing a critical bug.
|
||||
4. Project maintainers will test and can change your code before merging.
|
||||
5. 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.
|
||||
5. Write at least somewhat meaningful PR descriptions. There's no "right" way to do it, but the following may help with outlining a general structure:
|
||||
- What is the reason for a change?
|
||||
- What did you do to achieve this?
|
||||
- How would a reviewer test the change?
|
||||
6. 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.
|
||||
|
||||
## Further reading
|
||||
|
||||
1. [How to write UI extensions](https://docs.sillytavern.app/for-contributors/writing-extensions/)
|
||||
2. [How to write server plugins](https://docs.sillytavern.app/for-contributors/server-plugins)
|
||||
|
|
|
@ -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)
|
||||
|
@ -93,10 +116,26 @@ openai:
|
|||
deepl:
|
||||
# Available options: default, more, less, prefer_more, prefer_less
|
||||
formality: default
|
||||
# -- MISTRAL API CONFIGURATION --
|
||||
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
|
||||
# * 5m: Keep the model loaded for 5 minutes after the request. Accepts duration strings (e.g. 5h30m40s)
|
||||
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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -9,6 +9,11 @@ declare global {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The root directory for user data.
|
||||
*/
|
||||
var DATA_ROOT: string;
|
||||
}
|
||||
|
||||
declare module 'express-session' {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "sillytavern",
|
||||
"version": "1.12.3",
|
||||
"version": "1.12.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sillytavern",
|
||||
"version": "1.12.3",
|
||||
"version": "1.12.4",
|
||||
"hasInstallScript": true,
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
|
@ -42,7 +42,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 +58,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^3.5.29",
|
||||
"eslint": "^8.55.0",
|
||||
"eslint": "^8.57.0",
|
||||
"jquery": "^3.6.4"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -166,9 +166,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 +185,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 +201,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 +240,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"
|
||||
},
|
||||
|
@ -1391,12 +1393,11 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz",
|
||||
"integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==",
|
||||
"license": "MIT",
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz",
|
||||
"integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
|
@ -2456,17 +2457,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",
|
||||
|
|
|
@ -32,7 +32,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 +70,7 @@
|
|||
"type": "git",
|
||||
"url": "https://github.com/SillyTavern/SillyTavern.git"
|
||||
},
|
||||
"version": "1.12.3",
|
||||
"version": "1.12.4",
|
||||
"scripts": {
|
||||
"start": "node server.js",
|
||||
"start:no-csrf": "node server.js --disableCsrf",
|
||||
|
@ -90,7 +90,7 @@
|
|||
"main": "server.js",
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^3.5.29",
|
||||
"eslint": "^8.55.0",
|
||||
"eslint": "^8.57.0",
|
||||
"jquery": "^3.6.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
height: 100svh;
|
||||
height: 100dvh;
|
||||
z-index: 9998;
|
||||
top: 0;
|
||||
}
|
||||
|
@ -99,6 +99,6 @@
|
|||
}
|
||||
|
||||
#bulk_tag_shadow_popup #bulk_tag_popup #dialogue_popup_controls .menu_button {
|
||||
width: 100px;
|
||||
width: unset;
|
||||
padding: 0.25em;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
background-color: green;
|
||||
}
|
||||
|
||||
.extensions_block input[type="checkbox"] {
|
||||
.extensions_block input[type="checkbox"],
|
||||
.extensions_block input[type="radio"] {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
z-index: 999999;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
width: 100svw;
|
||||
height: 100svh;
|
||||
width: 100dvw;
|
||||
height: 100dvh;
|
||||
background-color: var(--SmartThemeBlurTintColor);
|
||||
color: var(--SmartThemeBodyColor);
|
||||
/*for some reason the full screen blur does not work on iOS*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#logprobsViewer {
|
||||
overflow-y: auto;
|
||||
max-width: 90svw;
|
||||
max-height: 90svh;
|
||||
max-width: 90dvw;
|
||||
max-height: 90dvh;
|
||||
min-width: 100px;
|
||||
min-height: 50px;
|
||||
border-radius: 10px;
|
||||
|
@ -16,7 +16,7 @@
|
|||
top: 0;
|
||||
margin: 0;
|
||||
right: unset;
|
||||
width: calc(((100svw - var(--sheldWidth)) / 2) - 1px);
|
||||
width: calc(((100dvw - var(--sheldWidth)) / 2) - 1px);
|
||||
}
|
||||
|
||||
.logprobs_panel_header {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/*will apply to anything 1000px or less. this catches ipads, horizontal phones, and vertical phones)*/
|
||||
@media screen and (max-width: 1000px) {
|
||||
#send_form.compact #leftSendForm, #send_form.compact #rightSendForm {
|
||||
|
||||
#send_form.compact #leftSendForm,
|
||||
#send_form.compact #rightSendForm {
|
||||
flex-wrap: nowrap;
|
||||
width: unset;
|
||||
}
|
||||
|
@ -34,9 +36,9 @@
|
|||
right: 0;
|
||||
width: fit-content;
|
||||
max-height: calc(60vh - 60px);
|
||||
max-height: calc(60svh - 60px);
|
||||
max-height: calc(60dvh - 60px);
|
||||
max-width: 90vw;
|
||||
max-width: 90svw;
|
||||
max-width: 90dvw;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
|
@ -102,7 +104,7 @@
|
|||
min-width: unset;
|
||||
width: 100%;
|
||||
max-height: calc(100vh - 45px);
|
||||
max-height: calc(100svh - 45px);
|
||||
max-height: calc(100dvh - 45px);
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 5px;
|
||||
|
@ -130,15 +132,15 @@
|
|||
#top-bar {
|
||||
position: fixed;
|
||||
width: 100vw;
|
||||
width: 100svw;
|
||||
width: 100dvw;
|
||||
}
|
||||
|
||||
#bg1,
|
||||
#bg_custom {
|
||||
height: 100vh !important;
|
||||
height: 100svh !important;
|
||||
height: 100dvh !important;
|
||||
width: 100vw !important;
|
||||
width: 100svw !important;
|
||||
width: 100dvw !important;
|
||||
background-position: center;
|
||||
|
||||
}
|
||||
|
@ -146,13 +148,7 @@
|
|||
|
||||
#sheld,
|
||||
#character_popup,
|
||||
.drawer-content
|
||||
|
||||
/* ,
|
||||
#world_popup */
|
||||
{
|
||||
/*max-height: calc(100vh - 36px);
|
||||
max-height: calc(100svh - 36px);*/
|
||||
.drawer-content {
|
||||
width: 100% !important;
|
||||
margin: 0 auto;
|
||||
max-width: 100%;
|
||||
|
@ -223,10 +219,10 @@
|
|||
#floatingPrompt,
|
||||
#cfgConfig,
|
||||
#logprobsViewer,
|
||||
#movingDivs > div {
|
||||
/* 100vh are fallback units for browsers that don't support svh */
|
||||
#movingDivs>div {
|
||||
/* 100vh are fallback units for browsers that don't support dvh */
|
||||
height: calc(100vh - 45px);
|
||||
height: calc(100svh - 45px);
|
||||
height: calc(100dvh - 45px);
|
||||
min-width: 100% !important;
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
|
@ -249,7 +245,7 @@
|
|||
#floatingPrompt,
|
||||
#cfgConfig,
|
||||
#logprobsViewer,
|
||||
#movingDivs > div {
|
||||
#movingDivs>div {
|
||||
height: min-content;
|
||||
}
|
||||
|
||||
|
@ -286,9 +282,9 @@
|
|||
|
||||
body.waifuMode #sheld {
|
||||
height: 40vh;
|
||||
height: 40svh;
|
||||
height: 40dvh;
|
||||
top: 60vh;
|
||||
top: 60svh;
|
||||
top: 60dvh;
|
||||
bottom: 0 !important;
|
||||
}
|
||||
|
||||
|
@ -325,16 +321,16 @@
|
|||
body.waifuMode .zoomed_avatar {
|
||||
width: fit-content;
|
||||
max-height: calc(60vh - 60px);
|
||||
max-height: calc(60svh - 60px);
|
||||
max-height: calc(60dvh - 60px);
|
||||
max-width: 90vw;
|
||||
max-width: 90svw;
|
||||
max-width: 90dvw;
|
||||
}
|
||||
|
||||
.scrollableInner {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
max-height: calc(100vh - 90px);
|
||||
max-height: calc(100svh - 90px);
|
||||
max-height: calc(100dvh - 90px);
|
||||
}
|
||||
|
||||
.horde_multiple_hint {
|
||||
|
@ -370,9 +366,9 @@
|
|||
|
||||
body:not(.waifuMode) .zoomed_avatar {
|
||||
max-height: calc(60vh - 60px);
|
||||
max-height: calc(60svh - 60px);
|
||||
max-height: calc(60dvh - 60px);
|
||||
max-width: 90vw;
|
||||
max-width: 90svw;
|
||||
max-width: 90dvw;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
|
@ -453,9 +449,9 @@
|
|||
min-height: unset;
|
||||
max-height: unset;
|
||||
width: 100vw;
|
||||
width: 100svw;
|
||||
width: 100dvw;
|
||||
height: calc(100vh - 36px);
|
||||
height: calc(100svh - 36px);
|
||||
height: calc(100dvh - 36px);
|
||||
padding-right: max(env(safe-area-inset-right), 0px);
|
||||
padding-left: max(env(safe-area-inset-left), 0px);
|
||||
padding-bottom: 0;
|
||||
|
@ -485,10 +481,10 @@
|
|||
top: 0;
|
||||
margin: 0 auto;
|
||||
height: calc(100vh - 70px);
|
||||
height: calc(100svh - 70px);
|
||||
height: calc(100dvh - 70px);
|
||||
width: calc(100% - 5px);
|
||||
max-height: calc(100vh - 70px);
|
||||
max-height: calc(100svh - 70px);
|
||||
max-height: calc(100dvh - 70px);
|
||||
max-width: calc(100% - 5px);
|
||||
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ body.safari .popup.large_dialogue_popup .popup-body {
|
|||
body.safari .popup .popup-body {
|
||||
height: fit-content;
|
||||
max-height: 90vh;
|
||||
max-height: 90svh;
|
||||
max-height: 90dvh;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ dialog {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
max-height: calc(100svh - 2em);
|
||||
max-width: calc(100svw - 2em);
|
||||
max-height: calc(100dvh - 2em);
|
||||
max-width: calc(100dvw - 2em);
|
||||
min-height: fit-content;
|
||||
|
||||
/* Overflow visible so elements (like toasts) can appear outside of the dialog. '.popup-body' is hiding overflow for the real content. */
|
||||
|
@ -103,7 +103,7 @@ body.no-blur .popup[open]::backdrop {
|
|||
|
||||
.popup #toast-container {
|
||||
/* Fix toastr in dialogs by actually placing it at the top of the screen via transform */
|
||||
height: 100svh;
|
||||
height: 100dvh;
|
||||
top: calc(50% + var(--topBarBlockSize));
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
@ -115,7 +115,7 @@ body.no-blur .popup[open]::backdrop {
|
|||
.popup-crop-wrap {
|
||||
margin: 10px auto;
|
||||
max-height: 75vh;
|
||||
max-height: 75svh;
|
||||
max-height: 75dvh;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,20 +209,20 @@
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
.tag_as_folder {
|
||||
.tag_as_folder.right_menu_button {
|
||||
filter: brightness(75%) saturate(0.6);
|
||||
}
|
||||
|
||||
.tag_as_folder:hover,
|
||||
.tag_as_folder.flash {
|
||||
filter: brightness(150%) saturate(0.6) !important;
|
||||
.tag_as_folder.right_menu_button:hover,
|
||||
.tag_as_folder.right_menu_button.flash {
|
||||
filter: brightness(150%) saturate(0.6);
|
||||
}
|
||||
|
||||
.tag_as_folder.no_folder {
|
||||
.tag_as_folder.right_menu_button.no_folder {
|
||||
filter: brightness(25%) saturate(0.25);
|
||||
}
|
||||
|
||||
.tag_as_folder .tag_folder_indicator {
|
||||
.tag_as_folder.right_menu_button .tag_folder_indicator {
|
||||
position: absolute;
|
||||
top: calc(var(--mainFontSize) * -0.5);
|
||||
right: calc(var(--mainFontSize) * -0.5);
|
||||
|
|
|
@ -28,6 +28,10 @@ body.hideChatAvatars .mesAvatarWrapper .avatar {
|
|||
display: none !important;
|
||||
}
|
||||
|
||||
body.hideChatAvatars .last_mes {
|
||||
padding-bottom: 40px !important;
|
||||
}
|
||||
|
||||
body.square-avatars .avatar,
|
||||
body.square-avatars .avatar img {
|
||||
border-radius: var(--avatar-base-border-radius) !important;
|
||||
|
@ -360,7 +364,7 @@ body.waifuMode #top-bar {
|
|||
|
||||
body.waifuMode #sheld {
|
||||
height: 40vh;
|
||||
height: 40svh;
|
||||
height: 40dvh;
|
||||
top: calc(100% - 40vh);
|
||||
bottom: 0;
|
||||
}
|
||||
|
@ -450,4 +454,4 @@ body.expandMessageActions .mes .mes_buttons .extraMesButtonsHint {
|
|||
|
||||
#smooth_streaming:checked~#smooth_streaming_speed_control {
|
||||
display: block;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -14,8 +14,15 @@ declare var isProbablyReaderable;
|
|||
declare var ePub;
|
||||
declare var ai;
|
||||
|
||||
declare var SillyTavern: {
|
||||
getContext(): any;
|
||||
llm: any;
|
||||
};
|
||||
|
||||
// Jquery plugins
|
||||
interface JQuery {
|
||||
nanogallery2(options?: any): JQuery;
|
||||
nanogallery2(method: string, options?: any): JQuery;
|
||||
pagination(method: 'getCurrentPageNum'): number;
|
||||
pagination(method: string, options?: any): JQuery;
|
||||
pagination(options?: any): JQuery;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 236.38 282.41">
|
||||
<path d="M126.55,0v54.44l-79.87,33.76v93.95l27.53-12.94,43.08,31.09.04-.05v.09l55.21-31.44.13-.08v-80.06l-55.34,24.92v80.2l-42.55-30.7h-.02s0-81.16,0-81.16l57.02-24.11V9.23l93.54,56.12v22.51l-24.34,11.53,1.84,90.56-88.45,51.47-.13.08v34.46L5.23,198.97v-65.56H0v66.92c0,.85.41,1.64,1.11,2.14l113.13,79.91v.05l.04-.02h0s0,0,0,0l121.97-73.54.13-.08v-126.13l-5.84,2.76v-22.94h-.3l.11-.18L126.55,0Z" />
|
||||
</svg>
|
After Width: | Height: | Size: 509 B |
|
@ -0,0 +1,149 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="48"
|
||||
height="48"
|
||||
viewBox="0 0 48 48"
|
||||
version="1.1"
|
||||
id="svg2120"
|
||||
xml:space="preserve"
|
||||
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
|
||||
sodipodi:docname="step-into.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||
id="namedview2122"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:zoom="11.313708"
|
||||
inkscape:cx="58.910834"
|
||||
inkscape:cy="25.323262"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="992"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g2714" /><defs
|
||||
id="defs2117"><inkscape:path-effect
|
||||
effect="spiro"
|
||||
id="path-effect2144"
|
||||
is_visible="true"
|
||||
lpeversion="1" /><inkscape:path-effect
|
||||
effect="bspline"
|
||||
id="path-effect2138"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
weight="33.333333"
|
||||
steps="2"
|
||||
helper_size="0"
|
||||
apply_no_weight="true"
|
||||
apply_with_weight="true"
|
||||
only_selected="false" /></defs><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer4"
|
||||
inkscape:label="img"
|
||||
style="display:none"><image
|
||||
width="305.68866"
|
||||
height="70.374367"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARYAAABACAYAAADf7VgRAAAABHNCSVQICAgIfAhkiAAABdxJREFU
|
||||
eJzt3T9vo0gYBvB3by+SsZRiKCI5SCkyJS6dzny3+26UpoSSFJFMOaTyUETaK3zDAQYbzGBgeH7S
|
||||
SutN1kKj8cM7fxj/2u/3fwgAQKO/xr4AADAPggUAtEOwAIB2CBYA0A7BAgDaIVgAQDsECwBoh2AB
|
||||
AO0QLACgHYIFALRDsACAdn+PfQFw5nkeWZZFRERSSvJ9f+Qrmg7XdSnLMorjeOxLgZYQLDBpruuS
|
||||
4zj5a4TLPGAoBJNVDRXOOXHOR7wiaAvBApNUDRUF4TIPCBaYnKZQURAu04dggUm5FSoKwmXaECww
|
||||
GW1DRUG4TNfDV4VUx1mtViSEICKiLMtIStn4f4qdJ8syOh6Pw14kPFxdqAghyLKs0jI8EeWvif7v
|
||||
G1gtmpbBg8V1XbJtm4jKHYKoHBhCCIrjuDZkqr+HYDFLU6gEQUCe55X+3ff90p4fIoTLFA0WLI7j
|
||||
kOu6rX/ftm2ybZuEEBRF0dUKBsxxLVSaIFymT/scC2OMdrtdp1Apsm2bPM8jzvlFhQPmybKs9PpW
|
||||
qCi+71/cfKrvZQrXdYkxNvZldKK1YmGM0cfHR+3PhBAkpaTv728iIjqdTmTbNq1WK7Jtu3aYxBij
|
||||
KIp0XuLoXNelz8/PzhWZZVnkuq5x1ZyqMDjnrUNFKVYuURQZOUTe7XZ5NR+GIaVpOvYltaItWCzL
|
||||
qg0VNXdS1yDFf2OM0Xa7LQWMbdt3Vz5TVOwkQRC0DgjLsvK5BlPD5d5Jed/3yXEcI0OlOj+53W5n
|
||||
Ey5ahkLFjq9IKelwOFAQBK0aIk1T8n3/ooOohp27aifZ7XathnrVtjUtbJU+wWBiqBDRRWWrwqXv
|
||||
sKi40jYULRVLtaP3eTo3iiLKssy4/QlJkpSGfCpcrlUudYFNhAnKpZBSUhAEpZvQvZWLGkoXb9RS
|
||||
SkqSZJD+1Lti4ZxfVBVhGPZ6zziOjfvwpGlKYRhe3IGaKpemUDkcDrMohUEPFS59KhfOOXmed/E5
|
||||
tSwr/5nuCqZ3xfL6+lp63bXjq0naJVDhUpxLqgsXhAoU9alcGGM3q3/VB3WeAdSrYqmO1aSUnTs+
|
||||
Yyyf0Kz+MVFT5XILQmXZ7q1cmlZpqyzL6vQ4xS29KpZqtZIkSa+LWYq6yuUahIo56irRLqr95Vrl
|
||||
0nUksNlstE2EawsWKaVx8yJDahsuCBWzDLEa0xQu6/W68/vo0itYdIzJumyIMs2tcEGoQFt1/We1
|
||||
WvV+j3vhzNuRNYULQsVMfTc2Nn346/qLEKLTtg2d+4FGOzbhdDrlz3aYtIv0HtVwQaiYq0+V33W1
|
||||
UJ0U0LYS0fms1cOCpelQHjzNfKbCRf0dzqSUed9Ych+5ZwuClJLCMGy1MqQevdHl136//6Pt3Rqo
|
||||
Z2SuMfUhMoC++u5runXSngognTe0wSuWup25dd7f3/MnoAHgTMdmyTiOKUmSh27pHzRY1Jbhtr/7
|
||||
+vqKJWuA/+jcga022FWP+RzKpFaFlrK1vw5jjNbrdX4W8K1zgJdiye1S9xR734n9R7XdoMFS3Zl7
|
||||
i6nb+K+pOxyLcz7IuHdO0C7necfi8GVOq4W/397e/hnqzdfrNb28vLT+fSklfX19DXU5k8M5p+12
|
||||
W/uzp6enfGl+Lp1JF7TL2c/PD6VpSs/Pz7ML00G/V0h9vUdbSylxidrPPy3t7F+0S5maG5lTqBAN
|
||||
HCzFPQhtLGnitsspcCaeGNcE7WKGwb8Jse3ZrkKI2aVyH13mk+oOGzcV2sUMgweLmmy7Fi5dT2ef
|
||||
O3wY6qFdzPGQ5WZ1ULY6LU4dEHU8HilJkkVVKvda0vxTF2iXaXroPpYlzaFco+ae2t6hl/LhQbuY
|
||||
Y/ChENTrctrekk7mQ7uYAcEykjiOW91xl3YyH9rFDAiWEd1aMRNC9P4qlTlCu8zfQ45NgOscx6HN
|
||||
ZlOa1M6ybPF3ZLTLfCFYAEA7DIUAQDsECwBoh2ABAO0QLACgHYIFALRDsACAdggWANAOwQIA2iFY
|
||||
AEA7BAsAaIdgAQDt/gUoDXNStc/rMQAAAABJRU5ErkJggg==
|
||||
"
|
||||
id="image2132"
|
||||
x="-82"
|
||||
y="-11.9" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer5"
|
||||
inkscape:label="dot" /><g
|
||||
inkscape:label="over"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="path2637"
|
||||
cx="24"
|
||||
cy="33"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 9,24 C 9.7590836,20.626295 11.695032,17.529367 14.395314,15.369142 17.095595,13.208917 20.541953,12 24,12 c 3.458047,0 6.904405,1.208917 9.604686,3.369142 C 36.304968,17.529367 38.240916,20.626295 39,24"
|
||||
id="path2142"
|
||||
inkscape:path-effect="#path-effect2144"
|
||||
inkscape:original-d="m 9,24 c 4.959859,-3.824406 10.021901,-8.173595 15,-12 4.978099,-3.8264055 10.285024,8.398237 15,12"
|
||||
sodipodi:nodetypes="csc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 26,22 H 39 V 9"
|
||||
id="path2626"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer6"
|
||||
inkscape:label="into"
|
||||
style="display:inline"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="path2637-3"
|
||||
cx="24"
|
||||
cy="38.5"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 24,2 V 24"
|
||||
id="path2668"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 14.807612,16.994936 24,26.187324 33.192388,16.994936"
|
||||
id="path2626-8"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="g2714"
|
||||
inkscape:label="out"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="ellipse2708"
|
||||
cx="24"
|
||||
cy="38.5"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 24,29.722858 V 7.7228579"
|
||||
id="path2710"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="display:inline;fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 33.192388,14.727922 24,5.5355339 14.807612,14.727922"
|
||||
id="path2712"
|
||||
sodipodi:nodetypes="ccc" /></g></svg>
|
After Width: | Height: | Size: 6.3 KiB |
|
@ -0,0 +1,149 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="48"
|
||||
height="48"
|
||||
viewBox="0 0 48 48"
|
||||
version="1.1"
|
||||
id="svg2120"
|
||||
xml:space="preserve"
|
||||
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
|
||||
sodipodi:docname="step-out.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||
id="namedview2122"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:zoom="11.313708"
|
||||
inkscape:cx="58.910834"
|
||||
inkscape:cy="25.323262"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="992"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g2714" /><defs
|
||||
id="defs2117"><inkscape:path-effect
|
||||
effect="spiro"
|
||||
id="path-effect2144"
|
||||
is_visible="true"
|
||||
lpeversion="1" /><inkscape:path-effect
|
||||
effect="bspline"
|
||||
id="path-effect2138"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
weight="33.333333"
|
||||
steps="2"
|
||||
helper_size="0"
|
||||
apply_no_weight="true"
|
||||
apply_with_weight="true"
|
||||
only_selected="false" /></defs><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer4"
|
||||
inkscape:label="img"
|
||||
style="display:none"><image
|
||||
width="305.68866"
|
||||
height="70.374367"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARYAAABACAYAAADf7VgRAAAABHNCSVQICAgIfAhkiAAABdxJREFU
|
||||
eJzt3T9vo0gYBvB3by+SsZRiKCI5SCkyJS6dzny3+26UpoSSFJFMOaTyUETaK3zDAQYbzGBgeH7S
|
||||
SutN1kKj8cM7fxj/2u/3fwgAQKO/xr4AADAPggUAtEOwAIB2CBYA0A7BAgDaIVgAQDsECwBoh2AB
|
||||
AO0QLACgHYIFALRDsACAdn+PfQFw5nkeWZZFRERSSvJ9f+Qrmg7XdSnLMorjeOxLgZYQLDBpruuS
|
||||
4zj5a4TLPGAoBJNVDRXOOXHOR7wiaAvBApNUDRUF4TIPCBaYnKZQURAu04dggUm5FSoKwmXaECww
|
||||
GW1DRUG4TNfDV4VUx1mtViSEICKiLMtIStn4f4qdJ8syOh6Pw14kPFxdqAghyLKs0jI8EeWvif7v
|
||||
G1gtmpbBg8V1XbJtm4jKHYKoHBhCCIrjuDZkqr+HYDFLU6gEQUCe55X+3ff90p4fIoTLFA0WLI7j
|
||||
kOu6rX/ftm2ybZuEEBRF0dUKBsxxLVSaIFymT/scC2OMdrtdp1Apsm2bPM8jzvlFhQPmybKs9PpW
|
||||
qCi+71/cfKrvZQrXdYkxNvZldKK1YmGM0cfHR+3PhBAkpaTv728iIjqdTmTbNq1WK7Jtu3aYxBij
|
||||
KIp0XuLoXNelz8/PzhWZZVnkuq5x1ZyqMDjnrUNFKVYuURQZOUTe7XZ5NR+GIaVpOvYltaItWCzL
|
||||
qg0VNXdS1yDFf2OM0Xa7LQWMbdt3Vz5TVOwkQRC0DgjLsvK5BlPD5d5Jed/3yXEcI0OlOj+53W5n
|
||||
Ey5ahkLFjq9IKelwOFAQBK0aIk1T8n3/ooOohp27aifZ7XathnrVtjUtbJU+wWBiqBDRRWWrwqXv
|
||||
sKi40jYULRVLtaP3eTo3iiLKssy4/QlJkpSGfCpcrlUudYFNhAnKpZBSUhAEpZvQvZWLGkoXb9RS
|
||||
SkqSZJD+1Lti4ZxfVBVhGPZ6zziOjfvwpGlKYRhe3IGaKpemUDkcDrMohUEPFS59KhfOOXmed/E5
|
||||
tSwr/5nuCqZ3xfL6+lp63bXjq0naJVDhUpxLqgsXhAoU9alcGGM3q3/VB3WeAdSrYqmO1aSUnTs+
|
||||
Yyyf0Kz+MVFT5XILQmXZ7q1cmlZpqyzL6vQ4xS29KpZqtZIkSa+LWYq6yuUahIo56irRLqr95Vrl
|
||||
0nUksNlstE2EawsWKaVx8yJDahsuCBWzDLEa0xQu6/W68/vo0itYdIzJumyIMs2tcEGoQFt1/We1
|
||||
WvV+j3vhzNuRNYULQsVMfTc2Nn346/qLEKLTtg2d+4FGOzbhdDrlz3aYtIv0HtVwQaiYq0+V33W1
|
||||
UJ0U0LYS0fms1cOCpelQHjzNfKbCRf0dzqSUed9Ych+5ZwuClJLCMGy1MqQevdHl136//6Pt3Rqo
|
||||
Z2SuMfUhMoC++u5runXSngognTe0wSuWup25dd7f3/MnoAHgTMdmyTiOKUmSh27pHzRY1Jbhtr/7
|
||||
+vqKJWuA/+jcga022FWP+RzKpFaFlrK1vw5jjNbrdX4W8K1zgJdiye1S9xR734n9R7XdoMFS3Zl7
|
||||
i6nb+K+pOxyLcz7IuHdO0C7necfi8GVOq4W/397e/hnqzdfrNb28vLT+fSklfX19DXU5k8M5p+12
|
||||
W/uzp6enfGl+Lp1JF7TL2c/PD6VpSs/Pz7ML00G/V0h9vUdbSylxidrPPy3t7F+0S5maG5lTqBAN
|
||||
HCzFPQhtLGnitsspcCaeGNcE7WKGwb8Jse3ZrkKI2aVyH13mk+oOGzcV2sUMgweLmmy7Fi5dT2ef
|
||||
O3wY6qFdzPGQ5WZ1ULY6LU4dEHU8HilJkkVVKvda0vxTF2iXaXroPpYlzaFco+ae2t6hl/LhQbuY
|
||||
Y/ChENTrctrekk7mQ7uYAcEykjiOW91xl3YyH9rFDAiWEd1aMRNC9P4qlTlCu8zfQ45NgOscx6HN
|
||||
ZlOa1M6ybPF3ZLTLfCFYAEA7DIUAQDsECwBoh2ABAO0QLACgHYIFALRDsACAdggWANAOwQIA2iFY
|
||||
AEA7BAsAaIdgAQDt/gUoDXNStc/rMQAAAABJRU5ErkJggg==
|
||||
"
|
||||
id="image2132"
|
||||
x="-82"
|
||||
y="-11.9" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer5"
|
||||
inkscape:label="dot" /><g
|
||||
inkscape:label="over"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="path2637"
|
||||
cx="24"
|
||||
cy="33"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 9,24 C 9.7590836,20.626295 11.695032,17.529367 14.395314,15.369142 17.095595,13.208917 20.541953,12 24,12 c 3.458047,0 6.904405,1.208917 9.604686,3.369142 C 36.304968,17.529367 38.240916,20.626295 39,24"
|
||||
id="path2142"
|
||||
inkscape:path-effect="#path-effect2144"
|
||||
inkscape:original-d="m 9,24 c 4.959859,-3.824406 10.021901,-8.173595 15,-12 4.978099,-3.8264055 10.285024,8.398237 15,12"
|
||||
sodipodi:nodetypes="csc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 26,22 H 39 V 9"
|
||||
id="path2626"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer6"
|
||||
inkscape:label="into"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="path2637-3"
|
||||
cx="24"
|
||||
cy="38.5"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 24,2 V 24"
|
||||
id="path2668"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 14.807612,16.994936 24,26.187324 33.192388,16.994936"
|
||||
id="path2626-8"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="g2714"
|
||||
inkscape:label="out"
|
||||
style="display:inline"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="ellipse2708"
|
||||
cx="24"
|
||||
cy="38.5"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 24,29.722858 V 7.7228579"
|
||||
id="path2710"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="display:inline;fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 33.192388,14.727922 24,5.5355339 14.807612,14.727922"
|
||||
id="path2712"
|
||||
sodipodi:nodetypes="ccc" /></g></svg>
|
After Width: | Height: | Size: 6.3 KiB |
|
@ -0,0 +1,149 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="48"
|
||||
height="48"
|
||||
viewBox="0 0 48 48"
|
||||
version="1.1"
|
||||
id="svg2120"
|
||||
xml:space="preserve"
|
||||
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
|
||||
sodipodi:docname="step-over.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||
id="namedview2122"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:zoom="11.313708"
|
||||
inkscape:cx="58.910834"
|
||||
inkscape:cy="25.323262"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="992"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g2714" /><defs
|
||||
id="defs2117"><inkscape:path-effect
|
||||
effect="spiro"
|
||||
id="path-effect2144"
|
||||
is_visible="true"
|
||||
lpeversion="1" /><inkscape:path-effect
|
||||
effect="bspline"
|
||||
id="path-effect2138"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
weight="33.333333"
|
||||
steps="2"
|
||||
helper_size="0"
|
||||
apply_no_weight="true"
|
||||
apply_with_weight="true"
|
||||
only_selected="false" /></defs><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer4"
|
||||
inkscape:label="img"
|
||||
style="display:none"><image
|
||||
width="305.68866"
|
||||
height="70.374367"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARYAAABACAYAAADf7VgRAAAABHNCSVQICAgIfAhkiAAABdxJREFU
|
||||
eJzt3T9vo0gYBvB3by+SsZRiKCI5SCkyJS6dzny3+26UpoSSFJFMOaTyUETaK3zDAQYbzGBgeH7S
|
||||
SutN1kKj8cM7fxj/2u/3fwgAQKO/xr4AADAPggUAtEOwAIB2CBYA0A7BAgDaIVgAQDsECwBoh2AB
|
||||
AO0QLACgHYIFALRDsACAdn+PfQFw5nkeWZZFRERSSvJ9f+Qrmg7XdSnLMorjeOxLgZYQLDBpruuS
|
||||
4zj5a4TLPGAoBJNVDRXOOXHOR7wiaAvBApNUDRUF4TIPCBaYnKZQURAu04dggUm5FSoKwmXaECww
|
||||
GW1DRUG4TNfDV4VUx1mtViSEICKiLMtIStn4f4qdJ8syOh6Pw14kPFxdqAghyLKs0jI8EeWvif7v
|
||||
G1gtmpbBg8V1XbJtm4jKHYKoHBhCCIrjuDZkqr+HYDFLU6gEQUCe55X+3ff90p4fIoTLFA0WLI7j
|
||||
kOu6rX/ftm2ybZuEEBRF0dUKBsxxLVSaIFymT/scC2OMdrtdp1Apsm2bPM8jzvlFhQPmybKs9PpW
|
||||
qCi+71/cfKrvZQrXdYkxNvZldKK1YmGM0cfHR+3PhBAkpaTv728iIjqdTmTbNq1WK7Jtu3aYxBij
|
||||
KIp0XuLoXNelz8/PzhWZZVnkuq5x1ZyqMDjnrUNFKVYuURQZOUTe7XZ5NR+GIaVpOvYltaItWCzL
|
||||
qg0VNXdS1yDFf2OM0Xa7LQWMbdt3Vz5TVOwkQRC0DgjLsvK5BlPD5d5Jed/3yXEcI0OlOj+53W5n
|
||||
Ey5ahkLFjq9IKelwOFAQBK0aIk1T8n3/ooOohp27aifZ7XathnrVtjUtbJU+wWBiqBDRRWWrwqXv
|
||||
sKi40jYULRVLtaP3eTo3iiLKssy4/QlJkpSGfCpcrlUudYFNhAnKpZBSUhAEpZvQvZWLGkoXb9RS
|
||||
SkqSZJD+1Lti4ZxfVBVhGPZ6zziOjfvwpGlKYRhe3IGaKpemUDkcDrMohUEPFS59KhfOOXmed/E5
|
||||
tSwr/5nuCqZ3xfL6+lp63bXjq0naJVDhUpxLqgsXhAoU9alcGGM3q3/VB3WeAdSrYqmO1aSUnTs+
|
||||
Yyyf0Kz+MVFT5XILQmXZ7q1cmlZpqyzL6vQ4xS29KpZqtZIkSa+LWYq6yuUahIo56irRLqr95Vrl
|
||||
0nUksNlstE2EawsWKaVx8yJDahsuCBWzDLEa0xQu6/W68/vo0itYdIzJumyIMs2tcEGoQFt1/We1
|
||||
WvV+j3vhzNuRNYULQsVMfTc2Nn346/qLEKLTtg2d+4FGOzbhdDrlz3aYtIv0HtVwQaiYq0+V33W1
|
||||
UJ0U0LYS0fms1cOCpelQHjzNfKbCRf0dzqSUed9Ych+5ZwuClJLCMGy1MqQevdHl136//6Pt3Rqo
|
||||
Z2SuMfUhMoC++u5runXSngognTe0wSuWup25dd7f3/MnoAHgTMdmyTiOKUmSh27pHzRY1Jbhtr/7
|
||||
+vqKJWuA/+jcga022FWP+RzKpFaFlrK1vw5jjNbrdX4W8K1zgJdiye1S9xR734n9R7XdoMFS3Zl7
|
||||
i6nb+K+pOxyLcz7IuHdO0C7necfi8GVOq4W/397e/hnqzdfrNb28vLT+fSklfX19DXU5k8M5p+12
|
||||
W/uzp6enfGl+Lp1JF7TL2c/PD6VpSs/Pz7ML00G/V0h9vUdbSylxidrPPy3t7F+0S5maG5lTqBAN
|
||||
HCzFPQhtLGnitsspcCaeGNcE7WKGwb8Jse3ZrkKI2aVyH13mk+oOGzcV2sUMgweLmmy7Fi5dT2ef
|
||||
O3wY6qFdzPGQ5WZ1ULY6LU4dEHU8HilJkkVVKvda0vxTF2iXaXroPpYlzaFco+ae2t6hl/LhQbuY
|
||||
Y/ChENTrctrekk7mQ7uYAcEykjiOW91xl3YyH9rFDAiWEd1aMRNC9P4qlTlCu8zfQ45NgOscx6HN
|
||||
ZlOa1M6ybPF3ZLTLfCFYAEA7DIUAQDsECwBoh2ABAO0QLACgHYIFALRDsACAdggWANAOwQIA2iFY
|
||||
AEA7BAsAaIdgAQDt/gUoDXNStc/rMQAAAABJRU5ErkJggg==
|
||||
"
|
||||
id="image2132"
|
||||
x="-82"
|
||||
y="-11.9" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer5"
|
||||
inkscape:label="dot" /><g
|
||||
inkscape:label="over"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
style="display:inline"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="path2637"
|
||||
cx="24"
|
||||
cy="33"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 9,24 C 9.7590836,20.626295 11.695032,17.529367 14.395314,15.369142 17.095595,13.208917 20.541953,12 24,12 c 3.458047,0 6.904405,1.208917 9.604686,3.369142 C 36.304968,17.529367 38.240916,20.626295 39,24"
|
||||
id="path2142"
|
||||
inkscape:path-effect="#path-effect2144"
|
||||
inkscape:original-d="m 9,24 c 4.959859,-3.824406 10.021901,-8.173595 15,-12 4.978099,-3.8264055 10.285024,8.398237 15,12"
|
||||
sodipodi:nodetypes="csc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 26,22 H 39 V 9"
|
||||
id="path2626"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer6"
|
||||
inkscape:label="into"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="path2637-3"
|
||||
cx="24"
|
||||
cy="38.5"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 24,2 V 24"
|
||||
id="path2668"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 14.807612,16.994936 24,26.187324 33.192388,16.994936"
|
||||
id="path2626-8"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="g2714"
|
||||
inkscape:label="out"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="ellipse2708"
|
||||
cx="24"
|
||||
cy="38.5"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 24,29.722858 V 7.7228579"
|
||||
id="path2710"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="display:inline;fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 33.192388,14.727922 24,5.5355339 14.807612,14.727922"
|
||||
id="path2712"
|
||||
sodipodi:nodetypes="ccc" /></g></svg>
|
After Width: | Height: | Size: 6.3 KiB |
|
@ -0,0 +1,218 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="48"
|
||||
height="48"
|
||||
viewBox="0 0 48 48"
|
||||
version="1.1"
|
||||
id="svg2120"
|
||||
xml:space="preserve"
|
||||
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
|
||||
sodipodi:docname="step-resume.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||
id="namedview2122"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:zoom="11.315"
|
||||
inkscape:cx="4.7282369"
|
||||
inkscape:cy="24.259832"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="992"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer8" /><defs
|
||||
id="defs2117"><inkscape:path-effect
|
||||
effect="spiro"
|
||||
id="path-effect2144"
|
||||
is_visible="true"
|
||||
lpeversion="1" /><inkscape:path-effect
|
||||
effect="bspline"
|
||||
id="path-effect2138"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
weight="33.333333"
|
||||
steps="2"
|
||||
helper_size="0"
|
||||
apply_no_weight="true"
|
||||
apply_with_weight="true"
|
||||
only_selected="false" /></defs><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer4"
|
||||
inkscape:label="img"
|
||||
style="display:none"><image
|
||||
width="305.68866"
|
||||
height="70.374367"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARYAAABACAYAAADf7VgRAAAABHNCSVQICAgIfAhkiAAABdxJREFU
|
||||
eJzt3T9vo0gYBvB3by+SsZRiKCI5SCkyJS6dzny3+26UpoSSFJFMOaTyUETaK3zDAQYbzGBgeH7S
|
||||
SutN1kKj8cM7fxj/2u/3fwgAQKO/xr4AADAPggUAtEOwAIB2CBYA0A7BAgDaIVgAQDsECwBoh2AB
|
||||
AO0QLACgHYIFALRDsACAdn+PfQFw5nkeWZZFRERSSvJ9f+Qrmg7XdSnLMorjeOxLgZYQLDBpruuS
|
||||
4zj5a4TLPGAoBJNVDRXOOXHOR7wiaAvBApNUDRUF4TIPCBaYnKZQURAu04dggUm5FSoKwmXaECww
|
||||
GW1DRUG4TNfDV4VUx1mtViSEICKiLMtIStn4f4qdJ8syOh6Pw14kPFxdqAghyLKs0jI8EeWvif7v
|
||||
G1gtmpbBg8V1XbJtm4jKHYKoHBhCCIrjuDZkqr+HYDFLU6gEQUCe55X+3ff90p4fIoTLFA0WLI7j
|
||||
kOu6rX/ftm2ybZuEEBRF0dUKBsxxLVSaIFymT/scC2OMdrtdp1Apsm2bPM8jzvlFhQPmybKs9PpW
|
||||
qCi+71/cfKrvZQrXdYkxNvZldKK1YmGM0cfHR+3PhBAkpaTv728iIjqdTmTbNq1WK7Jtu3aYxBij
|
||||
KIp0XuLoXNelz8/PzhWZZVnkuq5x1ZyqMDjnrUNFKVYuURQZOUTe7XZ5NR+GIaVpOvYltaItWCzL
|
||||
qg0VNXdS1yDFf2OM0Xa7LQWMbdt3Vz5TVOwkQRC0DgjLsvK5BlPD5d5Jed/3yXEcI0OlOj+53W5n
|
||||
Ey5ahkLFjq9IKelwOFAQBK0aIk1T8n3/ooOohp27aifZ7XathnrVtjUtbJU+wWBiqBDRRWWrwqXv
|
||||
sKi40jYULRVLtaP3eTo3iiLKssy4/QlJkpSGfCpcrlUudYFNhAnKpZBSUhAEpZvQvZWLGkoXb9RS
|
||||
SkqSZJD+1Lti4ZxfVBVhGPZ6zziOjfvwpGlKYRhe3IGaKpemUDkcDrMohUEPFS59KhfOOXmed/E5
|
||||
tSwr/5nuCqZ3xfL6+lp63bXjq0naJVDhUpxLqgsXhAoU9alcGGM3q3/VB3WeAdSrYqmO1aSUnTs+
|
||||
Yyyf0Kz+MVFT5XILQmXZ7q1cmlZpqyzL6vQ4xS29KpZqtZIkSa+LWYq6yuUahIo56irRLqr95Vrl
|
||||
0nUksNlstE2EawsWKaVx8yJDahsuCBWzDLEa0xQu6/W68/vo0itYdIzJumyIMs2tcEGoQFt1/We1
|
||||
WvV+j3vhzNuRNYULQsVMfTc2Nn346/qLEKLTtg2d+4FGOzbhdDrlz3aYtIv0HtVwQaiYq0+V33W1
|
||||
UJ0U0LYS0fms1cOCpelQHjzNfKbCRf0dzqSUed9Ych+5ZwuClJLCMGy1MqQevdHl136//6Pt3Rqo
|
||||
Z2SuMfUhMoC++u5runXSngognTe0wSuWup25dd7f3/MnoAHgTMdmyTiOKUmSh27pHzRY1Jbhtr/7
|
||||
+vqKJWuA/+jcga022FWP+RzKpFaFlrK1vw5jjNbrdX4W8K1zgJdiye1S9xR734n9R7XdoMFS3Zl7
|
||||
i6nb+K+pOxyLcz7IuHdO0C7necfi8GVOq4W/397e/hnqzdfrNb28vLT+fSklfX19DXU5k8M5p+12
|
||||
W/uzp6enfGl+Lp1JF7TL2c/PD6VpSs/Pz7ML00G/V0h9vUdbSylxidrPPy3t7F+0S5maG5lTqBAN
|
||||
HCzFPQhtLGnitsspcCaeGNcE7WKGwb8Jse3ZrkKI2aVyH13mk+oOGzcV2sUMgweLmmy7Fi5dT2ef
|
||||
O3wY6qFdzPGQ5WZ1ULY6LU4dEHU8HilJkkVVKvda0vxTF2iXaXroPpYlzaFco+ae2t6hl/LhQbuY
|
||||
Y/ChENTrctrekk7mQ7uYAcEykjiOW91xl3YyH9rFDAiWEd1aMRNC9P4qlTlCu8zfQ45NgOscx6HN
|
||||
ZlOa1M6ybPF3ZLTLfCFYAEA7DIUAQDsECwBoh2ABAO0QLACgHYIFALRDsACAdggWANAOwQIA2iFY
|
||||
AEA7BAsAaIdgAQDt/gUoDXNStc/rMQAAAABJRU5ErkJggg==
|
||||
"
|
||||
id="image2132"
|
||||
x="-82"
|
||||
y="-11.9" /><image
|
||||
width="460"
|
||||
height="71"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcwAAABHCAYAAACK23cpAAAABHNCSVQICAgIfAhkiAAACuZJREFU
|
||||
eJzt3T9o3FgeB/Cv77aZBHInYZPD+JLF4iDxDl44ZNiAvVfNhC2vCEqxWQJpJn3MwlRXTeP0drNF
|
||||
NtfIKa5cYnVxkQMLDoztbU6GgBkwDiPOEHuOK/aK7FM0Gs3M01gzkp6+HzBknPFEkSV93z/9NLO6
|
||||
uvoLiIiIaKjfZL0BRERERcDAJCIiksDAJCIiksDAJCIiksDAJCIiksDAJCIiksDAJCIiksDAJCIi
|
||||
ksDAJCIiksDAJCIiksDAJCIiksDAJCIikvBZ1htAlIZmswlN0wAAvu+j1WplvEX5YVkWOp0OHMfJ
|
||||
elMoBYuLi8Gfj4+PM9yS8mFgEinMsiyYphm8ZmgSjY9DskSKioZlvV5HrVbLcIuoyEzTDEZxyoqB
|
||||
SaSgaFgKDE0aR6PRCI6pMocmA5NIMYPCUmBoUhKNRgOGYQD4eOyUOTQZmEQKGRWWAkOTZPm+3/O6
|
||||
zKHJwCRShGxYCgxNkmHbNlzX7fleWUNzqqtk5xaWMbuwHLx+d+Tg4vw0eH3txs2e19RPXBA1TQuW
|
||||
lHc6nb5WYFj4ouj7ft/BT8UXF5ae50HX9Z7bbQD0XOTq9ToArp6l4WzbBoC+RWQA4Lru0OuPSqYa
|
||||
mLMLy1i69yh4/f5kvycgv3nyI47evuwL0jKzLCuYPxjWmvM8D47jxIanOLDF+xiYahkUlltbW2g2
|
||||
mz3fb7VaPfesAgxNksPQzOGQ7NK9R/jLgw3MhXqiZWSaJjY2NoJhj1FDH4ZhBCvZyjZMUmbDwnKQ
|
||||
VqsV26ji8CyNUvbh2VwWLrh24ya+frCBs5N9uK+fl6q3aRgGarVa0Ksc5+ebzSZ2dnZK0+ors06n
|
||||
0/N6VFgKcT1NVY8Vy7Lgui48z8t6Uwpr1HVpUE9T0zQ8ffp0rDAVo2F5GhHLXQ8zbG5hGd88+RG3
|
||||
l2q4duNm1pszcaKXGHdQioPHtm3Yto2tra2hoViv15XsbY77f9I0DY1GQ7n94TgOdnZ2AMiHpRDu
|
||||
acb1HFTQaDRgmmbP1AYlI86dUfsvrqfp+z42NzfHaowZhgHLsnI18pHLHmaUef+Z8r1NcVBGibnJ
|
||||
uNZx+Hvi4AofrOJ7qhAnrWEYiU5CTdOCuTzLsmDbtlK9Kcdxxl7M1Wq1YJqmkmEZnf8Xv3v2NJMJ
|
||||
r4GQfW+4IS9Cc9yeZp7m2H9769atv03rH5tbWMbcH78MXkcX94QXBEVdv3ETf/rzXwEAF+en+N9/
|
||||
P0xuQ6csfEEXfN/HixcvgovhKL7vY3d3F7quY35+Pvi+rut97yvixdGyLFSrVQBApVJBtVrFwcEB
|
||||
ut0uAGBtbQ2VSgUA0O12sbu7C6B/34r9U8R9MEy73Y79/qD9IvOzRddut1GtVoP/f6VSgWEYaLfb
|
||||
V2owaZqGSqUSHHvTNu1h9MePH/e89jwPvu/3fIWvM4Zh4PLyEr7vB/uo2+3i4OAA8/PzfT876Cv6
|
||||
mb7vZ36s5raHeXF+ig/np32Lf5buPcLnX9Thvn6Os5P9jLYuXdFe4FWetmHbNjqdTqJWYRG4rgvD
|
||||
MIKLhZgbGdbTjGuIAPloqdLkxfVsxu1pip8LD0v6vo+9vb1SHU+Dhv3j6hYD/T3NJFMG0Tl2y7KC
|
||||
sM5KbucwP5yf4s2r9dhhWLEo6OsHG4Wf24ybSBfLt8cVntdShed5fUOpwxYUDArLra0tDsmVSNwc
|
||||
Wlz4DVOr1dBsNvver2ka6vV634W9jCaxejauMTzusG5acjske3F+indHDv5zdox//+sfuP67P+D3
|
||||
c70HrBimFUO0RRymffjwYTBkBCS/oNdqteDADH/put43HAsUd0gWQDAkYxhGzzBbtVrtOYkqlQrW
|
||||
1tb6fr6MYSkzJKs6MRw4zvCszDoAcQxOa99Oe0g2PFo17PpxeHjYNyUUNzwra9DvLTodM0257WFG
|
||||
ua+f482r9dhFP+b9ZzDvPytcbzN6f6Xv+4kv6GIRTNyXigb1NEcpY1jSJ+P2NOMW4sXRNC1RWUJV
|
||||
pd3THPZ7y6Knmds5zDhnJ/v46YfvcPerb/H5F/WegBS3oBSpUlD0BNvb28toS4pFhKbsScOwVEfc
|
||||
MHsS0eNl2Jxm0kanqquNk0q7IpCYK15ZWQl+f4ZhBPt7mnOahelhhv38z78PXPRTpEpBKysrwZ99
|
||||
3y/V4oGriutpxmFYqkWMyoz7Negz43qaSXswcVMgZZV2T9NxnL4Ohfi8aSpUDzPsQwF6kKOMuxI2
|
||||
LMmqM9WM6mkyLEnWoIVjV/2MMptETzNq2o2UQgbm3a++HXjP5rsjB+7r51PeIsrKoNBkWKrpqsNv
|
||||
g0It7ngRTwOSxeHYfmmFZtziK3HuT1OhAnNuYRl37z2KHW49O9nHz29fKnNv5iDiwPN9P6gjqlLV
|
||||
mnFEQ5Nhqa6rjMokvdVIPPlHtucYretLH101NEXJ0LCkZSDTUpjANO8/w+2l+JqC7uvneHek9vyf
|
||||
uH0kSnYuT3Xh1ibD8pNOp8OGFca7L9f3fdi2LbVSVpSwpHjjhmZcydCkBRDSlPvAvL1Ug3n/Wezf
|
||||
qV5fVhhW+Fg8nUTV4tlJMCj7lXmOW7hKEQvP87CzszO0chYX7MlJGppiMVaYaMRkJbeBef3Xaj5x
|
||||
w68X56dKlcYbRvZRX/V6PfOyUUR5k0bFJ8dx4LouS+OlIGloRhf1ZF08P7eBee3GzdhCBGVa1CNK
|
||||
b8m+1zRNnrxEv0qzPKIYBhTzmWVqmIbncXVdly7mkITMU07ysDYht4EZVZZFPVdhGEZpA1MUZtc0
|
||||
DcfHx8GCjbIr836JK2l31YtuWfZdWKfT6SleP6nbZ4aFpmEYmYclUJDALMOinjhJb8pVtRzeMHEr
|
||||
6IBPcx15OMmywP2CYOW0OC/y0EMpItu2p1b0fFBo5mV9Rm6LrwMfe5VvXq3j/QR6lbOzs7i4uEj9
|
||||
c9Ok63rwDEgZ4pmYZVGr1QYWxq5UKkGDI+n9dEXH/fJRt9uF53mYn5/H9va2MmE57eLr3W4X7XYb
|
||||
mqZhZmam52ERk3CVgu2Tlsse5qQX9czOzuL777/H+vr6RD4/LUlP8DLdByY7v1uv16debzJL3C+9
|
||||
srwFQSWe5020wSHzPM08yF0t2XdHDn764buJhuWTJ08m8tlpE08el1Wm+ctRj1wa971Fx/1CRTSJ
|
||||
52lOwlR7mO9P9nH09mXwOloP9s2r9Yku6hFhOTs7O7F/I23RJ8YPMukWYN4kma8VC1/y1FKdFO4X
|
||||
Kqq0a89OwlQD8+xkf2ggMiz7iUUawx5llVWZqKzkqcWZJ9wvVHR5D81czmGmrahhKXieh1arFRQx
|
||||
0HUdmqbBdV24rluqnuW4sj7R8or7hfImz6GpfGAWPSzDHMcp1TzlIGJuV7ZHVZZQ4H4hVeQ1NHO3
|
||||
6CdNKoUl9Yo+TDat9xYd9wupIo8LgZQNTIal2hzHkWpllq0wNvcLqWRQaGZVpEXJwGRYlsPm5ubQ
|
||||
cMjiAbN5wP1CKomGpud5mVX+mWqln2lIEpZsYRdbt9vF7u4ufN9HpVIJqpC4rouDgwNsb2+Xcp6O
|
||||
+0Vt0670kweHh4fQdR2Xl5eZ3hEws7q6+ktm/3rKkvYs817ph4iI8kOZVbKi3B0REdEkKNXDJCIi
|
||||
mhQlF/0QERGljYFJREQkgYFJREQkgYFJREQkgYFJREQkgYFJREQkgYFJREQkgYFJREQkgYFJREQk
|
||||
4bPFxcWst4GIiCj32MMkIiKSMHPnzh3WkiUiIhqBPUwiIiIJDEwiIiIJDEwiIiIJ/weH8+Ed/xCz
|
||||
fAAAAABJRU5ErkJggg==
|
||||
"
|
||||
id="image2845"
|
||||
x="-15.489594"
|
||||
y="-8.2945251" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer5"
|
||||
inkscape:label="dot" /><g
|
||||
inkscape:label="over"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="path2637"
|
||||
cx="24"
|
||||
cy="33"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 9,24 C 9.7590836,20.626295 11.695032,17.529367 14.395314,15.369142 17.095595,13.208917 20.541953,12 24,12 c 3.458047,0 6.904405,1.208917 9.604686,3.369142 C 36.304968,17.529367 38.240916,20.626295 39,24"
|
||||
id="path2142"
|
||||
inkscape:path-effect="#path-effect2144"
|
||||
inkscape:original-d="m 9,24 c 4.959859,-3.824406 10.021901,-8.173595 15,-12 4.978099,-3.8264055 10.285024,8.398237 15,12"
|
||||
sodipodi:nodetypes="csc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 26,22 H 39 V 9"
|
||||
id="path2626"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer6"
|
||||
inkscape:label="into"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="path2637-3"
|
||||
cx="24"
|
||||
cy="38.5"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 24,2 V 24"
|
||||
id="path2668"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 14.807612,16.994936 24,26.187324 33.192388,16.994936"
|
||||
id="path2626-8"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="g2714"
|
||||
inkscape:label="out"
|
||||
style="display:none"><ellipse
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5.27982;stroke-dasharray:none"
|
||||
id="ellipse2708"
|
||||
cx="24"
|
||||
cy="38.5"
|
||||
rx="4.3600898"
|
||||
ry="4.3600893" /><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 24,29.722858 V 7.7228579"
|
||||
id="path2710"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="display:inline;fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 33.192388,14.727922 24,5.5355339 14.807612,14.727922"
|
||||
id="path2712"
|
||||
sodipodi:nodetypes="ccc" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer8"
|
||||
inkscape:label="resume"><path
|
||||
style="fill:#000000;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 13,12 V 38"
|
||||
id="path2850"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="fill:none;stroke:#000000;stroke-width:5;stroke-dasharray:none"
|
||||
d="M 21,16 V 34 L 36.5,25 Z"
|
||||
id="path2852"
|
||||
sodipodi:nodetypes="cccc" /></g></svg>
|
After Width: | Height: | Size: 11 KiB |
|
@ -383,7 +383,7 @@
|
|||
Max Response Length (tokens)
|
||||
</div>
|
||||
<div class="wide100p">
|
||||
<input type="number" id="openai_max_tokens" name="openai_max_tokens" class="text_pole" min="50" max="8000">
|
||||
<input type="number" id="openai_max_tokens" name="openai_max_tokens" class="text_pole" min="1" max="16384">
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block" data-source="openai,custom">
|
||||
|
@ -1273,7 +1273,7 @@
|
|||
<input class="neo-range-slider" type="range" id="max_tokens_second_textgenerationwebui" name="volume" min="0" max="20" step="1" />
|
||||
<input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="max_tokens_second_textgenerationwebui" id="max_tokens_second_counter_textgenerationwebui">
|
||||
</div>
|
||||
<div data-newbie-hidden data-tg-type="mancer, ooba, koboldcpp, aphrodite, tabby" name="smoothingBlock" class="wide100p">
|
||||
<div data-newbie-hidden data-tg-type="mancer, ooba, koboldcpp, aphrodite, tabby" id="smoothingBlock" name="smoothingBlock" class="wide100p">
|
||||
<h4 class="wide100p textAlignCenter">
|
||||
<label data-i18n="Smooth Sampling">Smooth Sampling</label>
|
||||
<div class=" fa-solid fa-circle-info opacity50p " data-i18n="[title]Smooth_Sampling_desc" title="Allows you to use quadratic/cubic transformations to adjust the distribution. Lower Smoothing Factor values will be more creative, usually between 0.2-0.3 is the sweetspot (assuming the curve = 1). Higher Smoothing Curve values will make the curve steeper, which will punish low probability choices more aggressively. 1.0 curve is equivalent to only using Smoothing Factor."></div>
|
||||
|
@ -1358,7 +1358,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-newbie-hidden id="mirostat_block_ooba" class="wide100p">
|
||||
<div data-newbie-hidden data-tg-type="ooba,aphrodite,infermaticai,koboldcpp,llamacpp,mancer,ollama,tabby" id="mirostat_block_ooba" class="wide100p">
|
||||
<h4 class="wide100p textAlignCenter">
|
||||
<label data-i18n="Mirostat (mode=1 is only for llama.cpp)">Mirostat</label>
|
||||
<div class=" fa-solid fa-circle-info opacity50p " data-i18n="[title]Mirostat_desc" title="Mirostat is a thermostat for output perplexity. Mirostat matches the output perplexity to that of the input, thus avoiding the repetition trap (where, as the autoregressive inference produces text, the perplexity of the output tends toward zero) and the confusion trap (where the perplexity diverges). For details, see the paper Mirostat: A Neural Text Decoding Algorithm that Directly Controls Perplexity by Basu et al. (2020). Mode chooses the Mirostat version. 0=disable, 1=Mirostat 1.0 (llama.cpp only), 2=Mirostat 2.0."></div>
|
||||
|
@ -1387,7 +1387,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-newbie-hidden data-tg-type="ooba, vllm" name="beamSearchBlock" class="wide100p">
|
||||
<div data-newbie-hidden data-tg-type="ooba, vllm" id="beamSearchBlock" name="beamSearchBlock" class="wide100p">
|
||||
<h4 class="wide100p textAlignCenter">
|
||||
<label>
|
||||
<span data-i18n="Beam search">Beam Search</span>
|
||||
|
@ -1413,7 +1413,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-tg-type="ooba" data-newbie-hidden name="contrastiveSearchBlock" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
|
||||
<div data-tg-type="ooba" data-newbie-hidden id="contrastiveSearchBlock" name="contrastiveSearchBlock" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
|
||||
<h4 class="textAlignCenter" data-i18n="Contrastive search">Contrastive Search
|
||||
<div class=" fa-solid fa-circle-info opacity50p " data-i18n="Contrastive_search_txt" title="A sampler that encourages diversity while maintaining coherence, by exploiting the isotropicity of the representation space of most LLMs. For details, see the paper A Contrastive Framework for Neural Text Generation by Su et al. (2022)."></div>
|
||||
</h4>
|
||||
|
@ -1544,7 +1544,7 @@
|
|||
<h4 class="wide100p textAlignCenter">
|
||||
<label>
|
||||
<span data-i18n="Grammar String">Grammar String</span>
|
||||
<div class="margin5 fa-solid fa-circle-info opacity50p " data-i18n="[title]GNBF or ENBF, depends on the backend in use. If you're using this you should know which." title="GNBF or ENBF, depends on the backend in use. If you're using this you should know which."></div>
|
||||
<div class="margin5 fa-solid fa-circle-info opacity50p " data-i18n="[title]GBNF or EBNF, depends on the backend in use. If you're using this you should know which." title="GBNF or EBNF, depends on the backend in use. If you're using this you should know which."></div>
|
||||
<a href="https://github.com/ggerganov/llama.cpp/blob/master/grammars/README.md" target="_blank">
|
||||
<small>
|
||||
<div class="fa-solid fa-up-right-from-square note-link-span"></div>
|
||||
|
@ -1554,13 +1554,13 @@
|
|||
</h4>
|
||||
<textarea id="grammar_string_textgenerationwebui" rows="4" class="text_pole textarea_compact monospace" data-i18n="[placeholder]Type in the desired custom grammar" placeholder="Type in the desired custom grammar"></textarea>
|
||||
</div>
|
||||
<div id="sampler_order_block" data-newbie-hidden data-tg-type="koboldcpp" class="range-block flexFlowColumn wide100p">
|
||||
<div id="sampler_order_block_kcpp" data-newbie-hidden data-tg-type="koboldcpp" class="range-block flexFlowColumn wide100p">
|
||||
<hr class="wide100p">
|
||||
<div class="range-block-title">
|
||||
<span data-i18n="Samplers Order">Samplers Order</span>
|
||||
</div>
|
||||
<div class="toggle-description widthUnset" data-i18n="Samplers will be applied in a top-down order. Use with caution.">
|
||||
Samplers will be applied in a top-down order.
|
||||
kcpp only. Samplers will be applied in a top-down order.
|
||||
Use with caution.
|
||||
</div>
|
||||
<div id="koboldcpp_order" class="prompt_order">
|
||||
|
@ -1597,10 +1597,10 @@
|
|||
<span data-i18n="Load default order">Load default order</span>
|
||||
</div>
|
||||
</div>
|
||||
<div data-newbie-hidden data-tg-type="llamacpp" class="range-block flexFlowColumn wide100p">
|
||||
<div id="sampler_order_block_lcpp" data-newbie-hidden data-tg-type="llamacpp" class="range-block flexFlowColumn wide100p">
|
||||
<hr class="wide100p">
|
||||
<h4 class="range-block-title justifyCenter">
|
||||
<span data-i18n="Samplers Order">Samplers Order</span>
|
||||
<span data-i18n="Sampler Order">Sampler Order</span>
|
||||
<div class="margin5 fa-solid fa-circle-info opacity50p" data-i18n="[title]llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored." title="llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored."></div>
|
||||
</h4>
|
||||
<div class="toggle-description widthUnset" data-i18n="llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.">
|
||||
|
@ -1618,7 +1618,7 @@
|
|||
<span data-i18n="Load default order">Load default order</span>
|
||||
</div>
|
||||
</div>
|
||||
<div data-newbie-hidden data-tg-type="ooba" class="range-block flexFlowColumn wide100p">
|
||||
<div id="sampler_priority_block_ooba" data-newbie-hidden data-tg-type="ooba" class="range-block flexFlowColumn wide100p">
|
||||
<hr class="wide100p">
|
||||
<h4 class="range-block-title justifyCenter">
|
||||
<span data-i18n="Sampler Priority">Sampler Priority</span>
|
||||
|
@ -1660,16 +1660,24 @@
|
|||
</div>
|
||||
<div class="inline-drawer-content">
|
||||
<label class="checkbox_label flexWrap alignItemsCenter" for="character_names_none">
|
||||
<input type="radio" id="character_names_none" name="character_names" value="0">
|
||||
<input type="radio" id="character_names_none" name="character_names" value="-1">
|
||||
<span data-i18n="None">None</span>
|
||||
<i class="right_menu_button fa-solid fa-circle-exclamation" title="Except for groups and past personas. Otherwise, make sure you provide names in the prompt." data-i18n="[title]character_names_none"></i>
|
||||
<small class="flexBasis100p" data-i18n="Don't add character names.">
|
||||
Don't add character names.
|
||||
<i class="right_menu_button fa-solid fa-circle-exclamation" title="Never add character name prefixes. May behave poorly in groups, choose with caution." data-i18n="[title]character_names_none"></i>
|
||||
<small class="flexBasis100p" data-i18n="Never add character names.">
|
||||
Never add character names.
|
||||
</small>
|
||||
</label>
|
||||
<label class="checkbox_label flexWrap alignItemsCenter" for="character_names_default">
|
||||
<input type="radio" id="character_names_default" name="character_names" value="0">
|
||||
<span data-i18n="Default">Default</span>
|
||||
<i class="right_menu_button fa-solid fa-circle-exclamation" title="Add prefixes for groups and past personas. Otherwise, make sure you provide names in the prompt." data-i18n="[title]character_names_default"></i>
|
||||
<small class="flexBasis100p" data-i18n="Don't add character names unless necessary.">
|
||||
Don't add character names unless necessary.
|
||||
</small>
|
||||
</label>
|
||||
<label class="checkbox_label flexWrap alignItemsCenter" for="character_names_completion">
|
||||
<input type="radio" id="character_names_completion" name="character_names" value="1">
|
||||
<span data-i18n="Completion">Completion Object</span>
|
||||
<span data-i18n="Completion Object">Completion Object</span>
|
||||
<i class="right_menu_button fa-solid fa-circle-exclamation" title="Restrictions apply: only Latin alphanumerics and underscores. Doesn't work for all sources, notably: Claude, MistralAI, Google." data-i18n="[title]character_names_completion"></i>
|
||||
<small class="flexBasis100p" data-i18n="Add character names to completion objects.">
|
||||
Add character names to completion objects.
|
||||
|
@ -1762,13 +1770,13 @@
|
|||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="range-block" data-source="openai,openrouter,makersuite,claude,custom">
|
||||
<div class="range-block" data-source="openai,openrouter,makersuite,claude,custom,01ai">
|
||||
<label for="openai_image_inlining" class="checkbox_label flexWrap widthFreeExpand">
|
||||
<input id="openai_image_inlining" type="checkbox" />
|
||||
<span data-i18n="Send inline images">Send inline images</span>
|
||||
<div id="image_inlining_hint" class="flexBasis100p toggle-description justifyLeft">
|
||||
<span data-i18n="image_inlining_hint_1">Sends images in prompts if the model supports it (e.g. GPT-4V, Claude 3 or Llava 13B).
|
||||
Use the</span> <code><i class="fa-solid fa-paperclip"></i></code> <span data-i18n="image_inlining_hint_2">action on any message or the</span>
|
||||
Use the</span> <code><i class="fa-solid fa-paperclip"></i></code> <span data-i18n="image_inlining_hint_2">action on any message or the</span>
|
||||
<code><i class="fa-solid fa-wand-magic-sparkles"></i></code> <span data-i18n="image_inlining_hint_3">menu to attach an image file to the chat.</span>
|
||||
</div>
|
||||
</label>
|
||||
|
@ -1815,10 +1823,16 @@
|
|||
</div>
|
||||
<div data-newbie-hidden class="range-block" data-source="claude">
|
||||
<div class="wide100p">
|
||||
<span id="claude_assistant_prefill_text" data-i18n="Assistant Prefill">Assistant Prefill</span>
|
||||
<textarea id="claude_assistant_prefill" class="text_pole textarea_compact" name="assistant_prefill autoSetHeight" rows="3" maxlength="10000" data-i18n="[placeholder]Start Claude's answer with..." placeholder="Start Claude's answer with..."></textarea>
|
||||
<span id="claude_assistant_impersonation_text" data-i18n="Assistant Impersonation Prefill">Assistant Impersonation Prefill</span>
|
||||
<textarea id="claude_assistant_impersonation" class="text_pole textarea_compact" name="assistant_impersonation autoSetHeight" rows="3" maxlength="10000" data-i18n="[placeholder]Start Claude's answer with..." placeholder="Start Claude's answer with..."></textarea>
|
||||
<div class="flex-container alignItemsCenter">
|
||||
<span id="claude_assistant_prefill_text" data-i18n="Assistant Prefill">Assistant Prefill</span>
|
||||
<i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="claude_assistant_prefill" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
|
||||
</div>
|
||||
<textarea id="claude_assistant_prefill" class="text_pole textarea_compact" name="assistant_prefill" rows="6" maxlength="100000" data-i18n="[placeholder]Start Claude's answer with..." placeholder="Start Claude's answer with..."></textarea>
|
||||
<div class="flex-container alignItemsCenter">
|
||||
<span id="claude_assistant_impersonation_text" data-i18n="Assistant Impersonation Prefill">Assistant Impersonation Prefill</span>
|
||||
<i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="claude_assistant_impersonation" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
|
||||
</div>
|
||||
<textarea id="claude_assistant_impersonation" class="text_pole textarea_compact" name="assistant_impersonation" rows="6" maxlength="100000" data-i18n="[placeholder]Start Claude's answer with..." placeholder="Start Claude's answer with..."></textarea>
|
||||
</div>
|
||||
<label for="claude_use_sysprompt" class="checkbox_label widthFreeExpand">
|
||||
<input id="claude_use_sysprompt" type="checkbox" />
|
||||
|
@ -2419,6 +2433,7 @@
|
|||
<optgroup>
|
||||
<option value="01ai">01.AI (Yi)</option>
|
||||
<option value="ai21">AI21</option>
|
||||
<option value="blockentropy">Block Entropy</option>
|
||||
<option value="claude">Claude</option>
|
||||
<option value="cohere">Cohere</option>
|
||||
<option value="groq">Groq</option>
|
||||
|
@ -2562,7 +2577,9 @@
|
|||
</optgroup>
|
||||
<optgroup label="GPT-4o">
|
||||
<option value="gpt-4o">gpt-4o</option>
|
||||
<option value="gpt-4o-2024-08-06">gpt-4o-2024-08-06</option>
|
||||
<option value="gpt-4o-2024-05-13">gpt-4o-2024-05-13</option>
|
||||
<option value="chatgpt-4o-latest">chatgpt-4o-latest</option>
|
||||
</optgroup>
|
||||
<optgroup label="gpt-4o-mini">
|
||||
<option value="gpt-4o-mini">gpt-4o-mini</option>
|
||||
|
@ -2794,21 +2811,26 @@
|
|||
<div>
|
||||
<h4 data-i18n="Google Model">Google Model</h4>
|
||||
<select id="model_google_select">
|
||||
<optgroup label="Latest">
|
||||
<!-- Doesn't work without "latest". Maybe my key is scuffed? -->
|
||||
<option value="gemini-1.5-flash-latest">Gemini 1.5 Flash</option>
|
||||
<!-- Points to 1.0, no default 1.5 endpoint -->
|
||||
<option value="gemini-pro">Gemini Pro</option>
|
||||
<option value="gemini-pro-vision">Gemini Pro Vision</option>
|
||||
<option value="gemini-ultra">Gemini Ultra</option>
|
||||
<option value="text-bison-001">Bison Text</option>
|
||||
<option value="chat-bison-001">Bison Chat</option>
|
||||
</optgroup>
|
||||
<optgroup label="Sub-versions">
|
||||
<option value="gemini-1.5-pro-latest">Gemini 1.5 Pro</option>
|
||||
<option value="gemini-1.0-pro-latest">Gemini 1.0 Pro</option>
|
||||
<option value="gemini-1.0-pro-vision-latest">Gemini 1.0 Pro Vision</option>
|
||||
<optgroup label="Primary">
|
||||
<option value="gemini-1.5-pro">Gemini 1.5 Pro</option>
|
||||
<option value="gemini-1.5-flash">Gemini 1.5 Flash</option>
|
||||
<option value="gemini-1.0-pro">Gemini 1.0 Pro</option>
|
||||
<option value="gemini-pro">Gemini Pro (1.0)</option>
|
||||
<option value="gemini-pro-vision">Gemini Pro Vision (1.0)</option>
|
||||
<option value="gemini-ultra">Gemini Ultra (1.0)</option>
|
||||
<option value="gemini-1.0-ultra-latest">Gemini 1.0 Ultra</option>
|
||||
<option value="text-bison-001">PaLM 2 (Legacy)</option>
|
||||
<option value="chat-bison-001">PaLM 2 Chat (Legacy)</option>
|
||||
</optgroup>
|
||||
<optgroup label="Subversions">
|
||||
<option value="gemini-1.5-pro-exp-0801">Gemini 1.5 Pro Experiment 2024-08-01</option>
|
||||
<option value="gemini-1.5-pro-latest">Gemini 1.5 Pro [latest]</option>
|
||||
<option value="gemini-1.5-pro-001">Gemini 1.5 Pro [001]</option>
|
||||
<option value="gemini-1.5-flash-latest">Gemini 1.5 Flash [latest]</option>
|
||||
<option value="gemini-1.5-flash-001">Gemini 1.5 Flash [001]</option>
|
||||
<option value="gemini-1.0-pro-latest">Gemini 1.0 Pro [latest]</option>
|
||||
<option value="gemini-1.0-pro-001">Gemini 1.0 Pro (Tuning) [001]</option>
|
||||
<option value="gemini-1.0-pro-vision-latest">Gemini 1.0 Pro Vision [latest]</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -2845,6 +2867,7 @@
|
|||
<option value="mistral-small-2402">mistral-small-2402</option>
|
||||
<option value="mistral-medium-2312">mistral-medium-2312</option>
|
||||
<option value="mistral-large-2402">mistral-large-2402</option>
|
||||
<option value="mistral-large-2407">mistral-large-2407</option>
|
||||
<option value="codestral-2405">codestral-2405</option>
|
||||
<option value="codestral-mamba-2407">codestral-mamba-2407</option>
|
||||
</optgroup>
|
||||
|
@ -2885,7 +2908,20 @@
|
|||
</div>
|
||||
<h4 data-i18n="Perplexity Model">Perplexity Model</h4>
|
||||
<select id="model_perplexity_select">
|
||||
<optgroup label="Perplexity Models">
|
||||
<optgroup label="Perplexity Sonar Models">
|
||||
<option value="llama-3.1-sonar-small-128k-online">llama-3.1-sonar-small-128k-online</option>
|
||||
<option value="llama-3.1-sonar-large-128k-online">llama-3.1-sonar-large-128k-online</option>
|
||||
<option value="llama-3.1-sonar-huge-128k-online">llama-3.1-sonar-huge-128k-online</option>
|
||||
</optgroup>
|
||||
<optgroup label="Perplexity Chat Models">
|
||||
<option value="llama-3.1-sonar-small-128k-chat">llama-3.1-sonar-small-128k-chat</option>
|
||||
<option value="llama-3.1-sonar-large-128k-chat">llama-3.1-sonar-large-128k-chat</option>
|
||||
</optgroup>
|
||||
<optgroup label="Open-Source Models">
|
||||
<option value="llama-3.1-8b-instruct">llama-3.1-8b-instruct</option>
|
||||
<option value="llama-3.1-70b-instruct">llama-3.1-70b-instruct</option>
|
||||
</optgroup>
|
||||
<optgroup label="Deprecated Models">
|
||||
<option value="llama-3-sonar-small-32k-chat">llama-3-sonar-small-32k-chat</option>
|
||||
<option value="llama-3-sonar-small-32k-online">llama-3-sonar-small-32k-online</option>
|
||||
<option value="llama-3-sonar-large-32k-chat">llama-3-sonar-large-32k-chat</option>
|
||||
|
@ -2894,8 +2930,6 @@
|
|||
<option value="sonar-small-online">sonar-small-online</option>
|
||||
<option value="sonar-medium-chat">sonar-medium-chat</option>
|
||||
<option value="sonar-medium-online">sonar-medium-online</option>
|
||||
</optgroup>
|
||||
<optgroup label="Open-Source Models">
|
||||
<option value="llama-3-8b-instruct">llama-3-8b-instruct</option>
|
||||
<option value="llama-3-70b-instruct">llama-3-70b-instruct</option>
|
||||
<option value="mistral-7b-instruct">mistral-7b-instruct (v0.2)</option>
|
||||
|
@ -2929,6 +2963,20 @@
|
|||
</select>
|
||||
</div>
|
||||
</form>
|
||||
<form id="blockentropy_form" data-source="blockentropy">
|
||||
<h4 data-i18n="Block Entropy API Key">Block Entropy API Key</h4>
|
||||
<div class="flex-container">
|
||||
<input id="api_key_blockentropy" name="api_key_blockentropy" class="text_pole flex1" maxlength="500" value="" type="text" autocomplete="off">
|
||||
<div title="Clear your API key" data-i18n="[title]Clear your API key" class="menu_button fa-solid fa-circle-xmark clear-api-key" data-key="api_key_blockentropy"></div>
|
||||
</div>
|
||||
<div data-for="api_key_blockentropy" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you reload the page.">
|
||||
For privacy reasons, your API key will be hidden after you reload the page.
|
||||
</div>
|
||||
<h4 data-i18n="Select a Model">Select a Model</h4>
|
||||
<div class="flex-container">
|
||||
<select id="model_blockentropy_select" class="text_pole"></select>
|
||||
</div>
|
||||
</form>
|
||||
<form id="custom_form" data-source="custom">
|
||||
<h4 data-i18n="Custom Endpoint (Base URL)">Custom Endpoint (Base URL)</h4>
|
||||
<div class="flex-container">
|
||||
|
@ -3060,7 +3108,11 @@
|
|||
</div>
|
||||
<label class="checkbox_label" title="Add Chat Start and Example Separator to a list of stopping strings." data-i18n="[title]Add Chat Start and Example Separator to a list of stopping strings.">
|
||||
<input id="context_use_stop_strings" type="checkbox" />
|
||||
<small data-i18n="Use as Stop Strings">Use as Stop Strings</small>
|
||||
<small data-i18n="Separators as Stop Strings">Separators as Stop Strings</small>
|
||||
</label>
|
||||
<label class="checkbox_label" title="Add Character and User names to a list of stopping strings." data-i18n="[title]Add Character and User names to a list of stopping strings.">
|
||||
<input id="context_names_as_stop_strings" type="checkbox" />
|
||||
<small data-i18n="Names as Stop Strings">Names as Stop Strings</small>
|
||||
</label>
|
||||
<label class="checkbox_label" title="Includes Post-History Instructions at the end of the prompt, if defined in the character card AND ''Prefer Char. Instructions'' is enabled. THIS IS NOT RECOMMENDED FOR TEXT COMPLETION MODELS, CAN LEAD TO BAD OUTPUT." data-i18n="[title]context_allow_post_history_instructions">
|
||||
<input id="context_allow_jailbreak" type="checkbox" />
|
||||
|
@ -3287,6 +3339,24 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-container">
|
||||
<div class="flex1" title="Inserted before the first User's message." data-i18n="[title]Inserted before the first User's message.">
|
||||
<label for="instruct_first_input_sequence">
|
||||
<small data-i18n="First User Prefix">First User Prefix</small>
|
||||
</label>
|
||||
<div>
|
||||
<textarea id="instruct_first_input_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex1" title="Inserted before the last User's message." data-i18n="[title]instruct_last_input_sequence">
|
||||
<label for="instruct_last_input_sequence">
|
||||
<small data-i18n="Last User Prefix">Last User Prefix</small>
|
||||
</label>
|
||||
<div>
|
||||
<textarea id="instruct_last_input_sequence" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-container">
|
||||
<div class="flex1" title="Will be inserted as a last prompt line when using system/neutral generation." data-i18n="[title]Will be inserted as a last prompt line when using system/neutral generation.">
|
||||
<label for="instruct_last_system_sequence">
|
||||
|
@ -3379,6 +3449,7 @@
|
|||
<!-- Option #2 was a legacy GPT-2/3 tokenizer -->
|
||||
<option value="3">Llama 1/2</option>
|
||||
<option value="12">Llama 3</option>
|
||||
<option value="13">Gemma / Gemini</option>
|
||||
<option value="4">NerdStash (NovelAI Clio)</option>
|
||||
<option value="5">NerdStash v2 (NovelAI Kayra)</option>
|
||||
<option value="7">Mistral</option>
|
||||
|
@ -3635,8 +3706,8 @@
|
|||
<div id="OpenAllWIEntries" class="menu_button fa-solid fa-expand" title="Open all Entries" data-i18n="[title]Open all Entries"></div>
|
||||
<div id="CloseAllWIEntries" class="menu_button fa-solid fa-compress" title="Close all Entries" data-i18n="[title]Close all Entries"></div>
|
||||
<div id="world_popup_new" class="menu_button fa-solid fa-plus" title="New Entry" data-i18n="[title]New Entry"></div>
|
||||
<div id="world_backfill_memos" class="menu_button fa-solid fa-notes-medical" title="Fill empty Memo/Titles with Keywords" data-i18n="[title]Fill empty Memo/Titles with Keywords"></div><div id="world_apply_custom_sorting" class="menu_button fa-solid fa-solid fa-arrow-down-9-1"
|
||||
title="Apply custom sorting as Order" data-i18n="[title]Apply custom sorting as Order"></div>
|
||||
<div id="world_backfill_memos" class="menu_button fa-solid fa-notes-medical" title="Fill empty Memo/Titles with Keywords" data-i18n="[title]Fill empty Memo/Titles with Keywords"></div>
|
||||
<div id="world_apply_current_sorting" class="menu_button fa-solid fa-solid fa-arrow-down-9-1" title="Apply current sorting as Order" data-i18n="[title]Apply current sorting as Order"></div>
|
||||
<div id="world_import_button" class="menu_button fa-solid fa-file-import" title="Import World Info" data-i18n="[title]Import World Info"></div>
|
||||
<div id="world_popup_export" class="menu_button fa-solid fa-file-export" title="Export World Info" data-i18n="[title]Export World Info"></div>
|
||||
<div id="world_duplicate" class="menu_button fa-solid fa-paste" title="Duplicate World Info" data-i18n="[title]Duplicate World Info"></div>
|
||||
|
@ -3999,7 +4070,7 @@
|
|||
<input type="range" id="smooth_streaming_speed" name="smooth_streaming_speed" min="0" max="100" step="10" value="50">
|
||||
<div class="slider_hint">
|
||||
<span data-i18n="Slow">Slow</span>
|
||||
<span data-i18n=""></span>
|
||||
<span></span>
|
||||
<span data-i18n="Fast">Fast</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4031,21 +4102,23 @@
|
|||
<input id="restore_user_input" type="checkbox" />
|
||||
<small data-i18n="Restore User Input">Restore User Input</small>
|
||||
</label>
|
||||
<label data-newbie-hidden id="movingUIModeCheckBlock" for="movingUImode" class="checkbox_label" title="Allow repositioning certain UI elements by dragging them. PC only, no effect on mobile." data-i18n="[title]Allow repositioning certain UI elements by dragging them. PC only, no effect on mobile">
|
||||
<input id="movingUImode" type="checkbox" />
|
||||
<small data-i18n="Movable UI Panels">MovingUI <i class="fa-solid fa-desktop"></i></small>
|
||||
</label>
|
||||
<div class="flex-container alignItemsCenter">
|
||||
<label data-newbie-hidden id="movingUIModeCheckBlock" for="movingUImode" class="checkbox_label" title="Allow repositioning certain UI elements by dragging them. PC only, no effect on mobile." data-i18n="[title]Allow repositioning certain UI elements by dragging them. PC only, no effect on mobile">
|
||||
<input id="movingUImode" type="checkbox" />
|
||||
<small data-i18n="Movable UI Panels">MovingUI <i class="fa-solid fa-desktop"></i></small>
|
||||
</label>
|
||||
<div data-newbie-hidden id="movingUIreset" title="Reset MovingUI panel sizes/locations." class="menu_button margin0" data-i18n="[title]Reset MovingUI panel sizes/locations."><i class=" fa-solid fa-recycle margin-r5"></i> Reset</div>
|
||||
</div>
|
||||
<div data-newbie-hidden id="MovingUI-presets-block" class="flex-container alignitemscenter">
|
||||
<div class="flex-container alignItemsFlexEnd">
|
||||
<label for="movingUIPresets" title="MovingUI preset. Predefined/saved draggable positions." data-i18n="[title]MovingUI preset. Predefined/saved draggable positions">
|
||||
<small data-i18n="MUI Preset">MUI Preset:</small>
|
||||
<small data-i18n="MUI Preset">MovingUI Preset:</small>
|
||||
<div class="flex-container flexnowrap">
|
||||
<select id="movingUIPresets" class="widthNatural flex1 margin0">
|
||||
</select>
|
||||
</div>
|
||||
</label>
|
||||
<div id="movingui-preset-save-button" title="Save changes to a new MovingUI preset file." data-i18n="[title]Save movingUI changes to a new file" class="menu_button margin0 fa-solid fa-save"></div>
|
||||
<div data-newbie-hidden id="movingUIreset" title="Reset MovingUI panel sizes/locations." class="menu_button fa-solid fa-recycle margin0" data-i18n="[title]Reset MovingUI panel sizes/locations."></div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-newbie-hidden id="CustomCSS-block" class="flex-container flexFlowColumn">
|
||||
|
@ -4117,6 +4190,12 @@
|
|||
Quick "Continue" button
|
||||
</small>
|
||||
</label>
|
||||
<label class="checkbox_label" for="quick_impersonate" title="Show a button in the input area to ask the AI to impersonate your character for a single message." data-i18n="[title]Show a button in the input area to ask the AI to impersonate your character for a single message">
|
||||
<input id="quick_impersonate" type="checkbox" />
|
||||
<small data-i18n="Quick 'Impersonate' button">
|
||||
Quick "Impersonate" button
|
||||
</small>
|
||||
</label>
|
||||
<div class="checkbox-container flex-container">
|
||||
<label data-newbie-hidden class="checkbox_label" for="swipes-checkbox" title="Show arrow buttons on the last in-chat message to generate alternative AI responses. Both PC and mobile." data-i18n="[title]Show arrow buttons on the last in-chat message to generate alternative AI responses. Both PC and mobile">
|
||||
<input id="swipes-checkbox" type="checkbox" />
|
||||
|
@ -4237,6 +4316,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div title="Determines which keys select an item from the AutoComplete suggestions">
|
||||
<label data-i18n="Keyboard">
|
||||
<small>Keyboard:</small>
|
||||
</label>
|
||||
<select id="stscript_autocomplete_select">
|
||||
<option value="3" data-i18n="Select with Tab or Enter">Select with Tab or Enter</option>
|
||||
<option value="1" data-i18n="Select with Tab">Select with Tab</option>
|
||||
<option value="2" data-i18n="Select with Enter">Select with Enter</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex-container flexFlowColumn gap0" title="Sets the font size of the autocomplete." data-i18n="[title]Sets the font size of the autocomplete.">
|
||||
<label for="stscript_autocomplete_font_scale"><small>Font Scale</small></label>
|
||||
<input class="neo-range-slider" type="range" id="stscript_autocomplete_font_scale" min="0.5" max="2" step="0.01">
|
||||
|
@ -4275,7 +4364,7 @@
|
|||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||
</a>
|
||||
</label>
|
||||
<label class="checkbox_label" title="Prevents {{getvar::}} {{getglobalvar::}} macros from having literal macro-like values auto-evaluated.
e.g. "{{newline}}" remains as literal string "{{newline}}"

(This is done by internally replacing {{getvar::}} {{getglobalvar::}} macros with scoped variables.)" data-i18n="[title]Prevents {{getvar::}} {{getglobalvar::}} macros from having literal macro-like values auto-evaluated.
e.g. "{{newline}}" remains as literal string "{{newline}}"

(This is done by internally replacing {{getvar::}} {{getglobalvar::}} macros with scoped variables.)">
|
||||
<label class="checkbox_label" title="Prevents {{getvar::}} {{getglobalvar::}} macros from having literal macro-like values auto-evaluated.
e.g. "{{newline}}" remains as literal string "{{newline}}"

(This is done by internally replacing {{getvar::}} {{getglobalvar::}} macros with scoped variables.)" data-i18n="[title]stscript_parser_flag_replace_getvar_label">
|
||||
<input id="stscript_parser_flag_replace_getvar" type="checkbox" />
|
||||
<span data-i18n="REPLACE_GETVAR"><small>REPLACE_GETVAR</small></span>
|
||||
<a href="https://docs.sillytavern.app/usage/st-script/#replace-variable-macros" target="_blank" class="notes-link">
|
||||
|
@ -4578,7 +4667,7 @@
|
|||
<div id="favorite_button" class="menu_button fa-solid fa-star" title="Add to Favorites" data-i18n="[title]Add to Favorites"></div>
|
||||
<input type="hidden" id="fav_checkbox" name="fav" />
|
||||
<div id="advanced_div" class="menu_button fa-solid fa-book " title="Advanced Definitions" data-i18n="[title]Advanced Definition"></div>
|
||||
<div id="world_button" class="menu_button fa-solid fa-globe" title="Character Lore" data-i18n="[title]Character Lore"></div>
|
||||
<div id="world_button" class="menu_button fa-solid fa-globe" title="Character Lore Click to load Shift-click to open 'Link to World Info' popup" data-i18n="[title]world_button_title"></div>
|
||||
<div class="chat_lorebook_button menu_button fa-solid fa-passport" title="Chat Lore" data-i18n="[title]Chat Lore"></div>
|
||||
<div id="export_button" class="menu_button fa-solid fa-file-export " title="Export and Download" data-i18n="[title]Export and Download"></div>
|
||||
<!-- <div id="set_chat_scenario" class="menu_button fa-solid fa-scroll" title="Set a chat scenario override"></div> -->
|
||||
|
@ -5235,21 +5324,22 @@
|
|||
<div class="world_entry">
|
||||
<form class="world_entry_form wi-card-entry">
|
||||
<div class="inline-drawer wide100p">
|
||||
<div class="inline-drawer-toggle inline-drawer-header gap5px padding0">
|
||||
<div class="inline-drawer-header gap5px padding0">
|
||||
<span class="drag-handle">☰</span>
|
||||
<div class="gap5px world_entry_thin_controls wide100p alignitemscenter">
|
||||
<div class="fa-fw fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
|
||||
<div class="inline-drawer-toggle fa-fw fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
|
||||
<div class="fa-solid fa-toggle-on killSwitch" name="entryKillSwitch" title="Toggle entry's active state."></div>
|
||||
<div class="flex-container alignitemscenter wide100p">
|
||||
|
||||
<div class="WIEntryTitleAndStatus flex-container flex1 alignitemscenter">
|
||||
|
||||
<div class="flex-container flex1">
|
||||
<textarea class="text_pole" rows="1" name="comment" maxlength="5000" data-i18n="[placeholder]Entry Title/Memo" placeholder="Entry Title/Memo"></textarea>
|
||||
</div>
|
||||
<!-- <span class="world_entry_form_position_value"></span> -->
|
||||
<select data-i18n="[title]WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled" title="WI Entry Status: 🔵 Constant 🟢 Normal 🔗 Vectorized ❌ Disabled" name="entryStateSelector" class="text_pole widthNatural margin0">
|
||||
<option value="constant" title="Constant" data-i18n="[title]WI_Entry_Status_Constant">🔵</option>
|
||||
<option value="normal" title="Normal" data-i18n="[title]WI_Entry_Status_Normal">🟢</option>
|
||||
<option value="vectorized" title="Vectorized" data-i18n="[title]WI_Entry_Status_Vectorized">🔗</option>
|
||||
<option value="disabled" title="Disabled" data-i18n="[title]WI_Entry_Status_Disabled">❌</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="WIEnteryHeaderControls flex-container">
|
||||
|
@ -5722,6 +5812,11 @@
|
|||
<div title="Caption" class="right_menu_button fa-lg fa-solid fa-envelope-open-text mes_img_caption" data-i18n="[title]Caption"></div>
|
||||
<div title="Delete" class="right_menu_button fa-lg fa-solid fa-trash-can mes_img_delete" data-i18n="[title]Delete"></div>
|
||||
</div>
|
||||
<div class="mes_img_swipes">
|
||||
<div title="Swipe left" class="right_menu_button fa-lg fa-solid fa-chevron-left mes_img_swipe_left" data-i18n="[title]Swipe left"></div>
|
||||
<div class="mes_img_swipe_counter">1/1</div>
|
||||
<div title="Swipe right" class="right_menu_button fa-lg fa-solid fa-chevron-right mes_img_swipe_right" data-i18n="[title]Swipe right"></div>
|
||||
</div>
|
||||
<img class="mes_img" src="" />
|
||||
</div>
|
||||
<div class="mes_bias"></div>
|
||||
|
@ -5784,6 +5879,7 @@
|
|||
Enable simple UI mode
|
||||
</span>
|
||||
</label>
|
||||
<div class="expander"></div>
|
||||
<div class="textAlignCenter">
|
||||
<h3 data-i18n="Looking for AI characters?">
|
||||
Looking for AI characters?
|
||||
|
@ -5802,6 +5898,7 @@
|
|||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="expander"></div>
|
||||
<h3 data-i18n="Your Persona">
|
||||
Your Persona
|
||||
</h3>
|
||||
|
@ -6315,6 +6412,7 @@
|
|||
<div id="mes_stop" title="Abort request" class="mes_stop" data-i18n="[title]Abort request">
|
||||
<i class="fa-solid fa-circle-stop"></i>
|
||||
</div>
|
||||
<div id="mes_impersonate" class="fa-solid fa-user-secret interactable displayNone" title="Ask AI to write your message for you" data-i18n="[title]Ask AI to write your message for you" tabindex="0"></div>
|
||||
<div id="mes_continue" class="fa-fw fa-solid fa-arrow-right interactable displayNone" title="Continue the last message" data-i18n="[title]Continue the last message"></div>
|
||||
<div id="send_but" class="fa-solid fa-paper-plane interactable displayNone" title="Send a message" data-i18n="[title]Send a message"></div>
|
||||
</div>
|
||||
|
@ -6431,6 +6529,9 @@
|
|||
<button class="menu_button set_default_persona" title="Select this as default persona for the new chats." data-i18n="[title]Select this as default persona for the new chats.">
|
||||
<i class="fa-fw fa-solid fa-crown"></i>
|
||||
</button>
|
||||
<button class="menu_button duplicate_persona" title="Duplicate persona" data-i18n="[title]Duplicate persona">
|
||||
<i class="fa-fw fa-solid fa-clone"></i>
|
||||
</button>
|
||||
<button class="menu_button delete_avatar" title="Delete persona" data-i18n="[title]Delete persona">
|
||||
<i class="fa-fw fa-solid fa-trash-alt"></i>
|
||||
</button>
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "مخطط جيسون",
|
||||
"Type in the desired JSON schema": "اكتب مخطط JSON المطلوب",
|
||||
"Grammar String": "سلسلة القواعد",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "يعتمد GNBF أو ENBF على الواجهة الخلفية المستخدمة. إذا كنت تستخدم هذا يجب أن تعرف أي.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "يعتمد GBNF أو EBNF على الواجهة الخلفية المستخدمة. إذا كنت تستخدم هذا يجب أن تعرف أي.",
|
||||
"Top P & Min P": "أعلى ع وأدنى ص",
|
||||
"Load default order": "تحميل الترتيب الافتراضي",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "llama.cpp فقط. تحديد ترتيب أخذ العينات. إذا لم يكن وضع Mirostat 0، فسيتم تجاهل ترتيب أخذ العينات.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "سلوك أسماء الشخصيات",
|
||||
"Helps the model to associate messages with characters.": "يساعد النموذج على ربط الرسائل بالأحرف.",
|
||||
"None": "لا شيء",
|
||||
"character_names_none": "باستثناء المجموعات والشخصيات السابقة. بخلاف ذلك، تأكد من تقديم الأسماء في المطالبة.",
|
||||
"character_names_default": "باستثناء المجموعات والشخصيات السابقة. بخلاف ذلك، تأكد من تقديم الأسماء في المطالبة.",
|
||||
"Don't add character names.": "لا تضيف أسماء الشخصيات.",
|
||||
"Completion": "كائن الإكمال",
|
||||
"character_names_completion": "تنطبق القيود: فقط الحروف الأبجدية اللاتينية والأرقام والشرطات السفلية. لا يعمل مع جميع المصادر، ولا سيما: Claude وMistralAI وGoogle.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "JSON-Schema",
|
||||
"Type in the desired JSON schema": "Geben Sie das gewünschte JSON-Schema ein",
|
||||
"Grammar String": "Grammatikzeichenfolge",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF oder ENBF, hängt vom verwendeten Backend ab. Wenn Sie dieses verwenden, sollten Sie wissen, welches.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF oder EBNF, hängt vom verwendeten Backend ab. Wenn Sie dieses verwenden, sollten Sie wissen, welches.",
|
||||
"Top P & Min P": "Top P und Min P",
|
||||
"Load default order": "Standardreihenfolge laden",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "Nur llama.cpp. Bestimmt die Reihenfolge der Sampler. Wenn der Mirostat-Modus nicht 0 ist, wird die Sampler-Reihenfolge ignoriert.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Charakternamen Verhalten",
|
||||
"Helps the model to associate messages with characters.": "Hilft dem Modell, Nachrichten mit Zeichen zu verknüpfen.",
|
||||
"None": "Keins",
|
||||
"character_names_none": "Außer für Gruppen und frühere Personas. Andernfalls stellen Sie sicher, dass Sie in der Eingabeaufforderung Namen angeben.",
|
||||
"character_names_default": "Außer für Gruppen und frühere Personas. Andernfalls stellen Sie sicher, dass Sie in der Eingabeaufforderung Namen angeben.",
|
||||
"Don't add character names.": "Fügen Sie keine Charakternamen hinzu.",
|
||||
"Completion": "Vervollständigungsobjekt",
|
||||
"character_names_completion": "Es gelten Einschränkungen: nur lateinische alphanumerische Zeichen und Unterstriche. Funktioniert nicht für alle Quellen, insbesondere: Claude, MistralAI, Google.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "Esquema JSON",
|
||||
"Type in the desired JSON schema": "Escriba el esquema JSON deseado",
|
||||
"Grammar String": "Cadena de gramática",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF o ENBF, depende del backend en uso. Si estás usando esto, debes saber cuál.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF o EBNF, depende del backend en uso. Si estás usando esto, debes saber cuál.",
|
||||
"Top P & Min P": "P superior y P mínima",
|
||||
"Load default order": "Cargar orden predeterminado",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "llama.cpp únicamente. Determina el orden de los muestreadores. Si el modo Mirostat no es 0, se ignora el orden de las muestras.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Comportamiento de los nombres de personajes",
|
||||
"Helps the model to associate messages with characters.": "Ayuda al modelo a asociar mensajes con personajes.",
|
||||
"None": "Ninguno",
|
||||
"character_names_none": "Excepto grupos y personas pasadas. De lo contrario, asegúrese de proporcionar nombres en el mensaje.",
|
||||
"character_names_default": "Excepto grupos y personas pasadas. De lo contrario, asegúrese de proporcionar nombres en el mensaje.",
|
||||
"Don't add character names.": "No agregues nombres de personajes.",
|
||||
"Completion": "Objeto de finalización",
|
||||
"character_names_completion": "Aplican restricciones: solo caracteres alfanuméricos latinos y guiones bajos. No funciona para todas las fuentes, en particular: Claude, MistralAI, Google.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "Schéma JSON",
|
||||
"Type in the desired JSON schema": "Tapez le schéma JSON souhaité",
|
||||
"Grammar String": "Chaîne de grammaire",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF ou ENBF dépend du backend utilisé. Si vous l'utilisez, vous devez savoir lequel.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF ou EBNF dépend du backend utilisé. Si vous l'utilisez, vous devez savoir lequel.",
|
||||
"Top P & Min P": "P supérieur et P minimal",
|
||||
"Load default order": "Charger l'ordre par défaut",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "lama.cpp uniquement. Détermine l’ordre des échantillonneurs. Si le mode Mirostat n'est pas 0, l'ordre de l'échantillonneur est ignoré.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Comportement des noms de personnages",
|
||||
"Helps the model to associate messages with characters.": "Aide le modèle à associer des messages à des personnages.",
|
||||
"None": "Aucun",
|
||||
"character_names_none": "Sauf pour les groupes et les personnages passés. Sinon, assurez-vous de fournir des noms dans l'invite.",
|
||||
"character_names_default": "Sauf pour les groupes et les personnages passés. Sinon, assurez-vous de fournir des noms dans l'invite.",
|
||||
"Don't add character names.": "N'ajoutez pas de noms de personnages.",
|
||||
"Completion": "Objet d'achèvement",
|
||||
"character_names_completion": "Des restrictions s'appliquent : uniquement les caractères alphanumériques latins et les traits de soulignement. Ne fonctionne pas pour toutes les sources, notamment : Claude, MistralAI, Google.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "JSON kerfi",
|
||||
"Type in the desired JSON schema": "Sláðu inn æskilegt JSON skema",
|
||||
"Grammar String": "Málfræðistrengur",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF eða ENBF, fer eftir bakendanum sem er í notkun. Ef þú ert að nota þetta ættir þú að vita hvaða.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF eða EBNF, fer eftir bakendanum sem er í notkun. Ef þú ert að nota þetta ættir þú að vita hvaða.",
|
||||
"Top P & Min P": "Efstu P & Min P",
|
||||
"Load default order": "Hlaða sjálfgefna röð",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "llama.cpp eingöngu. Ákveður röð sýnataka. Ef Mirostat hamur er ekki 0, er röð sýnatöku hunsuð.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Hegðun persónunafna",
|
||||
"Helps the model to associate messages with characters.": "Hjálpar líkaninu að tengja skilaboð við stafi.",
|
||||
"None": "Enginn",
|
||||
"character_names_none": "Nema hópar og fyrri persónur. Annars, vertu viss um að gefa upp nöfn í hvetjunni.",
|
||||
"character_names_default": "Nema hópar og fyrri persónur. Annars, vertu viss um að gefa upp nöfn í hvetjunni.",
|
||||
"Don't add character names.": "Ekki bæta við persónunöfnum.",
|
||||
"Completion": "Lokunarhlutur",
|
||||
"character_names_completion": "Takmarkanir gilda: aðeins latneskar tölustafir og undirstrik. Virkar ekki fyrir allar heimildir, sérstaklega: Claude, MistralAI, Google.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "Schema JSON",
|
||||
"Type in the desired JSON schema": "Digita lo schema JSON desiderato",
|
||||
"Grammar String": "Stringa grammaticale",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF o ENBF, dipende dal backend in uso. Se stai usando questo dovresti sapere quale.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF o EBNF, dipende dal backend in uso. Se stai usando questo dovresti sapere quale.",
|
||||
"Top P & Min P": "P massimo e P minimo",
|
||||
"Load default order": "Carica ordine predefinito",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "Solo lama.cpp. Determina l'ordine dei campionatori. Se la modalità Mirostat non è 0, l'ordine del campionatore viene ignorato.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Comportamento dei nomi dei personaggi",
|
||||
"Helps the model to associate messages with characters.": "Aiuta il modello ad associare i messaggi ai personaggi.",
|
||||
"None": "Nessuno",
|
||||
"character_names_none": "Fatta eccezione per i gruppi e i personaggi passati. Altrimenti, assicurati di fornire i nomi nel prompt.",
|
||||
"character_names_default": "Fatta eccezione per i gruppi e i personaggi passati. Altrimenti, assicurati di fornire i nomi nel prompt.",
|
||||
"Don't add character names.": "Non aggiungere nomi di personaggi.",
|
||||
"Completion": "Oggetto di completamento",
|
||||
"character_names_completion": "Si applicano restrizioni: solo caratteri alfanumerici latini e trattini bassi. Non funziona con tutte le fonti, in particolare: Claude, MistralAI, Google.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "JSONスキーマ",
|
||||
"Type in the desired JSON schema": "希望するJSONスキーマを入力します",
|
||||
"Grammar String": "文法文字列",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF または ENBF は、使用するバックエンドによって異なります。これを使用する場合は、どちらであるかを知っておく必要があります。",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF または EBNF は、使用するバックエンドによって異なります。これを使用する場合は、どちらであるかを知っておく必要があります。",
|
||||
"Top P & Min P": "トップPと最小P",
|
||||
"Load default order": "デフォルトの順序を読み込む",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "llama.cpp のみ。サンプラーの順序を決定します。Mirostat モードが 0 でない場合、サンプラーの順序は無視されます。",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "キャラクター名の動作",
|
||||
"Helps the model to associate messages with characters.": "モデルがメッセージをキャラクターに関連付けるのに役立ちます。",
|
||||
"None": "なし",
|
||||
"character_names_none": "グループと過去のペルソナを除きます。それ以外の場合は、プロンプトに名前を必ず入力してください。",
|
||||
"character_names_default": "グループと過去のペルソナを除きます。それ以外の場合は、プロンプトに名前を必ず入力してください。",
|
||||
"Don't add character names.": "キャラクター名を追加しないでください。",
|
||||
"Completion": "完了オブジェクト",
|
||||
"character_names_completion": "制限事項: ラテン英数字とアンダースコアのみ。すべてのソースで機能するわけではありません。特に、Claude、MistralAI、Google では機能しません。",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "JSON 스키마",
|
||||
"Type in the desired JSON schema": "원하는 JSON 스키마를 입력하세요.",
|
||||
"Grammar String": "문법 문자열",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF 또는 ENBF는 사용 중인 백엔드에 따라 다릅니다. 이것을 사용한다면 어느 것이 무엇인지 알아야합니다.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF 또는 EBNF는 사용 중인 백엔드에 따라 다릅니다. 이것을 사용한다면 어느 것이 무엇인지 알아야합니다.",
|
||||
"Top P & Min P": "상위 P 및 최소 P",
|
||||
"Load default order": "기본 순서로 로드",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "llama.cpp만 가능합니다. 샘플러의 순서를 결정합니다. Mirostat 모드가 0이 아닌 경우 샘플러 순서는 무시됩니다.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "캐릭터 이름 행동",
|
||||
"Helps the model to associate messages with characters.": "모델이 메시지를 캐릭터와 연관시키는 데 도움이 됩니다.",
|
||||
"None": "없음",
|
||||
"character_names_none": "그룹 및 과거 페르소나는 제외됩니다. 그렇지 않으면 프롬프트에 이름을 제공해야 합니다.",
|
||||
"character_names_default": "그룹 및 과거 페르소나는 제외됩니다. 그렇지 않으면 프롬프트에 이름을 제공해야 합니다.",
|
||||
"Don't add character names.": "캐릭터 이름을 추가하지 마세요.",
|
||||
"Completion": "완료 객체",
|
||||
"character_names_completion": "제한 사항이 적용됩니다. 라틴 영숫자 및 밑줄만 사용할 수 있습니다. 모든 소스, 특히 Claude, MistralAI, Google에서 작동하지 않습니다.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "JSON-schema",
|
||||
"Type in the desired JSON schema": "Typ het gewenste JSON-schema",
|
||||
"Grammar String": "Grammaticareeks",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF of ENBF, hangt af van de gebruikte backend. Als u dit gebruikt, moet u weten welke.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF of EBNF, hangt af van de gebruikte backend. Als u dit gebruikt, moet u weten welke.",
|
||||
"Top P & Min P": "Top P & Min P",
|
||||
"Load default order": "Standaardvolgorde laden",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "alleen lama.cpp. Bepaalt de volgorde van de samplers. Als de Mirostat-modus niet 0 is, wordt de samplervolgorde genegeerd.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Karakternamen Gedrag",
|
||||
"Helps the model to associate messages with characters.": "Helpt het model berichten aan karakters te koppelen.",
|
||||
"None": "Geen",
|
||||
"character_names_none": "Behalve voor groepen en vroegere persona's. Zorg er anders voor dat u namen opgeeft in de prompt.",
|
||||
"character_names_default": "Behalve voor groepen en vroegere persona's. Zorg er anders voor dat u namen opgeeft in de prompt.",
|
||||
"Don't add character names.": "Voeg geen namen van personages toe.",
|
||||
"Completion": "Voltooiingsobject",
|
||||
"character_names_completion": "Er zijn beperkingen van toepassing: alleen Latijnse alfanumerieke tekens en onderstrepingstekens. Werkt niet voor alle bronnen, met name: Claude, MistralAI, Google.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "Esquema JSON",
|
||||
"Type in the desired JSON schema": "Digite o esquema JSON desejado",
|
||||
"Grammar String": "Cadeia de Gramática",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF ou ENBF, depende do backend em uso. Se você estiver usando isso, você deve saber qual.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF ou EBNF, depende do backend em uso. Se você estiver usando isso, você deve saber qual.",
|
||||
"Top P & Min P": "P superior e P mínimo",
|
||||
"Load default order": "Carregar ordem padrão",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "apenas lhama.cpp. Determina a ordem dos amostradores. Se o modo Mirostat não for 0, a ordem do amostrador será ignorada.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Comportamento dos nomes dos personagens",
|
||||
"Helps the model to associate messages with characters.": "Ajuda o modelo a associar mensagens a personagens.",
|
||||
"None": "Nenhum",
|
||||
"character_names_none": "Exceto para grupos e personas passadas. Caso contrário, certifique-se de fornecer nomes no prompt.",
|
||||
"character_names_default": "Exceto para grupos e personas passadas. Caso contrário, certifique-se de fornecer nomes no prompt.",
|
||||
"Don't add character names.": "Não adicione nomes de personagens.",
|
||||
"Completion": "Objeto de conclusão",
|
||||
"character_names_completion": "Aplicam-se restrições: apenas alfanuméricos latinos e sublinhados. Não funciona para todas as fontes, nomeadamente: Claude, MistralAI, Google.",
|
||||
|
|
|
@ -978,7 +978,7 @@
|
|||
"char_import_6": "Прямая ссылка на PNG-файл (чтобы узнать список разрешённых хостов, загляните в",
|
||||
"char_import_7": ")",
|
||||
"Grammar String": "Грамматика",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF или ENBF, зависит от бэкенда. Если вы это используете, то, скорее всего, сами знаете, какой именно.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF или EBNF, зависит от бэкенда. Если вы это используете, то, скорее всего, сами знаете, какой именно.",
|
||||
"Account": "Аккаунт",
|
||||
"Hi,": "Привет,",
|
||||
"To enable multi-account features, restart the SillyTavern server with": "Чтобы активировать систему аккаунтов, перезапустите SillyTavern, выставив",
|
||||
|
@ -1246,7 +1246,7 @@
|
|||
"Top P & Min P": "Top P & Min P",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.",
|
||||
"Helps the model to associate messages with characters.": "Помогает модели связывать сообщения с персонажами.",
|
||||
"character_names_none": "Except for groups and past personas. Otherwise, make sure you provide names in the prompt.",
|
||||
"character_names_default": "Except for groups and past personas. Otherwise, make sure you provide names in the prompt.",
|
||||
"Completion": "Completion Object",
|
||||
"character_names_completion": "Только латинские буквы, цифры и знак подчёркивания. Работает не для всех бэкендов, в частности для Claude, MistralAI, Google.",
|
||||
"Use AI21 Tokenizer": "Использовать токенайзер AI21",
|
||||
|
@ -1662,4 +1662,4 @@
|
|||
"ext_regex_sts_desc": "Сообщения, отправленные с помощью команд STscript",
|
||||
"ext_regex_wi_desc": "Содержимое лорбуков и миров. Для работы требует включения флажка \"Только промпт\"!",
|
||||
"ext_regex_only_format_display_desc": "История чата не изменится, замена будет осуществляться только в отображаемом сообщении (в UI)"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "Схема JSON",
|
||||
"Type in the desired JSON schema": "Введіть потрібну схему JSON",
|
||||
"Grammar String": "Граматичний рядок",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF або ENBF, залежить від серверної частини, яка використовується. Якщо ви використовуєте це, ви повинні знати, який.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF або EBNF, залежить від серверної частини, яка використовується. Якщо ви використовуєте це, ви повинні знати, який.",
|
||||
"Top P & Min P": "Верхній P & Min P",
|
||||
"Load default order": "Завантажити типовий порядок",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "лише llama.cpp. Визначає порядок пробовідбірників. Якщо режим Mirostat не 0, порядок вибірки ігнорується.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Поведінка імен персонажів",
|
||||
"Helps the model to associate messages with characters.": "Допомагає моделі пов’язувати повідомлення з символами.",
|
||||
"None": "Немає",
|
||||
"character_names_none": "За винятком груп і минулих персонажів. В іншому випадку переконайтеся, що ви вказали імена в підказці.",
|
||||
"character_names_default": "За винятком груп і минулих персонажів. В іншому випадку переконайтеся, що ви вказали імена в підказці.",
|
||||
"Don't add character names.": "Не додавайте імена персонажів.",
|
||||
"Completion": "Об'єкт завершення",
|
||||
"character_names_completion": "Застосовуються обмеження: лише латинські букви та цифри підкреслення. Працює не для всіх джерел, зокрема: Claude, MistralAI, Google.",
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
"JSON Schema": "Lược đồ JSON",
|
||||
"Type in the desired JSON schema": "Nhập lược đồ JSON mong muốn",
|
||||
"Grammar String": "Chuỗi ngữ pháp",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF hoặc ENBF, tùy thuộc vào backend đang sử dụng. Nếu bạn đang sử dụng cái này, bạn nên biết cái nào.",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF hoặc EBNF, tùy thuộc vào backend đang sử dụng. Nếu bạn đang sử dụng cái này, bạn nên biết cái nào.",
|
||||
"Top P & Min P": "P & P tối thiểu hàng đầu",
|
||||
"Load default order": "Tải thứ tự mặc định",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "chỉ llama.cpp. Xác định thứ tự lấy mẫu. Nếu chế độ Mirostat khác 0, thứ tự lấy mẫu sẽ bị bỏ qua.",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"Character Names Behavior": "Tên nhân vật Hành vi",
|
||||
"Helps the model to associate messages with characters.": "Giúp mô hình liên kết tin nhắn với các ký tự.",
|
||||
"None": "Không",
|
||||
"character_names_none": "Ngoại trừ các nhóm và cá tính trong quá khứ. Nếu không, hãy đảm bảo bạn cung cấp tên trong lời nhắc.",
|
||||
"character_names_default": "Ngoại trừ các nhóm và cá tính trong quá khứ. Nếu không, hãy đảm bảo bạn cung cấp tên trong lời nhắc.",
|
||||
"Don't add character names.": "Không thêm tên nhân vật.",
|
||||
"Completion": "Đối tượng hoàn thành",
|
||||
"character_names_completion": "Áp dụng hạn chế: chỉ chữ và số Latinh và dấu gạch dưới. Không hoạt động với tất cả các nguồn, đặc biệt là: Claude, MistralAI, Google.",
|
||||
|
|
|
@ -69,8 +69,8 @@
|
|||
"Top A": "Top A",
|
||||
"Quick Prompts Edit": "快速提示词编辑",
|
||||
"Main": "主要",
|
||||
"NSFW": "NSFW",
|
||||
"Jailbreak": "越狱",
|
||||
"Auxiliary": "辅助的",
|
||||
"Post-History Instructions": "后续历史指令",
|
||||
"Utility Prompts": "实用提示词",
|
||||
"Impersonation prompt": "AI帮答提示词",
|
||||
"Restore default prompt": "恢复默认提示词",
|
||||
|
@ -208,19 +208,21 @@
|
|||
"JSON Schema": "JSON 结构",
|
||||
"Type in the desired JSON schema": "输入所需的 JSON 结构",
|
||||
"Grammar String": "语法字符串",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF 或 ENBF,取决于使用的后端。如果您使用这个,您应该知道该用哪一个。",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF 或 EBNF,取决于使用的后端。如果您使用这个,您应该知道该用哪一个。",
|
||||
"Top P & Min P": "Top P 和 Min P",
|
||||
"Load default order": "加载默认顺序",
|
||||
"Sampler Order": "取样器顺序",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "仅限 llama.cpp。确定采样器的顺序。如果 Mirostat 模式不为 0,则忽略采样器顺序。",
|
||||
"Sampler Priority": "采样器优先级",
|
||||
"Ooba only. Determines the order of samplers.": "确定采样器的顺序(仅适用于Ooba)",
|
||||
"Character Names Behavior": "角色名称行为",
|
||||
"Helps the model to associate messages with characters.": "有助于模型将消息与角色关联起来。",
|
||||
"None": "无",
|
||||
"tag_import_none": "无",
|
||||
"character_names_none": "群聊和过去的角色除外。否则,请确保在提示词中提供了姓名。",
|
||||
"Don't add character names.": "不添加角色名称。",
|
||||
"Completion": "补全对象",
|
||||
"character_names_none": "不添加角色名称前缀。在群聊中可能导致错误行为,谨慎勾选。",
|
||||
"Never add character names.": "不添加角色名称。",
|
||||
"character_names_default": "群聊和过去的角色除外。否则,请确保在提示词中提供了姓名。",
|
||||
"Don't add character names unless necessary.": "如非必要,否则不添加角色名称。",
|
||||
"Completion Object": "补全对象",
|
||||
"character_names_completion": "适用限制:仅限拉丁字母数字和下划线。不适用于所有补全源,尤其是:Claude、MistralAI、Google。",
|
||||
"Add character names to completion objects.": "在补全对象中添加角色名称。",
|
||||
"Message Content": "消息内容",
|
||||
|
@ -318,6 +320,7 @@
|
|||
"View Remaining Credits": "查看剩余额度",
|
||||
"OpenRouter Model": "OpenRouter 模型",
|
||||
"Model Providers": "模型提供者",
|
||||
"Allow fallback providers": "允许后备提供者",
|
||||
"InfermaticAI API Key": "InfermaticAI API 密钥",
|
||||
"InfermaticAI Model": "InfermaticAI 模型",
|
||||
"DreamGen API key": "DreamGen API 密钥",
|
||||
|
@ -346,6 +349,7 @@
|
|||
"Ollama Model": "Ollama 模型",
|
||||
"Download": "下载",
|
||||
"Tabby API key": "Tabby API 密钥",
|
||||
"Tabby Model": "Tabby 模型",
|
||||
"koboldcpp API key (optional)": "koboldcpp API 密钥(可选)",
|
||||
"Example: 127.0.0.1:5001": "示例:127.0.0.1:5001",
|
||||
"Authorize": "授权",
|
||||
|
@ -363,13 +367,14 @@
|
|||
"This will show up as your saved preset.": "这将显示为您保存的预设。",
|
||||
"Proxy Server URL": "代理服务器 URL",
|
||||
"Alternative server URL (leave empty to use the default value).": "备用服务器 URL(留空以使用默认值)。",
|
||||
"Remove your real OAI API Key from the API panel BEFORE typing anything into this box": "在键入任何内容之前,从 API 面板中删除您的真实 OAI API 密钥",
|
||||
"We cannot provide support for problems encountered while using an unofficial OpenAI proxy": "我们无法为使用非官方 OpenAI 代理时遇到的问题提供支持",
|
||||
"Doesn't work? Try adding": "不起作用?尝试在最后添加",
|
||||
"at the end!": "!",
|
||||
"Proxy Password": "代理密码",
|
||||
"Will be used as a password for the proxy instead of API key.": "将用作代理的密码,而不是 API 密钥。",
|
||||
"Peek a password": "查看密码",
|
||||
"Using a proxy that you're not running yourself is a risk to your data privacy.": "使用您自己未运行的代理会对您的数据隐私造成风险。",
|
||||
"ANY support requests will be REFUSED if you are using a proxy.": "如果您使用代理,任何支持请求都将被拒绝。",
|
||||
"Do not proceed if you do not agree to this!": "如果您不同意,请不要继续!",
|
||||
"OpenAI API key": "OpenAI API 密钥",
|
||||
"View API Usage Metrics": "查看API使用情况",
|
||||
"Follow": "跟随",
|
||||
|
@ -384,14 +389,14 @@
|
|||
"Slack and Poe cookies will not work here, do not bother trying.": "Slack和Poe的cookie在这里不起作用,请不要尝试。",
|
||||
"Claude Model": "Claude 模型",
|
||||
"Window AI Model": "Window AI 模型",
|
||||
"Allow fallback routes Description": "如果所选模型无法响应您的请求,则自动选择备用模型。",
|
||||
"Allow fallback models": "允许后备模型",
|
||||
"Model Order": "OpenRouter 模型顺序",
|
||||
"Alphabetically": "按字母顺序",
|
||||
"Price": "价格(最便宜)",
|
||||
"Context Size": "上下文大小",
|
||||
"Group by vendors": "按供应商分组",
|
||||
"Group by vendors Description": "将 OpenAI 模型放在一组,将 Anthropic 模型放在另一组,等等。可以与排序结合。",
|
||||
"Allow fallback routes": "允许后备方案",
|
||||
"Allow fallback routes Description": "如果所选模型无法响应您的请求,则自动选择备用模型。",
|
||||
"openrouter_force_instruct": "此选项已过时,将来会被删除。要使用指令格式,请改用文本完成 API 下的 OpenRouter。",
|
||||
"LEGACY": "旧版",
|
||||
"Force Instruct Mode formatting": "强制指令模式格式化",
|
||||
|
@ -439,9 +444,11 @@
|
|||
"Example Separator": "示例分隔符",
|
||||
"Chat Start": "聊天开始",
|
||||
"Add Chat Start and Example Separator to a list of stopping strings.": "将聊天开始和示例分隔符添加到停止字符串列表中。",
|
||||
"Use as Stop Strings": "用作停止字符串",
|
||||
"context_allow_jailbreak": "如果在角色卡中定义并且启用了“首选角色越狱”,则在提示词末尾包含越狱。\n不建议在文本完成模型中使用此功能,否则会导致输出错误。",
|
||||
"Allow Jailbreak": "允许越狱",
|
||||
"Separators as Stop Strings": "分隔符作为终止字符串",
|
||||
"Add Character and User names to a list of stopping strings.": "将角色和用户名添加到停止字符串列表中。",
|
||||
"Names as Stop Strings": "名称作为终止字符串",
|
||||
"context_allow_post_history_instructions": "如果在角色卡中定义并且启用了“首选角色卡说明”,则在提示末尾包含后历史说明。\n不建议在文本补全模型中使用此功能,否则会导致输出错误。",
|
||||
"Allow Post-History Instructions": "允许后历史说明",
|
||||
"Context Order": "上下文顺序",
|
||||
"Summary": "总结",
|
||||
"Author's Note": "作者注释",
|
||||
|
@ -487,6 +494,10 @@
|
|||
"First Assistant Prefix": "第一个助理前缀",
|
||||
"instruct_last_output_sequence": "插入到最后一条助手消息之前或作为生成 AI 回复时的最后一行提示词(中立/系统角色除外)。",
|
||||
"Last Assistant Prefix": "最后一个助理前缀",
|
||||
"Inserted before the first User's message.": "插入在第一个用户的消息之前。",
|
||||
"First User Prefix": "第一个用户前缀",
|
||||
"instruct_last_input_sequence": "插入到最后一条用户消息之前。",
|
||||
"Last User Prefix": "上次用户前缀",
|
||||
"Will be inserted as a last prompt line when using system/neutral generation.": "当使用系统/中性生成时将作为最后的一行提示词插入。",
|
||||
"System Instruction Prefix": "系统指令前缀",
|
||||
"If a stop sequence is generated, everything past it will be removed from the output (inclusive).": "如果生成了停止序列,则该序列之后的所有内容都将从输出中删除(包括在内)。",
|
||||
|
@ -534,6 +545,7 @@
|
|||
"Sorted Evenly": "均匀排序",
|
||||
"Character Lore First": "角色世界书优先",
|
||||
"Global Lore First": "全局世界书优先",
|
||||
"Include names with each message into the context for scanning": "将每条消息的名称纳入上下文中以供扫描",
|
||||
"Entries can activate other entries by mentioning their keywords": "条目可以通过提及它们的关键字来激活其他条目",
|
||||
"Recursive Scan": "递归扫描",
|
||||
"Lookup for the entry keys in the context will respect the case": "在上下文中查找条目键将保持大小写敏感",
|
||||
|
@ -552,6 +564,7 @@
|
|||
"Close all Entries": "关闭所有条目",
|
||||
"New Entry": "新条目",
|
||||
"Fill empty Memo/Titles with Keywords": "使用关键字填充空的备忘录/标题",
|
||||
"Apply current sorting as Order": "应用当前排序作为顺序",
|
||||
"Import World Info": "导入世界书",
|
||||
"Export World Info": "导出世界书",
|
||||
"Duplicate World Info": "复制世界书",
|
||||
|
@ -659,14 +672,15 @@
|
|||
"Defines on importing cards which action should be chosen for importing its listed tags. 'Ask' will always display the dialog.": "定义在导入卡片时应选择哪种操作来导入其列出的标签。“询问”将始终显示对话框。",
|
||||
"Import Card Tags": "导入卡片标签",
|
||||
"Ask": "询问",
|
||||
"tag_import_none": "无",
|
||||
"tag_import_all": "全部",
|
||||
"Existing": "现存的",
|
||||
"Use fuzzy matching, and search characters in the list by all data fields, not just by a name substring": "使用模糊匹配,在列表中通过所有数据字段搜索角色,而不仅仅是名称子字符串",
|
||||
"Advanced Character Search": "高级角色搜索",
|
||||
"If checked and the character card contains a prompt override (System Prompt), use that instead": "如果角色卡包含提示词,则使用它替代系统提示词",
|
||||
"Prefer Character Card Prompt": "角色卡提示词优先",
|
||||
"If checked and the character card contains a jailbreak override (Post History Instruction), use that instead": "如果角色卡包含越狱(后置历史记录指令),则使用它替代系统越狱",
|
||||
"Prefer Character Card Jailbreak": "角色卡越狱优先",
|
||||
"If checked and the character card contains a Post-History Instructions override, use that instead": "如果选中并且角色卡包含后历史指令覆盖,则使用它。",
|
||||
"Prefer Character Card Instructions": "首选角色卡说明",
|
||||
"Avoid cropping and resizing imported character images. When off, crop/resize to 512x768": "避免裁剪和调整导入的角色图像的大小。关闭时,裁剪/调整大小为 512x768。",
|
||||
"Never resize avatars": "永不调整头像大小",
|
||||
"Show actual file names on the disk, in the characters list display only": "在角色列表显示中,显示磁盘上实际的文件名。",
|
||||
|
@ -693,10 +707,10 @@
|
|||
"Restore User Input": "恢复用户输入",
|
||||
"Allow repositioning certain UI elements by dragging them. PC only, no effect on mobile": "允许通过拖动重新定位某些UI元素。仅适用于PC,对移动设备无影响",
|
||||
"Movable UI Panels": "可移动 UI 面板",
|
||||
"Reset MovingUI panel sizes/locations.": "重置 MovingUI 面板大小/位置。",
|
||||
"MovingUI preset. Predefined/saved draggable positions": "可移动UI预设。预定义/保存的可拖动位置",
|
||||
"MUI Preset": "可移动 UI 预设",
|
||||
"Save movingUI changes to a new file": "将可移动UI更改保存到新文件中",
|
||||
"Reset MovingUI panel sizes/locations.": "重置 MovingUI 面板大小/位置。",
|
||||
"Apply a custom CSS style to all of the ST GUI": "将自定义CSS样式应用于所有ST GUI",
|
||||
"Custom CSS": "自定义 CSS",
|
||||
"Expand the editor": "展开编辑器",
|
||||
|
@ -716,6 +730,8 @@
|
|||
"Press Send to continue": "按发送键以继续",
|
||||
"Show a button in the input area to ask the AI to continue (extend) its last message": "在输入区域中显示一个按钮,要求AI继续(延长)其上一条消息",
|
||||
"Quick 'Continue' button": "快速“继续”按钮",
|
||||
"Show a button in the input area to ask the AI to impersonate your character for a single message": "在输入区域中显示一个按钮,让 AI 模仿你的角色发送一条消息。",
|
||||
"Quick 'Impersonate' button": "快速“模仿”按钮",
|
||||
"Show arrow buttons on the last in-chat message to generate alternative AI responses. Both PC and mobile": "在聊天窗口的最后一条信息上显示箭头按钮,以生成AI的其他回复选项。适用于电脑和手机端。",
|
||||
"Swipes": "刷新回复按钮",
|
||||
"Allow using swiping gestures on the last in-chat message to trigger swipe generation. Mobile only, no effect on PC": "允许在最后一条聊天消息上使用滑动手势触发滑动生成。仅适用于移动设备,对PC无影响",
|
||||
|
@ -739,6 +755,8 @@
|
|||
"Log prompts to console": "将提示词记录到控制台",
|
||||
"Requests logprobs from the API for the Token Probabilities feature": "从API请求对数概率数据,用于实现词符概率功能。",
|
||||
"Request token probabilities": "请求词符概率",
|
||||
"In group chat, highlight the character(s) that are currently queued to generate responses and the order in which they will respond.": "在群聊中,突出显示当前排队等待生成响应的角色以及他们响应的顺序。",
|
||||
"Show group chat queue": "显示群聊队列",
|
||||
"Automatically reject and re-generate AI message based on configurable criteria": "根据可配置的条件自动拒绝并重新生成AI消息",
|
||||
"Auto-swipe": "自动滑动",
|
||||
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "启用自动滑动功能。仅当启用自动滑动时,本节中的设置才会生效",
|
||||
|
@ -759,6 +777,10 @@
|
|||
"Autocomplete Style": "风格",
|
||||
"Follow Theme": "关注主题",
|
||||
"Dark": "黑暗的",
|
||||
"Keyboard": "键盘:",
|
||||
"Select with Tab or Enter": "使用 Tab 或 Enter 选择",
|
||||
"Select with Tab": "使用 Tab 选择",
|
||||
"Select with Enter": "按 Enter 键选择",
|
||||
"Sets the font size of the autocomplete.": "设置自动完成的字体大小。",
|
||||
"Sets the width of the autocomplete.": "设置自动完成的宽度。",
|
||||
"Autocomplete Width": "宽度",
|
||||
|
@ -770,7 +792,7 @@
|
|||
"Parser Flags": "解析器标志",
|
||||
"Switch to stricter escaping, allowing all delimiting characters to be escaped with a backslash, and backslashes to be escaped as well.": "切换到更严格的转义,允许所有分隔字符用反斜杠转义,并且反斜杠也可以转义。",
|
||||
"STRICT_ESCAPING": "严格转义",
|
||||
"Replace all {{getvar::}} and {{getglobalvar::}} macros with scoped variables to avoid double macro substitution.": "用范围变量替换所有 {{getvar::}} 和 {{getglobalvar::}} 宏,以避免双重宏替换。",
|
||||
"stscript_parser_flag_replace_getvar_label": "防止 {{getvar::}} {{getglobalvar::}} 宏具有自动评估的文字宏类值。\n例如,“{{newline}}”保留为文字字符串“{{newline}}”\n\n(这是通过在内部用范围变量替换 {{getvar::}} {{getglobalvar::}} 宏来实现的。)",
|
||||
"REPLACE_GETVAR": "替换GETVAR",
|
||||
"Change Background Image": "更改背景图片",
|
||||
"Filter": "搜索",
|
||||
|
@ -921,7 +943,7 @@
|
|||
"Insert {{original}} into either box to include the respective default prompt from system settings.": "将{{original}}插入到任一框中,以包含系统设置中的相应默认提示词。",
|
||||
"Main Prompt": "主要提示词",
|
||||
"Any contents here will replace the default Main Prompt used for this character. (v2 spec: system_prompt)": "此处的任何内容都将替换用于此角色的默认主提示词。(v2规范:system_prompt)",
|
||||
"Any contents here will replace the default Jailbreak Prompt used for this character. (v2 spec: post_history_instructions)": "此处的任何内容都将替换用于此角色的默认越狱提示词。(v2规范:post_history_instructions)",
|
||||
"Any contents here will replace the default Post-History Instructions used for this character. (v2 spec: post_history_instructions)": "此处的任何内容都将替换此角色使用的默认后历史说明。\n(v2 规范:post_history_instructions)",
|
||||
"Creator's Metadata (Not sent with the AI prompt)": "创作者的元数据(不与AI提示词一起发送)",
|
||||
"Creator's Metadata": "创作者的元数据",
|
||||
"(Not sent with the AI Prompt)": "(不随 AI 提示词发送)",
|
||||
|
@ -957,9 +979,6 @@
|
|||
"Lock": "加锁",
|
||||
"Unlock": "解锁",
|
||||
"Delete background": "删除背景",
|
||||
"Chat Scenario Override": "聊天场景覆盖",
|
||||
"Remove": "移除",
|
||||
"Type here...": "在此处输入...",
|
||||
"Chat Lorebook": "聊天知识书",
|
||||
"Chat Lorebook for": "聊天知识书",
|
||||
"chat_world_template_txt": "选定的世界信息将绑定到此聊天。生成 AI 回复时,\n它将与全球和角色传说书中的条目相结合。",
|
||||
|
@ -1047,6 +1066,7 @@
|
|||
"Use Probability": "使用概率",
|
||||
"Add Memo": "添加备忘录",
|
||||
"Text or token ids": "文本或 [token ID]",
|
||||
"Type here...": "在此处输入...",
|
||||
"close": "关闭",
|
||||
"prompt_manager_edit": "编辑",
|
||||
"prompt_manager_name": "姓名",
|
||||
|
@ -1054,8 +1074,9 @@
|
|||
"To whom this message will be attributed.": "此消息应归于谁。",
|
||||
"AI Assistant": "AI助手",
|
||||
"prompt_manager_position": "位置",
|
||||
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "注入位置。其他提示词旁边(相对)或在聊天中(绝对)。",
|
||||
"Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "注入位置。相对(相对于提示管理器中的其他提示)或在聊天中@深度。",
|
||||
"prompt_manager_relative": "相对",
|
||||
"prompt_manager_in_chat": "聊天中",
|
||||
"prompt_manager_depth": "深度",
|
||||
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最后一条消息之后,1 = 在最后一条消息之前,等等。",
|
||||
"Prompt": "提示词",
|
||||
|
@ -1164,6 +1185,7 @@
|
|||
"Pause script execution": "暂停执行脚本",
|
||||
"Abort script execution": "中止执行脚本",
|
||||
"Abort request": "中止请求",
|
||||
"Ask AI to write your message for you": "让AI为您撰写消息",
|
||||
"Continue the last message": "继续上一条消息",
|
||||
"Send a message": "发送消息",
|
||||
"Close chat": "关闭聊天",
|
||||
|
@ -1175,19 +1197,24 @@
|
|||
"Manage chat files": "管理聊天文件",
|
||||
"Delete messages": "删除消息",
|
||||
"Regenerate": "重新生成",
|
||||
"Ask AI to write your message for you": "请求AI为您撰写消息",
|
||||
"Impersonate": "AI 帮答",
|
||||
"Continue": "继续",
|
||||
"Bind user name to that avatar": "将用户名称绑定到该头像",
|
||||
"Change persona image": "更改用户角色头像",
|
||||
"Select this as default persona for the new chats.": "选择此项作为新聊天的默认用户角色。",
|
||||
"Duplicate persona": "复制用户角色",
|
||||
"Delete persona": "删除用户角色",
|
||||
"These characters are the winners of character design contests and have outstandable quality.": "这些角色都是角色设计大赛的获奖者,品质非常出色。",
|
||||
"Contest Winners": "比赛获胜者",
|
||||
"These characters are the finalists of character design contests and have remarkable quality.": "这些角色都是角色设计大赛的入围作品,品质十分出色。",
|
||||
"Featured Characters": "特色角色",
|
||||
"Download Extensions & Assets": "下载扩展和资源菜单",
|
||||
"Load a custom asset list or select": "加载自定义资产列表或选择",
|
||||
"to install 3rd party extensions.": "安装第三方扩展。",
|
||||
"Assets URL": "资产网址",
|
||||
"load_asset_list_desc": "根据资产列表文件加载扩展和资产列表。\n\n此字段中的默认资产 URL 指向官方第一方扩展和资产列表。\n如果您有自定义资产列表,可以在此处插入。\n\n要安装单个第三方扩展,请使用右上角的“安装扩展”按钮。",
|
||||
"Load an asset list": "加载资产列表",
|
||||
"Load Asset List": "加载资产列表",
|
||||
"Characters": "人物",
|
||||
"Attach a File": "附加文件",
|
||||
"Enter a URL or the ID of a Fandom wiki page to scrape:": "输入要抓取的 Fandom wiki 页面的 URL 或 ID:",
|
||||
|
@ -1271,6 +1298,7 @@
|
|||
"Put images with expressions there. File names should follow the pattern:": "将带有表情的图像放在那里。文件名应遵循以下模式:",
|
||||
"expression_label_pattern": "[表达式标签].[图像格式]",
|
||||
"Sprite set:": "表情集:",
|
||||
"Show Gallery": "展示图库",
|
||||
"ext_sum_title": "总结",
|
||||
"ext_sum_with": "总结如下:",
|
||||
"ext_sum_main_api": "主要 API",
|
||||
|
@ -1315,9 +1343,14 @@
|
|||
"ext_sum_injection_template": "插入模板",
|
||||
"ext_sum_memory_template_placeholder": "{{summary}} 将解析当前摘要内容。",
|
||||
"ext_sum_injection_position": "插入位置",
|
||||
"ext_sum_include_wi_scan_desc": "在 WI 扫描中包括最新摘要。",
|
||||
"ext_sum_include_wi_scan": "纳入世界信息扫描",
|
||||
"None (not injected)": "无(未注入)",
|
||||
"ext_sum_injection_position_none": "摘要不会被注入到提示中。您仍然可以通过 {{summary}} 宏访问它。",
|
||||
"How many messages before the current end of the chat.": "当前聊天结束前还有多少条消息。",
|
||||
"Labels and Message": "标签和信息",
|
||||
"Label": "标签",
|
||||
"(label of the button, if no icon is chosen) ": "(如果没有选择图标,则为按钮的标签)",
|
||||
"Title": "标题",
|
||||
"(tooltip, leave empty to show message or /command)": "(工具提示,留空以显示消息或/命令)",
|
||||
"Message / Command:": "消息/命令:",
|
||||
|
@ -1348,6 +1381,8 @@
|
|||
"Inject user input automatically": "自动注入用户输入",
|
||||
"(if disabled, use ": "(如果禁用,使用",
|
||||
"macro for manual injection)": "宏用于手动注入)",
|
||||
"Color": "颜色",
|
||||
"Only apply color as accent": "仅应用颜色作为强调",
|
||||
"ext_regex_title": "正则",
|
||||
"ext_regex_new_global_script_desc": "新的全局正则表达式脚本",
|
||||
"ext_regex_new_global_script": "新建全局正则",
|
||||
|
@ -1361,7 +1396,7 @@
|
|||
"ext_regex_scoped_scripts_desc": "只影响当前角色,保存在角色卡片中",
|
||||
"Regex Editor": "正则表达式编辑器",
|
||||
"Test Mode": "测试模式",
|
||||
"ext_regex_desc": "Regex 是一款使用正则表达式查找/替换字符串的工具。如果您想了解更多信息,请点击标题旁边的 ?。",
|
||||
"ext_regex_desc": "正则是一款使用正则表达式查找/替换字符串的工具。如果您想了解更多信息,请点击标题旁边的 ?。",
|
||||
"Input": "输入",
|
||||
"ext_regex_test_input_placeholder": "在此输入...",
|
||||
"Output": "输出",
|
||||
|
@ -1396,6 +1431,7 @@
|
|||
"ext_regex_export_script": "导出脚本",
|
||||
"ext_regex_delete_script": "删除脚本",
|
||||
"Trigger Stable Diffusion": "触发Stable Diffusion",
|
||||
"Abort current image generation task": "中止当前图像生成",
|
||||
"sd_Yourself": "你自己",
|
||||
"sd_Your_Face": "你的脸",
|
||||
"sd_Me": "我",
|
||||
|
@ -1445,6 +1481,10 @@
|
|||
"Delete workflow": "删除工作流",
|
||||
"Enhance": "提高",
|
||||
"Refine": "优化",
|
||||
"API Key": "API 密钥",
|
||||
"Click to set": "点击设置",
|
||||
"You can find your API key in the Stability AI dashboard.": "您可以在 Stability AI 仪表板中找到您的 API 密钥。",
|
||||
"Style Preset": "风格预设",
|
||||
"Sampling method": "采样方法",
|
||||
"Scheduler": "调度器",
|
||||
"Resolution": "分辨率",
|
||||
|
@ -1545,6 +1585,10 @@
|
|||
"Only used when Main API is selected.": "仅在选择主 API 时使用。",
|
||||
"Old messages are vectorized gradually as you chat. To process all previous messages, click the button below.": "随着您聊天,旧消息会逐渐矢量化。\n要处理所有以前的消息,请单击下面的按钮。",
|
||||
"View Stats": "查看统计数据",
|
||||
"Title/Memo": "标题/备忘录",
|
||||
"Status": "状态",
|
||||
"Position": "位置",
|
||||
"Trigger %": "触发率 %",
|
||||
"Manager Users": "管理用户",
|
||||
"New User": "新用户",
|
||||
"Status:": "地位:",
|
||||
|
@ -1564,12 +1608,10 @@
|
|||
"New Tags": "新标签",
|
||||
"Folder Tags": "文件夹标签",
|
||||
"The following tags will be auto-imported based on the currently selected folders": "根据当前选定的文件夹将自动导入以下标签",
|
||||
"Remember my choice": "记住我的选择",
|
||||
"Remember the chosen import option If anything besides 'Cancel' is selected, this dialog will not show up anymore. To change this, go to the settings and modify \"Tag Import Option\". If the \"Import\" option is chosen, the global setting will stay on \"Ask\".": "记住所选的导入选项\n如果选择了“取消”以外的任何选项,此对话框将不再显示。\n要更改此设置,请转到设置并修改“标签导入选项”。\n\n如果选择了“导入”选项,则全局设置将保留为“询问”。",
|
||||
"Import None": "不导入",
|
||||
"Import All": "全部导入",
|
||||
"Import Existing": "导入现有",
|
||||
"Import tags button": "导入",
|
||||
"Import": "导入",
|
||||
"Include Body Parameters": "包括主体参数",
|
||||
"custom_include_body_desc": "聊天完成请求主体中要包含的参数(YAML 对象)\n\n示例:\n- top_k:20\n- repetition_penalty:1.1",
|
||||
"Exclude Body Parameters": "排除主体参数",
|
||||
|
@ -1671,6 +1713,9 @@
|
|||
"char_import_8": "RisuRealm 角色(直链)",
|
||||
"Supports importing multiple characters.": "支持导入多个角色。",
|
||||
"Write each URL or ID into a new line.": "将每个 URL 或 ID 写入新行。",
|
||||
"Show Raw Prompt": "显示原始提示",
|
||||
"Copy Prompt": "复制提示",
|
||||
"Show Prompt Differences": "显示提示差异",
|
||||
"System-wide Replacement Macros (in order of evaluation):": "系统范围的替换宏(按评估顺序):",
|
||||
"help_macros_1": "仅适用于斜线命令批处理。替换为上一个命令的返回结果。",
|
||||
"help_macros_2": "仅插入一个换行符。",
|
||||
|
@ -1687,6 +1732,7 @@
|
|||
"help_macros_13": "角色对话示例",
|
||||
"help_macros_14": "未格式化的对话示例",
|
||||
"(only for Story String)": "(仅适用于故事字符串)",
|
||||
"help_macros_summary": "“Summarize”扩展生成的最新聊天摘要(如果有)。",
|
||||
"help_macros_15": "您当前的 Persona 用户名",
|
||||
"help_macros_16": "角色的名字",
|
||||
"help_macros_17": "角色的版本号",
|
||||
|
@ -1700,6 +1746,7 @@
|
|||
"help_macros_22": "上下文中包含的第一条消息的 ID。要求在当前会话中至少运行一次生成。",
|
||||
"help_macros_23": "最后一条聊天消息中当前滑动的 ID(以 1 为基数)。如果最后一条消息是用户或提示隐藏的,则为空字符串。",
|
||||
"help_macros_24": "最后一条聊天消息中的滑动次数。如果最后一条消息是用户隐藏或提示隐藏的,则为空字符串。",
|
||||
"help_macros_reverse": "反转宏的内容。",
|
||||
"help_macros_25": "您可以在此处留言,宏将被替换为空白内容。AI 看不到。",
|
||||
"help_macros_26": "当前时间",
|
||||
"help_macros_27": "当前日期",
|
||||
|
@ -1738,6 +1785,8 @@
|
|||
"help_macros_56": "指示系统指令前缀",
|
||||
"help_macros_57": "指示第一个用户消息填充器",
|
||||
"help_macros_58": "指示停止顺序",
|
||||
"help_macros_first_user": "指示用户第一个输入序列",
|
||||
"help_macros_last_user": "指示用户最后输入序列",
|
||||
"Chat variables Macros:": "聊天变量宏:",
|
||||
"Local variables = unique to the current chat": "局部变量 = 当前聊天所独有",
|
||||
"Global variables = works in any chat for any character": "全局变量 = 适用于任何角色的任何聊天",
|
||||
|
@ -1769,10 +1818,22 @@
|
|||
"prompt_manager_tokens": "词符",
|
||||
"Are you sure you want to reset your settings to factory defaults?": "您确定要将设置重置为出厂默认设置吗?",
|
||||
"Don't forget to save a snapshot of your settings before proceeding.": "在继续之前,不要忘记保存您的设置快照。",
|
||||
"Chat Scenario Override": "聊天场景覆盖",
|
||||
"Remove": "移除",
|
||||
"Settings Snapshots": "设置快照",
|
||||
"Record a snapshot of your current settings.": "记录当前设置的快照。",
|
||||
"Make a Snapshot": "制作快照",
|
||||
"Restore this snapshot": "恢复此快照",
|
||||
"Download Model": "下载模型",
|
||||
"Downloader Options": "下载器选项",
|
||||
"Extra parameters for downloading/HuggingFace API": "下载/HuggingFace API 的额外参数。如果不确定,请将其留空。",
|
||||
"Revision": "修订",
|
||||
"Folder Name": "输出文件夹名称",
|
||||
"HF Token": "HF代币",
|
||||
"Include Patterns": "包含模式",
|
||||
"Glob patterns of files to include in the download.": "要包含在下载中的文件的全局模式。每个模式用换行符分隔。",
|
||||
"Exclude Patterns": "排除模式",
|
||||
"Glob patterns of files to exclude in the download.": "下载中要排除的文件的 Glob 模式。每个模式用换行符分隔。",
|
||||
"Hi,": "嘿,",
|
||||
"To enable multi-account features, restart the SillyTavern server with": "要启用多帐户功能,请使用以下命令重新启动 SillyTavern 服务器",
|
||||
"set to true in the config.yaml file.": "在 config.yaml 文件中设置为 true。",
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
"JSON Schema": "JSON 結構",
|
||||
"Type in the desired JSON schema": "輸入所需的 JSON 結構",
|
||||
"Grammar String": "語法字串",
|
||||
"GNBF or ENBF, depends on the backend in use. If you're using this you should know which.": "GNBF 或 ENBF,取決於所使用的後端。如果您使用此功能,應該知道是哪一種",
|
||||
"GBNF or EBNF, depends on the backend in use. If you're using this you should know which.": "GBNF 或 EBNF,取決於所使用的後端。如果您使用此功能,應該知道是哪一種",
|
||||
"Top P & Min P": "Top P 和 Min P",
|
||||
"Load default order": "載入預設順序",
|
||||
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "僅適用於 llama.cpp。決定取樣器的順序。如果 Mirostat 模式不為 0,則忽略取樣器順序。",
|
||||
|
@ -217,7 +217,7 @@
|
|||
"Character Names Behavior": "角色人物名稱行為",
|
||||
"Helps the model to associate messages with characters.": "幫助模型將訊息與角色人物關聯起來。",
|
||||
"None": "無",
|
||||
"character_names_none": "除了團體和過去的玩家角色人物外。否則,請確保在提示中提供名字。",
|
||||
"character_names_default": "除了團體和過去的玩家角色人物外。否則,請確保在提示中提供名字。",
|
||||
"Don't add character names.": "不要新增角色人物名稱",
|
||||
"Completion": "補充",
|
||||
"character_names_completion": "字元限制:僅限拉丁字母數字和底線。不適用於所有來源,特別是:Claude、MistralAI、Google。",
|
||||
|
|
458
public/script.js
458
public/script.js
|
@ -156,6 +156,7 @@ import {
|
|||
ensureImageFormatSupported,
|
||||
flashHighlight,
|
||||
isTrueBoolean,
|
||||
toggleDrawer,
|
||||
} from './scripts/utils.js';
|
||||
import { debounce_timeout } from './scripts/constants.js';
|
||||
|
||||
|
@ -224,10 +225,10 @@ import {
|
|||
import { getBackgrounds, initBackgrounds, loadBackgroundSettings, background_settings } from './scripts/backgrounds.js';
|
||||
import { hideLoader, showLoader } from './scripts/loader.js';
|
||||
import { BulkEditOverlay, CharacterContextMenu } from './scripts/BulkEditOverlay.js';
|
||||
import { loadFeatherlessModels, loadMancerModels, loadOllamaModels, loadTogetherAIModels, loadInfermaticAIModels, loadOpenRouterModels, loadVllmModels, loadAphroditeModels, loadDreamGenModels } from './scripts/textgen-models.js';
|
||||
import { loadFeatherlessModels, loadMancerModels, loadOllamaModels, loadTogetherAIModels, loadInfermaticAIModels, loadOpenRouterModels, loadVllmModels, loadAphroditeModels, loadDreamGenModels, initTextGenModels } from './scripts/textgen-models.js';
|
||||
import { appendFileContent, hasPendingFileAttachment, populateFileAttachment, decodeStyleTags, encodeStyleTags, isExternalMediaAllowed, getCurrentEntityId } from './scripts/chats.js';
|
||||
import { initPresetManager } from './scripts/preset-manager.js';
|
||||
import { MacrosParser, evaluateMacros } from './scripts/macros.js';
|
||||
import { MacrosParser, evaluateMacros, getLastMessageId } from './scripts/macros.js';
|
||||
import { currentUser, setUserControls } from './scripts/user.js';
|
||||
import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup, fixToastrForDialogs } from './scripts/popup.js';
|
||||
import { renderTemplate, renderTemplateAsync } from './scripts/templates.js';
|
||||
|
@ -424,6 +425,8 @@ export const event_types = {
|
|||
CHATCOMPLETION_MODEL_CHANGED: 'chatcompletion_model_changed',
|
||||
OAI_PRESET_CHANGED_BEFORE: 'oai_preset_changed_before',
|
||||
OAI_PRESET_CHANGED_AFTER: 'oai_preset_changed_after',
|
||||
OAI_PRESET_EXPORT_READY: 'oai_preset_export_ready',
|
||||
OAI_PRESET_IMPORT_READY: 'oai_preset_import_ready',
|
||||
WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated',
|
||||
WORLDINFO_UPDATED: 'worldinfo_updated',
|
||||
CHARACTER_EDITED: 'character_edited',
|
||||
|
@ -439,6 +442,7 @@ export const event_types = {
|
|||
GROUP_CHAT_CREATED: 'group_chat_created',
|
||||
GENERATE_BEFORE_COMBINE_PROMPTS: 'generate_before_combine_prompts',
|
||||
GENERATE_AFTER_COMBINE_PROMPTS: 'generate_after_combine_prompts',
|
||||
GENERATE_AFTER_DATA: 'generate_after_data',
|
||||
GROUP_MEMBER_DRAFTED: 'group_member_drafted',
|
||||
WORLD_INFO_ACTIVATED: 'world_info_activated',
|
||||
TEXT_COMPLETION_SETTINGS_READY: 'text_completion_settings_ready',
|
||||
|
@ -455,6 +459,7 @@ export const event_types = {
|
|||
LLM_FUNCTION_TOOL_REGISTER: 'llm_function_tool_register',
|
||||
LLM_FUNCTION_TOOL_CALL: 'llm_function_tool_call',
|
||||
ONLINE_STATUS_CHANGED: 'online_status_changed',
|
||||
IMAGE_SWIPED: 'image_swiped',
|
||||
};
|
||||
|
||||
export const eventSource = new EventEmitter();
|
||||
|
@ -570,6 +575,7 @@ export const system_message_types = {
|
|||
* @enum {number} Extension prompt types
|
||||
*/
|
||||
export const extension_prompt_types = {
|
||||
NONE: -1,
|
||||
IN_PROMPT: 0,
|
||||
IN_CHAT: 1,
|
||||
BEFORE_PROMPT: 2,
|
||||
|
@ -909,6 +915,7 @@ async function firstLoadInit() {
|
|||
await readSecretState();
|
||||
initLocales();
|
||||
initDefaultSlashCommands();
|
||||
initTextGenModels();
|
||||
await getSystemMessages();
|
||||
sendSystemMessage(system_message_types.WELCOME);
|
||||
await getSettings();
|
||||
|
@ -929,10 +936,17 @@ async function firstLoadInit() {
|
|||
initCfg();
|
||||
initLogprobs();
|
||||
doDailyExtensionUpdatesCheck();
|
||||
hideLoader();
|
||||
await hideLoader();
|
||||
await fixViewport();
|
||||
await eventSource.emit(event_types.APP_READY);
|
||||
}
|
||||
|
||||
async function fixViewport() {
|
||||
document.body.style.position = 'absolute';
|
||||
await delay(1);
|
||||
document.body.style.position = '';
|
||||
}
|
||||
|
||||
function cancelStatusCheck() {
|
||||
abortStatusCheck?.abort();
|
||||
abortStatusCheck = new AbortController();
|
||||
|
@ -1712,16 +1726,24 @@ export async function replaceCurrentChat() {
|
|||
}
|
||||
|
||||
export function showMoreMessages() {
|
||||
let messageId = Number($('#chat').children('.mes').first().attr('mesid'));
|
||||
const firstDisplayedMesId = $('#chat').children('.mes').first().attr('mesid');
|
||||
let messageId = Number(firstDisplayedMesId);
|
||||
let count = power_user.chat_truncation || Number.MAX_SAFE_INTEGER;
|
||||
|
||||
// If there are no messages displayed, or the message somehow has no mesid, we default to one higher than last message id,
|
||||
// so the first "new" message being shown will be the last available message
|
||||
if (isNaN(messageId)) {
|
||||
messageId = getLastMessageId() + 1;
|
||||
}
|
||||
|
||||
console.debug('Inserting messages before', messageId, 'count', count, 'chat length', chat.length);
|
||||
const prevHeight = $('#chat').prop('scrollHeight');
|
||||
|
||||
while (messageId > 0 && count > 0) {
|
||||
let newMessageId = messageId - 1;
|
||||
addOneMessage(chat[newMessageId], { insertBefore: messageId >= chat.length ? null : messageId, scroll: false, forceId: newMessageId });
|
||||
count--;
|
||||
messageId--;
|
||||
addOneMessage(chat[messageId], { insertBefore: messageId + 1, scroll: false, forceId: messageId });
|
||||
}
|
||||
|
||||
if (messageId == 0) {
|
||||
|
@ -2091,6 +2113,7 @@ export function updateMessageBlock(messageId, message) {
|
|||
export function appendMediaToMessage(mes, messageElement, adjustScroll = true) {
|
||||
// Add image to message
|
||||
if (mes.extra?.image) {
|
||||
const container = messageElement.find('.mes_img_container');
|
||||
const chatHeight = $('#chat').prop('scrollHeight');
|
||||
const image = messageElement.find('.mes_img');
|
||||
const text = messageElement.find('.mes_text');
|
||||
|
@ -2106,9 +2129,27 @@ export function appendMediaToMessage(mes, messageElement, adjustScroll = true) {
|
|||
});
|
||||
image.attr('src', mes.extra?.image);
|
||||
image.attr('title', mes.extra?.title || mes.title || '');
|
||||
messageElement.find('.mes_img_container').addClass('img_extra');
|
||||
container.addClass('img_extra');
|
||||
image.toggleClass('img_inline', isInline);
|
||||
text.toggleClass('displayNone', !isInline);
|
||||
|
||||
const imageSwipes = mes.extra.image_swipes;
|
||||
if (Array.isArray(imageSwipes) && imageSwipes.length > 0) {
|
||||
container.addClass('img_swipes');
|
||||
const counter = container.find('.mes_img_swipe_counter');
|
||||
const currentImage = imageSwipes.indexOf(mes.extra.image) + 1;
|
||||
counter.text(`${currentImage}/${imageSwipes.length}`);
|
||||
|
||||
const swipeLeft = container.find('.mes_img_swipe_left');
|
||||
swipeLeft.off('click').on('click', function () {
|
||||
eventSource.emit(event_types.IMAGE_SWIPED, { message: mes, element: messageElement, direction: 'left' });
|
||||
});
|
||||
|
||||
const swipeRight = container.find('.mes_img_swipe_right');
|
||||
swipeRight.off('click').on('click', function () {
|
||||
eventSource.emit(event_types.IMAGE_SWIPED, { message: mes, element: messageElement, direction: 'right' });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Add file to message
|
||||
|
@ -2462,26 +2503,30 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
|
|||
* @returns {string[]} Array of stopping strings
|
||||
*/
|
||||
export function getStoppingStrings(isImpersonate, isContinue) {
|
||||
const charString = `\n${name2}:`;
|
||||
const userString = `\n${name1}:`;
|
||||
const result = isImpersonate ? [charString] : [userString];
|
||||
const result = [];
|
||||
|
||||
result.push(userString);
|
||||
if (power_user.context.names_as_stop_strings) {
|
||||
const charString = `\n${name2}:`;
|
||||
const userString = `\n${name1}:`;
|
||||
result.push(isImpersonate ? charString : userString);
|
||||
|
||||
if (isContinue && Array.isArray(chat) && chat[chat.length - 1]?.is_user) {
|
||||
result.push(charString);
|
||||
}
|
||||
result.push(userString);
|
||||
|
||||
// Add other group members as the stopping strings
|
||||
if (selected_group) {
|
||||
const group = groups.find(x => x.id === selected_group);
|
||||
if (isContinue && Array.isArray(chat) && chat[chat.length - 1]?.is_user) {
|
||||
result.push(charString);
|
||||
}
|
||||
|
||||
if (group && Array.isArray(group.members)) {
|
||||
const names = group.members
|
||||
.map(x => characters.find(y => y.avatar == x))
|
||||
.filter(x => x && x.name && x.name !== name2)
|
||||
.map(x => `\n${x.name}:`);
|
||||
result.push(...names);
|
||||
// Add group members as stopping strings if generating for a specific group member or user. (Allow slash commands to work around name stopping string restrictions)
|
||||
if (selected_group && (name2 || isImpersonate)) {
|
||||
const group = groups.find(x => x.id === selected_group);
|
||||
|
||||
if (group && Array.isArray(group.members)) {
|
||||
const names = group.members
|
||||
.map(x => characters.find(y => y.avatar == x))
|
||||
.filter(x => x && x.name && x.name !== name2)
|
||||
.map(x => `\n${x.name}:`);
|
||||
result.push(...names);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2800,6 +2845,8 @@ class StreamingProcessor {
|
|||
this.messageDom = null;
|
||||
this.messageTextDom = null;
|
||||
this.messageTimerDom = null;
|
||||
this.messageTokenCounterDom = null;
|
||||
/** @type {HTMLTextAreaElement} */
|
||||
this.sendTextarea = document.querySelector('#send_textarea');
|
||||
this.type = type;
|
||||
this.force_name2 = force_name2;
|
||||
|
@ -2815,6 +2862,15 @@ class StreamingProcessor {
|
|||
this.messageLogprobs = [];
|
||||
}
|
||||
|
||||
#checkDomElements(messageId) {
|
||||
if (this.messageDom === null || this.messageTextDom === null) {
|
||||
this.messageDom = document.querySelector(`#chat .mes[mesid="${messageId}"]`);
|
||||
this.messageTextDom = this.messageDom?.querySelector('.mes_text');
|
||||
this.messageTimerDom = this.messageDom?.querySelector('.mes_timer');
|
||||
this.messageTokenCounterDom = this.messageDom?.querySelector('.tokenCounterDisplay');
|
||||
}
|
||||
}
|
||||
|
||||
showMessageButtons(messageId) {
|
||||
if (messageId == -1) {
|
||||
return;
|
||||
|
@ -2843,9 +2899,7 @@ class StreamingProcessor {
|
|||
else {
|
||||
await saveReply(this.type, text, true);
|
||||
messageId = chat.length - 1;
|
||||
this.messageDom = document.querySelector(`#chat .mes[mesid="${messageId}"]`);
|
||||
this.messageTextDom = this.messageDom.querySelector('.mes_text');
|
||||
this.messageTimerDom = this.messageDom.querySelector('.mes_timer');
|
||||
this.#checkDomElements(messageId);
|
||||
this.showMessageButtons(messageId);
|
||||
}
|
||||
|
||||
|
@ -2881,9 +2935,10 @@ class StreamingProcessor {
|
|||
this.sendTextarea.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}
|
||||
else {
|
||||
let currentTime = new Date();
|
||||
this.#checkDomElements(messageId);
|
||||
const currentTime = new Date();
|
||||
// Don't waste time calculating token count for streaming
|
||||
let currentTokenCount = isFinal && power_user.message_token_count_enabled ? getTokenCount(processedText, 0) : 0;
|
||||
const currentTokenCount = isFinal && power_user.message_token_count_enabled ? getTokenCount(processedText, 0) : 0;
|
||||
const timePassed = formatGenerationTimer(this.timeStarted, currentTime, currentTokenCount);
|
||||
chat[messageId]['mes'] = processedText;
|
||||
chat[messageId]['gen_started'] = this.timeStarted;
|
||||
|
@ -2895,8 +2950,9 @@ class StreamingProcessor {
|
|||
}
|
||||
|
||||
chat[messageId]['extra']['token_count'] = currentTokenCount;
|
||||
const tokenCounter = $(`#chat .mes[mesid="${messageId}"] .tokenCounterDisplay`);
|
||||
tokenCounter.text(`${currentTokenCount}t`);
|
||||
if (this.messageTokenCounterDom instanceof HTMLElement) {
|
||||
this.messageTokenCounterDom.textContent = `${currentTokenCount}t`;
|
||||
}
|
||||
}
|
||||
|
||||
if ((this.type == 'swipe' || this.type === 'continue') && Array.isArray(chat[messageId]['swipes'])) {
|
||||
|
@ -2904,16 +2960,20 @@ class StreamingProcessor {
|
|||
chat[messageId]['swipe_info'][chat[messageId]['swipe_id']] = { 'send_date': chat[messageId]['send_date'], 'gen_started': chat[messageId]['gen_started'], 'gen_finished': chat[messageId]['gen_finished'], 'extra': JSON.parse(JSON.stringify(chat[messageId]['extra'])) };
|
||||
}
|
||||
|
||||
let formattedText = messageFormatting(
|
||||
const formattedText = messageFormatting(
|
||||
processedText,
|
||||
chat[messageId].name,
|
||||
chat[messageId].is_system,
|
||||
chat[messageId].is_user,
|
||||
messageId,
|
||||
);
|
||||
this.messageTextDom.innerHTML = formattedText;
|
||||
this.messageTimerDom.textContent = timePassed.timerValue;
|
||||
this.messageTimerDom.title = timePassed.timerTitle;
|
||||
if (this.messageTextDom instanceof HTMLElement) {
|
||||
this.messageTextDom.innerHTML = formattedText;
|
||||
}
|
||||
if (this.messageTimerDom instanceof HTMLElement) {
|
||||
this.messageTimerDom.textContent = timePassed.timerValue;
|
||||
this.messageTimerDom.title = timePassed.timerTitle;
|
||||
}
|
||||
this.setFirstSwipe(messageId);
|
||||
}
|
||||
|
||||
|
@ -3199,6 +3259,23 @@ function restoreResponseLength(api, responseLength) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes last message from the chat DOM.
|
||||
* @returns {Promise<void>} Resolves when the message is removed.
|
||||
*/
|
||||
function removeLastMessage() {
|
||||
return new Promise((resolve) => {
|
||||
const lastMes = $('#chat').children('.mes').last();
|
||||
if (lastMes.length === 0) {
|
||||
return resolve();
|
||||
}
|
||||
lastMes.hide(animation_duration, function () {
|
||||
$(this).remove();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a generation using the current chat context.
|
||||
* @param {string} type Generation type
|
||||
|
@ -3331,9 +3408,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||
}
|
||||
else if (type !== 'quiet' && type !== 'swipe' && !isImpersonate && !dryRun && chat.length) {
|
||||
chat.length = chat.length - 1;
|
||||
$('#chat').children().last().hide(250, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
await removeLastMessage();
|
||||
await eventSource.emit(event_types.MESSAGE_DELETED, chat.length);
|
||||
}
|
||||
}
|
||||
|
@ -3581,6 +3656,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||
let chat2 = [];
|
||||
let continue_mag = '';
|
||||
const userMessageIndices = [];
|
||||
const lastUserMessageIndex = coreChat.findLastIndex(x => x.is_user);
|
||||
|
||||
for (let i = coreChat.length - 1, j = 0; i >= 0; i--, j++) {
|
||||
if (main_api == 'openai') {
|
||||
|
@ -3599,6 +3675,11 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||
chat2[i] = formatMessageHistoryItem(coreChat[j], isInstruct, force_output_sequence.FIRST);
|
||||
}
|
||||
|
||||
if (lastUserMessageIndex >= 0 && j === lastUserMessageIndex && isInstruct) {
|
||||
// Reformat with the last input sequence (if any)
|
||||
chat2[i] = formatMessageHistoryItem(coreChat[j], isInstruct, force_output_sequence.LAST);
|
||||
}
|
||||
|
||||
// Do not suffix the message for continuation
|
||||
if (i === 0 && isContinue) {
|
||||
if (isInstruct) {
|
||||
|
@ -3624,7 +3705,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||
mes: power_user.instruct.user_alignment_message,
|
||||
is_user: true,
|
||||
};
|
||||
userAlignmentMessage = formatMessageHistoryItem(alignmentMessage, isInstruct, false);
|
||||
userAlignmentMessage = formatMessageHistoryItem(alignmentMessage, isInstruct, force_output_sequence.FIRST);
|
||||
}
|
||||
|
||||
// Call combined AN into Generate
|
||||
|
@ -3886,7 +3967,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||
|
||||
// Get instruct mode line
|
||||
if (isInstruct && !isContinue) {
|
||||
const name = (quiet_prompt && !quietToLoud) ? (quietName ?? 'System') : (isImpersonate ? name1 : name2);
|
||||
const name = (quiet_prompt && !quietToLoud && !isImpersonate) ? (quietName ?? 'System') : (isImpersonate ? name1 : name2);
|
||||
const isQuiet = quiet_prompt && type == 'quiet';
|
||||
lastMesString += formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2, isQuiet, quietToLoud);
|
||||
}
|
||||
|
@ -4167,6 +4248,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||
}
|
||||
}
|
||||
|
||||
await eventSource.emit(event_types.GENERATE_AFTER_DATA, generate_data);
|
||||
|
||||
if (dryRun) {
|
||||
generatedPromptCache = '';
|
||||
return Promise.resolve();
|
||||
|
@ -4698,6 +4781,7 @@ export async function sendMessageAsUser(messageText, messageBias, insertAt = nul
|
|||
await eventSource.emit(event_types.MESSAGE_SENT, chat_id);
|
||||
addOneMessage(message);
|
||||
await eventSource.emit(event_types.USER_MESSAGE_RENDERED, chat_id);
|
||||
await saveChatConditional();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5029,7 +5113,7 @@ function setInContextMessages(lastmsg, type) {
|
|||
* @param {object} data Generation data
|
||||
* @returns {Promise<object>} Response data from the API
|
||||
*/
|
||||
async function sendGenerationRequest(type, data) {
|
||||
export async function sendGenerationRequest(type, data) {
|
||||
if (main_api === 'openai') {
|
||||
return await sendOpenAIRequest(type, data.prompt, abortController.signal);
|
||||
}
|
||||
|
@ -5061,7 +5145,7 @@ async function sendGenerationRequest(type, data) {
|
|||
* @param {object} data Generation data
|
||||
* @returns {Promise<any>} Streaming generator
|
||||
*/
|
||||
async function sendStreamingRequest(type, data) {
|
||||
export async function sendStreamingRequest(type, data) {
|
||||
if (abortController?.signal?.aborted) {
|
||||
throw new Error('Generation was aborted.');
|
||||
}
|
||||
|
@ -5342,9 +5426,11 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
|
|||
getMessage = fixMarkdown(getMessage, false);
|
||||
}
|
||||
|
||||
const nameToTrim2 = isImpersonate ? name1 : name2;
|
||||
const nameToTrim2 = isImpersonate
|
||||
? (!power_user.allow_name1_display ? name1 : '')
|
||||
: (!power_user.allow_name2_display ? name2 : '');
|
||||
|
||||
if (getMessage.startsWith(nameToTrim2 + ':')) {
|
||||
if (nameToTrim2 && getMessage.startsWith(nameToTrim2 + ':')) {
|
||||
getMessage = getMessage.replace(nameToTrim2 + ':', '');
|
||||
getMessage = getMessage.trimStart();
|
||||
}
|
||||
|
@ -5565,6 +5651,7 @@ export function activateSendButtons() {
|
|||
is_send_press = false;
|
||||
$('#send_but').removeClass('displayNone');
|
||||
$('#mes_continue').removeClass('displayNone');
|
||||
$('#mes_impersonate').removeClass('displayNone');
|
||||
$('.mes_buttons:last').show();
|
||||
hideStopButton();
|
||||
}
|
||||
|
@ -5572,6 +5659,7 @@ export function activateSendButtons() {
|
|||
export function deactivateSendButtons() {
|
||||
$('#send_but').addClass('displayNone');
|
||||
$('#mes_continue').addClass('displayNone');
|
||||
$('#mes_impersonate').addClass('displayNone');
|
||||
showStopButton();
|
||||
}
|
||||
|
||||
|
@ -6022,9 +6110,10 @@ async function getChatResult() {
|
|||
const message = getFirstMessage();
|
||||
if (message.mes) {
|
||||
chat.push(message);
|
||||
await saveChatConditional();
|
||||
freshChat = true;
|
||||
}
|
||||
// Make sure the chat appears on the server
|
||||
await saveChatConditional();
|
||||
}
|
||||
await loadItemizedPrompts(getCurrentChatId());
|
||||
await printMessages();
|
||||
|
@ -6076,7 +6165,7 @@ export async function openCharacterChat(file_name) {
|
|||
chat_metadata = {};
|
||||
await getChat();
|
||||
$('#selected_chat_pole').val(file_name);
|
||||
await createOrEditCharacter();
|
||||
await createOrEditCharacter(new CustomEvent('newChat'));
|
||||
}
|
||||
|
||||
////////// OPTIMZED MAIN API CHANGE FUNCTION ////////////
|
||||
|
@ -6361,7 +6450,7 @@ export async function getSettings() {
|
|||
loadHordeSettings(settings);
|
||||
|
||||
// Load power user settings
|
||||
loadPowerUserSettings(settings, data);
|
||||
await loadPowerUserSettings(settings, data);
|
||||
|
||||
// Load character tags
|
||||
loadTagsSettings(settings);
|
||||
|
@ -6778,6 +6867,11 @@ export async function displayPastChats() {
|
|||
const fileName = chat['file_name'];
|
||||
const chatContent = rawChats[fileName];
|
||||
|
||||
// Make sure empty chats are displayed when there is no search query
|
||||
if (Array.isArray(chatContent) && !chatContent.length && !searchQuery) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// // Uncomment this to return to old behavior (classical full-substring search).
|
||||
// return chatContent && Object.values(chatContent).some(message => message?.mes?.toLowerCase()?.includes(searchQuery.toLowerCase()));
|
||||
|
||||
|
@ -7866,6 +7960,8 @@ window['SillyTavern'].getContext = function () {
|
|||
eventTypes: event_types,
|
||||
addOneMessage: addOneMessage,
|
||||
generate: Generate,
|
||||
sendStreamingRequest: sendStreamingRequest,
|
||||
sendGenerationRequest: sendGenerationRequest,
|
||||
stopGeneration: stopGeneration,
|
||||
getTokenCount: getTokenCount,
|
||||
extensionPrompts: extension_prompts,
|
||||
|
@ -8259,6 +8355,7 @@ const swipe_right = () => {
|
|||
};
|
||||
|
||||
const CONNECT_API_MAP = {
|
||||
// Default APIs not contined inside text gen / chat gen
|
||||
'kobold': {
|
||||
selected: 'kobold',
|
||||
button: '#api_button',
|
||||
|
@ -8270,147 +8367,48 @@ const CONNECT_API_MAP = {
|
|||
selected: 'novel',
|
||||
button: '#api_button_novel',
|
||||
},
|
||||
'ooba': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.OOBA,
|
||||
},
|
||||
'tabby': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.TABBY,
|
||||
},
|
||||
'llamacpp': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.LLAMACPP,
|
||||
},
|
||||
'ollama': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.OLLAMA,
|
||||
},
|
||||
'mancer': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.MANCER,
|
||||
},
|
||||
'vllm': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.VLLM,
|
||||
},
|
||||
'aphrodite': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.APHRODITE,
|
||||
},
|
||||
'koboldcpp': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.KOBOLDCPP,
|
||||
},
|
||||
// KoboldCpp alias
|
||||
'kcpp': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.KOBOLDCPP,
|
||||
},
|
||||
'togetherai': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.TOGETHERAI,
|
||||
},
|
||||
'openai': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.OPENAI,
|
||||
},
|
||||
// OpenAI alias
|
||||
'oai': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.OPENAI,
|
||||
},
|
||||
'claude': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.CLAUDE,
|
||||
},
|
||||
'windowai': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.WINDOWAI,
|
||||
},
|
||||
// OpenRouter special naming, to differentiate between chat comp and text comp
|
||||
'openrouter': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.OPENROUTER,
|
||||
},
|
||||
'scale': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.SCALE,
|
||||
},
|
||||
'ai21': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.AI21,
|
||||
},
|
||||
'makersuite': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.MAKERSUITE,
|
||||
},
|
||||
'mistralai': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.MISTRALAI,
|
||||
},
|
||||
'custom': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.CUSTOM,
|
||||
},
|
||||
'cohere': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.COHERE,
|
||||
},
|
||||
'perplexity': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.PERPLEXITY,
|
||||
},
|
||||
'groq': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.GROQ,
|
||||
},
|
||||
'01ai': {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chat_completion_sources.ZEROONEAI,
|
||||
},
|
||||
'infermaticai': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.INFERMATICAI,
|
||||
},
|
||||
'dreamgen': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.DREAMGEN,
|
||||
},
|
||||
'openrouter-text': {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.OPENROUTER,
|
||||
},
|
||||
'huggingface': {
|
||||
};
|
||||
|
||||
// Fill connections map from textgen_types and chat_completion_sources
|
||||
for (const textGenType of Object.values(textgen_types)) {
|
||||
if (CONNECT_API_MAP[textGenType]) continue;
|
||||
CONNECT_API_MAP[textGenType] = {
|
||||
selected: 'textgenerationwebui',
|
||||
button: '#api_button_textgenerationwebui',
|
||||
type: textgen_types.HUGGINGFACE,
|
||||
},
|
||||
};
|
||||
type: textGenType,
|
||||
};
|
||||
}
|
||||
for (const chatCompletionSource of Object.values(chat_completion_sources)) {
|
||||
if (CONNECT_API_MAP[chatCompletionSource]) continue;
|
||||
CONNECT_API_MAP[chatCompletionSource] = {
|
||||
selected: 'openai',
|
||||
button: '#api_button_openai',
|
||||
source: chatCompletionSource,
|
||||
};
|
||||
}
|
||||
|
||||
async function selectContextCallback(_, name) {
|
||||
if (!name) {
|
||||
|
@ -8543,7 +8541,7 @@ export async function processDroppedFiles(files, data = new Map()) {
|
|||
|
||||
for (const file of files) {
|
||||
const extension = file.name.split('.').pop().toLowerCase();
|
||||
if (allowedMimeTypes.includes(file.type) || allowedExtensions.includes(extension)) {
|
||||
if (allowedMimeTypes.some(x => file.type.startsWith(x)) || allowedExtensions.includes(extension)) {
|
||||
const preservedName = data instanceof Map && data.get(file);
|
||||
await importCharacter(file, preservedName);
|
||||
} else {
|
||||
|
@ -9142,14 +9140,14 @@ jQuery(async function () {
|
|||
$('#send_textarea').on('focusin focus click', () => {
|
||||
S_TAPreviouslyFocused = true;
|
||||
});
|
||||
$('#send_but, #option_regenerate, #option_continue, #mes_continue').on('click', () => {
|
||||
$('#send_but, #option_regenerate, #option_continue, #mes_continue, #mes_impersonate').on('click', () => {
|
||||
if (S_TAPreviouslyFocused) {
|
||||
$('#send_textarea').focus();
|
||||
}
|
||||
});
|
||||
$(document).click(event => {
|
||||
if ($(':focus').attr('id') !== 'send_textarea') {
|
||||
var validIDs = ['options_button', 'send_but', 'mes_continue', 'send_textarea', 'option_regenerate', 'option_continue'];
|
||||
var validIDs = ['options_button', 'send_but', 'mes_impersonate', 'mes_continue', 'send_textarea', 'option_regenerate', 'option_continue'];
|
||||
if (!validIDs.includes($(event.target).attr('id'))) {
|
||||
S_TAPreviouslyFocused = false;
|
||||
}
|
||||
|
@ -9185,6 +9183,9 @@ jQuery(async function () {
|
|||
debouncedCharacterSearch(searchQuery);
|
||||
});
|
||||
|
||||
$('#mes_impersonate').on('click', function () {
|
||||
$('#option_impersonate').trigger('click');
|
||||
});
|
||||
|
||||
$('#mes_continue').on('click', function () {
|
||||
$('#option_continue').trigger('click');
|
||||
|
@ -9806,8 +9807,8 @@ jQuery(async function () {
|
|||
hideMenu();
|
||||
});
|
||||
|
||||
$('#newChatFromManageScreenButton').on('click', function () {
|
||||
doNewChat({ deleteCurrentChat: false });
|
||||
$('#newChatFromManageScreenButton').on('click', async function () {
|
||||
await doNewChat({ deleteCurrentChat: false });
|
||||
$('#select_chat_cross').trigger('click');
|
||||
});
|
||||
|
||||
|
@ -10482,8 +10483,9 @@ jQuery(async function () {
|
|||
}
|
||||
|
||||
// Set the height of "autoSetHeight" textareas within the drawer to their scroll height
|
||||
$(this).closest('.drawer').find('.drawer-content textarea.autoSetHeight').each(function () {
|
||||
resetScrollHeight($(this));
|
||||
$(this).closest('.drawer').find('.drawer-content textarea.autoSetHeight').each(async function () {
|
||||
await resetScrollHeight($(this));
|
||||
return;
|
||||
});
|
||||
|
||||
} else if (drawerWasOpenAlready) { //to close manually
|
||||
|
@ -10556,8 +10558,9 @@ jQuery(async function () {
|
|||
$(this).closest('.inline-drawer').find('.inline-drawer-content').stop().slideToggle();
|
||||
|
||||
// Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height
|
||||
$(this).closest('.inline-drawer').find('.inline-drawer-content textarea.autoSetHeight').each(function () {
|
||||
resetScrollHeight($(this));
|
||||
$(this).closest('.inline-drawer').find('.inline-drawer-content textarea.autoSetHeight').each(async function () {
|
||||
await resetScrollHeight($(this));
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -10638,12 +10641,19 @@ jQuery(async function () {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '#OpenAllWIEntries', function () {
|
||||
$('#world_popup_entries_list').children().find('.down').click();
|
||||
});
|
||||
$(document).on('click', '#CloseAllWIEntries', function () {
|
||||
$('#world_popup_entries_list').children().find('.up').click();
|
||||
document.addEventListener('click', function (e) {
|
||||
if (!(e.target instanceof HTMLElement)) return;
|
||||
if (e.target.matches('#OpenAllWIEntries')) {
|
||||
document.querySelectorAll('#world_popup_entries_list .inline-drawer').forEach((/** @type {HTMLElement} */ drawer) => {
|
||||
toggleDrawer(drawer, true);
|
||||
});
|
||||
} else if (e.target.matches('#CloseAllWIEntries')) {
|
||||
document.querySelectorAll('#world_popup_entries_list .inline-drawer').forEach((/** @type {HTMLElement} */ drawer) => {
|
||||
toggleDrawer(drawer, false);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.open_alternate_greetings', openAlternateGreetings);
|
||||
/* $('#set_character_world').on('click', openCharacterWorldPopup); */
|
||||
|
||||
|
@ -10738,7 +10748,7 @@ jQuery(async function () {
|
|||
}
|
||||
} break;
|
||||
case 'import_tags': {
|
||||
await importTags(characters[this_chid], { forceShow: true });
|
||||
await importTags(characters[this_chid], { importSetting: tag_import_setting.ASK });
|
||||
} break;
|
||||
/*case 'delete_button':
|
||||
popup_type = "del_ch";
|
||||
|
@ -10767,62 +10777,66 @@ jQuery(async function () {
|
|||
var isManualInput = false;
|
||||
var valueBeforeManualInput;
|
||||
|
||||
$('.range-block-counter input, .neo-range-input').on('click', function () {
|
||||
$(document).on('input', '.range-block-counter input, .neo-range-input', function () {
|
||||
valueBeforeManualInput = $(this).val();
|
||||
console.log(valueBeforeManualInput);
|
||||
})
|
||||
.on('change', function (e) {
|
||||
e.target.focus();
|
||||
e.target.dispatchEvent(new Event('keyup'));
|
||||
})
|
||||
.on('keydown', function (e) {
|
||||
const masterSelector = '#' + $(this).data('for');
|
||||
const masterElement = $(masterSelector);
|
||||
if (e.key === 'Enter') {
|
||||
let manualInput = Number($(this).val());
|
||||
if (isManualInput) {
|
||||
//disallow manual inputs outside acceptable range
|
||||
if (manualInput >= Number($(this).attr('min')) && manualInput <= Number($(this).attr('max'))) {
|
||||
//if value is ok, assign to slider and update handle text and position
|
||||
//newSlider.val(manualInput)
|
||||
//handleSlideEvent.call(newSlider, null, { value: parseFloat(manualInput) }, 'manual');
|
||||
valueBeforeManualInput = manualInput;
|
||||
$(masterElement).val($(this).val()).trigger('input');
|
||||
} else {
|
||||
//if value not ok, warn and reset to last known valid value
|
||||
toastr.warning(`Invalid value. Must be between ${$(this).attr('min')} and ${$(this).attr('max')}`);
|
||||
console.log(valueBeforeManualInput);
|
||||
//newSlider.val(valueBeforeManualInput)
|
||||
$(this).val(valueBeforeManualInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.on('keyup', function () {
|
||||
valueBeforeManualInput = $(this).val();
|
||||
console.log(valueBeforeManualInput);
|
||||
isManualInput = true;
|
||||
})
|
||||
//trigger slider changes when user clicks away
|
||||
.on('mouseup blur', function () {
|
||||
const masterSelector = '#' + $(this).data('for');
|
||||
const masterElement = $(masterSelector);
|
||||
});
|
||||
|
||||
$(document).on('change', '.range-block-counter input, .neo-range-input', function (e) {
|
||||
e.target.focus();
|
||||
e.target.dispatchEvent(new KeyboardEvent('keyup', { bubbles: true }));
|
||||
});
|
||||
|
||||
$(document).on('keydown', '.range-block-counter input, .neo-range-input', function (e) {
|
||||
const masterSelector = '#' + $(this).data('for');
|
||||
const masterElement = $(masterSelector);
|
||||
if (e.key === 'Enter') {
|
||||
let manualInput = Number($(this).val());
|
||||
if (isManualInput) {
|
||||
//if value is between correct range for the slider
|
||||
//disallow manual inputs outside acceptable range
|
||||
if (manualInput >= Number($(this).attr('min')) && manualInput <= Number($(this).attr('max'))) {
|
||||
//if value is ok, assign to slider and update handle text and position
|
||||
//newSlider.val(manualInput)
|
||||
//handleSlideEvent.call(newSlider, null, { value: parseFloat(manualInput) }, 'manual');
|
||||
valueBeforeManualInput = manualInput;
|
||||
//set the slider value to input value
|
||||
$(masterElement).val($(this).val()).trigger('input');
|
||||
$(masterElement).val($(this).val()).trigger('input', { forced: true });
|
||||
} else {
|
||||
//if value not ok, warn and reset to last known valid value
|
||||
toastr.warning(`Invalid value. Must be between ${$(this).attr('min')} and ${$(this).attr('max')}`);
|
||||
console.log(valueBeforeManualInput);
|
||||
//newSlider.val(valueBeforeManualInput)
|
||||
$(this).val(valueBeforeManualInput);
|
||||
}
|
||||
}
|
||||
isManualInput = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('keyup', '.range-block-counter input, .neo-range-input', function () {
|
||||
valueBeforeManualInput = $(this).val();
|
||||
console.log(valueBeforeManualInput);
|
||||
isManualInput = true;
|
||||
});
|
||||
|
||||
//trigger slider changes when user clicks away
|
||||
$(document).on('mouseup blur', '.range-block-counter input, .neo-range-input', function () {
|
||||
const masterSelector = '#' + $(this).data('for');
|
||||
const masterElement = $(masterSelector);
|
||||
let manualInput = Number($(this).val());
|
||||
if (isManualInput) {
|
||||
//if value is between correct range for the slider
|
||||
if (manualInput >= Number($(this).attr('min')) && manualInput <= Number($(this).attr('max'))) {
|
||||
valueBeforeManualInput = manualInput;
|
||||
//set the slider value to input value
|
||||
$(masterElement).val($(this).val()).trigger('input', { forced: true });
|
||||
} else {
|
||||
//if value not ok, warn and reset to last known valid value
|
||||
toastr.warning(`Invalid value. Must be between ${$(this).attr('min')} and ${$(this).attr('max')}`);
|
||||
console.log(valueBeforeManualInput);
|
||||
$(this).val(valueBeforeManualInput);
|
||||
}
|
||||
}
|
||||
isManualInput = false;
|
||||
});
|
||||
|
||||
$('.user_stats_button').on('click', function () {
|
||||
userStatsHandler();
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
import { favsToHotswap } from './RossAscends-mods.js';
|
||||
import { hideLoader, showLoader } from './loader.js';
|
||||
import { convertCharacterToPersona } from './personas.js';
|
||||
import { createTagInput, getTagKeyForEntity, getTagsList, printTagList, tag_map, compareTagsForSort, removeTagFromMap } from './tags.js';
|
||||
import { createTagInput, getTagKeyForEntity, getTagsList, printTagList, tag_map, compareTagsForSort, removeTagFromMap, importTags, tag_import_setting } from './tags.js';
|
||||
|
||||
/**
|
||||
* Static object representing the actions of the
|
||||
|
@ -197,10 +197,10 @@ class BulkTagPopupHandler {
|
|||
#getHtml = () => {
|
||||
const characterData = JSON.stringify({ characterIds: this.characterIds });
|
||||
return `<div id="bulk_tag_shadow_popup">
|
||||
<div id="bulk_tag_popup">
|
||||
<div id="bulk_tag_popup" class="wider_dialogue_popup">
|
||||
<div id="bulk_tag_popup_holder">
|
||||
<h3 class="marginBot5">Modify tags of ${this.characterIds.length} characters</h3>
|
||||
<small class="bulk_tags_desc m-b-1">Add or remove the mutual tags of all selected characters.</small>
|
||||
<small class="bulk_tags_desc m-b-1">Add or remove the mutual tags of all selected characters. Import all or existing tags for all selected characters.</small>
|
||||
<div id="bulk_tags_avatars_block" class="avatars_inline avatars_inline_small tags tags_inline"></div>
|
||||
<br>
|
||||
<div id="bulk_tags_div" class="marginBot5" data-characters='${characterData}'>
|
||||
|
@ -219,6 +219,12 @@ class BulkTagPopupHandler {
|
|||
<i class="fa-solid fa-trash-can margin-right-10px"></i>
|
||||
Mutual
|
||||
</div>
|
||||
<div id="bulk_tag_popup_import_all_tags" class="menu_button" title="Import all tags from selected characters" data-i18n="[title]Import all tags from selected characters">
|
||||
Import All
|
||||
</div>
|
||||
<div id="bulk_tag_popup_import_existing_tags" class="menu_button" title="Import existing tags from selected characters" data-i18n="[title]Import existing tags from selected characters">
|
||||
Import Existing
|
||||
</div>
|
||||
<div id="bulk_tag_popup_cancel" class="menu_button" data-i18n="Cancel">Close</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -254,6 +260,30 @@ class BulkTagPopupHandler {
|
|||
document.querySelector('#bulk_tag_popup_reset').addEventListener('click', this.resetTags.bind(this));
|
||||
document.querySelector('#bulk_tag_popup_remove_mutual').addEventListener('click', this.removeMutual.bind(this));
|
||||
document.querySelector('#bulk_tag_popup_cancel').addEventListener('click', this.hide.bind(this));
|
||||
document.querySelector('#bulk_tag_popup_import_all_tags').addEventListener('click', this.importAllTags.bind(this));
|
||||
document.querySelector('#bulk_tag_popup_import_existing_tags').addEventListener('click', this.importExistingTags.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Import existing tags for all selected characters
|
||||
*/
|
||||
async importExistingTags() {
|
||||
for (const characterId of this.characterIds) {
|
||||
await importTags(characters[characterId], { importSetting: tag_import_setting.ONLY_EXISTING });
|
||||
}
|
||||
|
||||
$('#bulkTagList').empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import all tags for all selected characters
|
||||
*/
|
||||
async importAllTags() {
|
||||
for (const characterId of this.characterIds) {
|
||||
await importTags(characters[characterId], { importSetting: tag_import_setting.ALL });
|
||||
}
|
||||
|
||||
$('#bulkTagList').empty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -570,7 +600,7 @@ class BulkEditOverlay {
|
|||
this.container.removeEventListener('mouseup', cancelHold);
|
||||
this.container.removeEventListener('touchend', cancelHold);
|
||||
},
|
||||
BulkEditOverlay.longPressDelay);
|
||||
BulkEditOverlay.longPressDelay);
|
||||
};
|
||||
|
||||
handleLongPressEnd = (event) => {
|
||||
|
|
|
@ -157,18 +157,15 @@ export function shouldSendOnEnter() {
|
|||
//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 HumanizedDateTime =
|
||||
humanYear + '-' + humanMonth + '-' + humanDate + '@' + humanHour + 'h' + humanMinute + 'm' + humanSecond + 's';
|
||||
return HumanizedDateTime;
|
||||
const now = new Date(Date.now());
|
||||
const dt = {
|
||||
year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(),
|
||||
hour: now.getHours(), minute: now.getMinutes(), second: now.getSeconds(),
|
||||
};
|
||||
for (const key in dt) {
|
||||
dt[key] = dt[key].toString().padStart(2, '0');
|
||||
}
|
||||
return `${dt.year}-${dt.month}-${dt.day}@${dt.hour}h${dt.minute}m${dt.second}s`;
|
||||
}
|
||||
|
||||
//this is a common format version to display a timestamp on each chat message
|
||||
|
@ -314,6 +311,7 @@ function RA_checkOnlineStatus() {
|
|||
$('#send_form').addClass('no-connection'); //entire input form area is red when not connected
|
||||
$('#send_but').addClass('displayNone'); //send button is hidden when not connected;
|
||||
$('#mes_continue').addClass('displayNone'); //continue button is hidden when not connected;
|
||||
$('#mes_impersonate').addClass('displayNone'); //continue button is hidden when not connected;
|
||||
$('#API-status-top').removeClass('fa-plug');
|
||||
$('#API-status-top').addClass('fa-plug-circle-exclamation redOverlayGlow');
|
||||
connection_made = false;
|
||||
|
@ -330,6 +328,7 @@ function RA_checkOnlineStatus() {
|
|||
if (!is_send_press && !(selected_group && is_group_generating)) {
|
||||
$('#send_but').removeClass('displayNone'); //on connect, send button shows
|
||||
$('#mes_continue').removeClass('displayNone'); //continue button is shown when connected
|
||||
$('#mes_impersonate').removeClass('displayNone'); //continue button is shown when connected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -381,6 +380,7 @@ function RA_autoconnect(PrevApi) {
|
|||
|| (secret_state[SECRET_KEYS.PERPLEXITY] && oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY)
|
||||
|| (secret_state[SECRET_KEYS.GROQ] && oai_settings.chat_completion_source == chat_completion_sources.GROQ)
|
||||
|| (secret_state[SECRET_KEYS.ZEROONEAI] && oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI)
|
||||
|| (secret_state[SECRET_KEYS.BLOCKENTROPY] && oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY)
|
||||
|| (isValidUrl(oai_settings.custom_url) && oai_settings.chat_completion_source == chat_completion_sources.CUSTOM)
|
||||
) {
|
||||
$('#api_button_openai').trigger('click');
|
||||
|
|
|
@ -16,8 +16,15 @@ export const AUTOCOMPLETE_WIDTH = {
|
|||
'FULL': 2,
|
||||
};
|
||||
|
||||
/**@readonly*/
|
||||
/**@enum {Number}*/
|
||||
export const AUTOCOMPLETE_SELECT_KEY = {
|
||||
'TAB': 1, // 2^0
|
||||
'ENTER': 2, // 2^1
|
||||
};
|
||||
|
||||
export class AutoComplete {
|
||||
/**@type {HTMLTextAreaElement}*/ textarea;
|
||||
/**@type {HTMLTextAreaElement|HTMLInputElement}*/ textarea;
|
||||
/**@type {boolean}*/ isFloating = false;
|
||||
/**@type {()=>boolean}*/ checkIfActivate;
|
||||
/**@type {(text:string, index:number) => Promise<AutoCompleteNameResult>}*/ getNameAt;
|
||||
|
@ -56,6 +63,8 @@ export class AutoComplete {
|
|||
/**@type {function}*/ updateDetailsPositionDebounced;
|
||||
/**@type {function}*/ updateFloatingPositionDebounced;
|
||||
|
||||
/**@type {(item:AutoCompleteOption)=>any}*/ onSelect;
|
||||
|
||||
get matchType() {
|
||||
return power_user.stscript.matching ?? 'fuzzy';
|
||||
}
|
||||
|
@ -68,7 +77,7 @@ export class AutoComplete {
|
|||
|
||||
|
||||
/**
|
||||
* @param {HTMLTextAreaElement} textarea The textarea to receive autocomplete.
|
||||
* @param {HTMLTextAreaElement|HTMLInputElement} textarea The textarea to receive autocomplete.
|
||||
* @param {() => boolean} checkIfActivate Function should return true only if under the current conditions, autocomplete should display (e.g., for slash commands: autoComplete.text[0] == '/')
|
||||
* @param {(text: string, index: number) => Promise<AutoCompleteNameResult>} getNameAt Function should return (unfiltered, matching against input is done in AutoComplete) information about name options at index in text.
|
||||
* @param {boolean} isFloating Whether autocomplete should float at the keyboard cursor.
|
||||
|
@ -102,10 +111,15 @@ export class AutoComplete {
|
|||
this.updateDetailsPositionDebounced = debounce(this.updateDetailsPosition.bind(this), 10);
|
||||
this.updateFloatingPositionDebounced = debounce(this.updateFloatingPosition.bind(this), 10);
|
||||
|
||||
textarea.addEventListener('input', ()=>this.text != this.textarea.value && this.show(true, this.wasForced));
|
||||
textarea.addEventListener('input', ()=>{
|
||||
this.selectionStart = this.textarea.selectionStart;
|
||||
if (this.text != this.textarea.value) this.show(true, this.wasForced);
|
||||
});
|
||||
textarea.addEventListener('keydown', (evt)=>this.handleKeyDown(evt));
|
||||
textarea.addEventListener('click', ()=>this.isActive ? this.show() : null);
|
||||
textarea.addEventListener('selectionchange', ()=>this.show());
|
||||
textarea.addEventListener('click', ()=>{
|
||||
this.selectionStart = this.textarea.selectionStart;
|
||||
if (this.isActive) this.show();
|
||||
});
|
||||
textarea.addEventListener('blur', ()=>this.hide());
|
||||
if (isFloating) {
|
||||
textarea.addEventListener('scroll', ()=>this.updateFloatingPositionDebounced());
|
||||
|
@ -189,6 +203,11 @@ export class AutoComplete {
|
|||
* @returns The option.
|
||||
*/
|
||||
fuzzyScore(option) {
|
||||
// might have been matched by the options matchProvider function instead
|
||||
if (!this.fuzzyRegex.test(option.name)) {
|
||||
option.score = new AutoCompleteFuzzyScore(Number.MAX_SAFE_INTEGER, -1);
|
||||
return option;
|
||||
}
|
||||
const parts = this.fuzzyRegex.exec(option.name).slice(1, -1);
|
||||
let start = null;
|
||||
let consecutive = [];
|
||||
|
@ -339,7 +358,7 @@ export class AutoComplete {
|
|||
|
||||
this.result = this.effectiveParserResult.optionList
|
||||
// filter the list of options by the partial name according to the matching type
|
||||
.filter(it => this.isReplaceable || it.name == '' ? matchers[this.matchType](it.name) : it.name.toLowerCase() == this.name)
|
||||
.filter(it => this.isReplaceable || it.name == '' ? (it.matchProvider ? it.matchProvider(this.name) : matchers[this.matchType](it.name)) : it.name.toLowerCase() == this.name)
|
||||
// remove aliases
|
||||
.filter((it,idx,list) => list.findIndex(opt=>opt.value == it.value) == idx);
|
||||
|
||||
|
@ -357,10 +376,11 @@ export class AutoComplete {
|
|||
// build element
|
||||
option.dom = this.makeItem(option);
|
||||
// update replacer and add quotes if necessary
|
||||
const optionName = option.valueProvider ? option.valueProvider(this.name) : option.name;
|
||||
if (this.effectiveParserResult.canBeQuoted) {
|
||||
option.replacer = option.name.includes(' ') || this.startQuote || this.endQuote ? `"${option.name}"` : `${option.name}`;
|
||||
option.replacer = optionName.includes(' ') || this.startQuote || this.endQuote ? `"${optionName.replace(/"/g, '\\"')}"` : `${optionName}`;
|
||||
} else {
|
||||
option.replacer = option.name;
|
||||
option.replacer = optionName;
|
||||
}
|
||||
// calculate fuzzy score if matching is fuzzy
|
||||
if (this.matchType == 'fuzzy') this.fuzzyScore(option);
|
||||
|
@ -399,7 +419,7 @@ export class AutoComplete {
|
|||
,
|
||||
);
|
||||
this.result.push(option);
|
||||
} else if (this.result.length == 1 && this.effectiveParserResult && this.result[0].name == this.effectiveParserResult.name) {
|
||||
} else if (this.result.length == 1 && this.effectiveParserResult && this.effectiveParserResult != this.secondaryParserResult && this.result[0].name == this.effectiveParserResult.name) {
|
||||
// only one result that is exactly the current value? just show hint, no autocomplete
|
||||
this.isReplaceable = false;
|
||||
this.isShowingDetails = false;
|
||||
|
@ -439,11 +459,14 @@ export class AutoComplete {
|
|||
} else {
|
||||
item.dom.classList.remove('selected');
|
||||
}
|
||||
if (!item.isSelectable) {
|
||||
item.dom.classList.add('not-selectable');
|
||||
}
|
||||
frag.append(item.dom);
|
||||
}
|
||||
this.dom.append(frag);
|
||||
this.updatePosition();
|
||||
getTopmostModalLayer().append(this.domWrap);
|
||||
this.getLayer().append(this.domWrap);
|
||||
} else {
|
||||
this.domWrap.remove();
|
||||
}
|
||||
|
@ -458,10 +481,17 @@ export class AutoComplete {
|
|||
if (!this.isShowingDetails && this.isReplaceable) return this.detailsWrap.remove();
|
||||
this.detailsDom.innerHTML = '';
|
||||
this.detailsDom.append(this.selectedItem?.renderDetails() ?? 'NO ITEM');
|
||||
getTopmostModalLayer().append(this.detailsWrap);
|
||||
this.getLayer().append(this.detailsWrap);
|
||||
this.updateDetailsPositionDebounced();
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {HTMLElement} closest ancestor dialog or body
|
||||
*/
|
||||
getLayer() {
|
||||
return this.textarea.closest('dialog, body');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -474,7 +504,7 @@ export class AutoComplete {
|
|||
const rect = {};
|
||||
rect[AUTOCOMPLETE_WIDTH.INPUT] = this.textarea.getBoundingClientRect();
|
||||
rect[AUTOCOMPLETE_WIDTH.CHAT] = document.querySelector('#sheld').getBoundingClientRect();
|
||||
rect[AUTOCOMPLETE_WIDTH.FULL] = getTopmostModalLayer().getBoundingClientRect();
|
||||
rect[AUTOCOMPLETE_WIDTH.FULL] = this.getLayer().getBoundingClientRect();
|
||||
this.domWrap.style.setProperty('--bottom', `${window.innerHeight - rect[AUTOCOMPLETE_WIDTH.INPUT].top}px`);
|
||||
this.dom.style.setProperty('--bottom', `${window.innerHeight - rect[AUTOCOMPLETE_WIDTH.INPUT].top}px`);
|
||||
this.domWrap.style.bottom = `${window.innerHeight - rect[AUTOCOMPLETE_WIDTH.INPUT].top}px`;
|
||||
|
@ -501,7 +531,7 @@ export class AutoComplete {
|
|||
const rect = {};
|
||||
rect[AUTOCOMPLETE_WIDTH.INPUT] = this.textarea.getBoundingClientRect();
|
||||
rect[AUTOCOMPLETE_WIDTH.CHAT] = document.querySelector('#sheld').getBoundingClientRect();
|
||||
rect[AUTOCOMPLETE_WIDTH.FULL] = getTopmostModalLayer().getBoundingClientRect();
|
||||
rect[AUTOCOMPLETE_WIDTH.FULL] = this.getLayer().getBoundingClientRect();
|
||||
if (this.isReplaceable) {
|
||||
this.detailsWrap.classList.remove('full');
|
||||
const selRect = this.selectedItem.dom.children[0].getBoundingClientRect();
|
||||
|
@ -527,32 +557,34 @@ export class AutoComplete {
|
|||
updateFloatingPosition() {
|
||||
const location = this.getCursorPosition();
|
||||
const rect = this.textarea.getBoundingClientRect();
|
||||
const layerRect = this.getLayer().getBoundingClientRect();
|
||||
// cursor is out of view -> hide
|
||||
if (location.bottom < rect.top || location.top > rect.bottom || location.left < rect.left || location.left > rect.right) {
|
||||
return this.hide();
|
||||
}
|
||||
const left = Math.max(rect.left, location.left);
|
||||
const left = Math.max(rect.left, location.left) - layerRect.left;
|
||||
this.domWrap.style.setProperty('--targetOffset', `${left}`);
|
||||
if (location.top <= window.innerHeight / 2) {
|
||||
// if cursor is in lower half of window, show list above line
|
||||
this.domWrap.style.top = `${location.bottom}px`;
|
||||
this.domWrap.style.top = `${location.bottom - layerRect.top}px`;
|
||||
this.domWrap.style.bottom = 'auto';
|
||||
this.domWrap.style.maxHeight = `calc(${location.bottom}px - 1vh)`;
|
||||
this.domWrap.style.maxHeight = `calc(${location.bottom - layerRect.top}px - ${this.textarea.closest('dialog') ? '0' : '1vh'})`;
|
||||
} else {
|
||||
// if cursor is in upper half of window, show list below line
|
||||
this.domWrap.style.top = 'auto';
|
||||
this.domWrap.style.bottom = `calc(100vh - ${location.top}px)`;
|
||||
this.domWrap.style.maxHeight = `calc(${location.top}px - 1vh)`;
|
||||
this.domWrap.style.bottom = `calc(${layerRect.height}px - ${location.top - layerRect.top}px)`;
|
||||
this.domWrap.style.maxHeight = `calc(${location.top - layerRect.top}px - ${this.textarea.closest('dialog') ? '0' : '1vh'})`;
|
||||
}
|
||||
}
|
||||
|
||||
updateFloatingDetailsPosition(location = null) {
|
||||
if (!location) location = this.getCursorPosition();
|
||||
const rect = this.textarea.getBoundingClientRect();
|
||||
const layerRect = this.getLayer().getBoundingClientRect();
|
||||
if (location.bottom < rect.top || location.top > rect.bottom || location.left < rect.left || location.left > rect.right) {
|
||||
return this.hide();
|
||||
}
|
||||
const left = Math.max(rect.left, location.left);
|
||||
const left = Math.max(rect.left, location.left) - layerRect.left;
|
||||
this.detailsWrap.style.setProperty('--targetOffset', `${left}`);
|
||||
if (this.isReplaceable) {
|
||||
this.detailsWrap.classList.remove('full');
|
||||
|
@ -572,14 +604,14 @@ export class AutoComplete {
|
|||
}
|
||||
if (location.top <= window.innerHeight / 2) {
|
||||
// if cursor is in lower half of window, show list above line
|
||||
this.detailsWrap.style.top = `${location.bottom}px`;
|
||||
this.detailsWrap.style.top = `${location.bottom - layerRect.top}px`;
|
||||
this.detailsWrap.style.bottom = 'auto';
|
||||
this.detailsWrap.style.maxHeight = `calc(${location.bottom}px - 1vh)`;
|
||||
this.detailsWrap.style.maxHeight = `calc(${location.bottom - layerRect.top}px - ${this.textarea.closest('dialog') ? '0' : '1vh'})`;
|
||||
} else {
|
||||
// if cursor is in upper half of window, show list below line
|
||||
this.detailsWrap.style.top = 'auto';
|
||||
this.detailsWrap.style.bottom = `calc(100vh - ${location.top}px)`;
|
||||
this.detailsWrap.style.maxHeight = `calc(${location.top}px - 1vh)`;
|
||||
this.detailsWrap.style.bottom = `calc(${layerRect.height}px - ${location.top - layerRect.top}px)`;
|
||||
this.detailsWrap.style.maxHeight = `calc(${location.top - layerRect.top}px - ${this.textarea.closest('dialog') ? '0' : '1vh'})`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,7 +629,7 @@ export class AutoComplete {
|
|||
}
|
||||
this.clone.style.position = 'fixed';
|
||||
this.clone.style.visibility = 'hidden';
|
||||
getTopmostModalLayer().append(this.clone);
|
||||
document.body.append(this.clone);
|
||||
const mo = new MutationObserver(muts=>{
|
||||
if (muts.find(it=>Array.from(it.removedNodes).includes(this.textarea))) {
|
||||
this.clone.remove();
|
||||
|
@ -656,6 +688,7 @@ export class AutoComplete {
|
|||
}
|
||||
this.wasForced = false;
|
||||
this.textarea.dispatchEvent(new Event('input', { bubbles:true }));
|
||||
this.onSelect?.(this.selectedItem);
|
||||
}
|
||||
|
||||
|
||||
|
@ -708,8 +741,10 @@ export class AutoComplete {
|
|||
}
|
||||
case 'Enter': {
|
||||
// pick the selected item to autocomplete
|
||||
if ((power_user.stscript.autocomplete.select & AUTOCOMPLETE_SELECT_KEY.ENTER) != AUTOCOMPLETE_SELECT_KEY.ENTER) break;
|
||||
if (evt.ctrlKey || evt.altKey || evt.shiftKey || this.selectedItem.value == '') break;
|
||||
if (this.selectedItem.name == this.name) break;
|
||||
if (!this.selectedItem.isSelectable) break;
|
||||
evt.preventDefault();
|
||||
evt.stopImmediatePropagation();
|
||||
this.select();
|
||||
|
@ -717,9 +752,11 @@ export class AutoComplete {
|
|||
}
|
||||
case 'Tab': {
|
||||
// pick the selected item to autocomplete
|
||||
if ((power_user.stscript.autocomplete.select & AUTOCOMPLETE_SELECT_KEY.TAB) != AUTOCOMPLETE_SELECT_KEY.TAB) break;
|
||||
if (evt.ctrlKey || evt.altKey || evt.shiftKey || this.selectedItem.value == '') break;
|
||||
evt.preventDefault();
|
||||
evt.stopImmediatePropagation();
|
||||
if (!this.selectedItem.isSelectable) break;
|
||||
this.select();
|
||||
return;
|
||||
}
|
||||
|
@ -772,30 +809,16 @@ export class AutoComplete {
|
|||
// ignore keydown on modifier keys
|
||||
return;
|
||||
}
|
||||
switch (evt.key) {
|
||||
case 'ArrowUp':
|
||||
case 'ArrowDown':
|
||||
case 'ArrowRight':
|
||||
case 'ArrowLeft': {
|
||||
if (this.isActive) {
|
||||
// keyboard navigation, wait for keyup to complete cursor move
|
||||
const oldText = this.textarea.value;
|
||||
await new Promise(resolve=>{
|
||||
window.addEventListener('keyup', resolve, { once:true });
|
||||
});
|
||||
if (this.selectionStart != this.textarea.selectionStart) {
|
||||
this.selectionStart = this.textarea.selectionStart;
|
||||
this.show(this.isReplaceable || oldText != this.textarea.value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (this.isActive) {
|
||||
this.text != this.textarea.value && this.show(this.isReplaceable);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// await keyup to see if cursor position or text has changed
|
||||
const oldText = this.textarea.value;
|
||||
await new Promise(resolve=>{
|
||||
window.addEventListener('keyup', resolve, { once:true });
|
||||
});
|
||||
if (this.selectionStart != this.textarea.selectionStart) {
|
||||
this.selectionStart = this.textarea.selectionStart;
|
||||
this.show(this.isReplaceable || oldText != this.textarea.value);
|
||||
} else if (this.isActive) {
|
||||
this.text != this.textarea.value && this.show(this.isReplaceable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,9 @@
|
|||
import { SlashCommandNamedArgumentAutoCompleteOption } from '../slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js';
|
||||
import { AutoCompleteOption } from './AutoCompleteOption.js';
|
||||
// import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js';
|
||||
import { AutoCompleteNameResultBase } from './AutoCompleteNameResultBase.js';
|
||||
import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js';
|
||||
|
||||
|
||||
|
||||
export class AutoCompleteNameResult {
|
||||
/**@type {string} */ name;
|
||||
/**@type {number} */ start;
|
||||
/**@type {AutoCompleteOption[]} */ optionList = [];
|
||||
/**@type {boolean} */ canBeQuoted = false;
|
||||
/**@type {()=>string} */ makeNoMatchText = ()=>`No matches found for "${this.name}"`;
|
||||
/**@type {()=>string} */ makeNoOptionsText = ()=>'No options';
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} name Name (potentially partial) of the name at the requested index.
|
||||
* @param {number} start Index where the name starts.
|
||||
* @param {AutoCompleteOption[]} optionList A list of autocomplete options found in the current scope.
|
||||
* @param {boolean} canBeQuoted Whether the name can be inside quotes.
|
||||
* @param {()=>string} makeNoMatchText Function that returns text to show when no matches where found.
|
||||
* @param {()=>string} makeNoOptionsText Function that returns text to show when no options are available to match against.
|
||||
*/
|
||||
constructor(name, start, optionList = [], canBeQuoted = false, makeNoMatchText = null, makeNoOptionsText = null) {
|
||||
this.name = name;
|
||||
this.start = start;
|
||||
this.optionList = optionList;
|
||||
this.canBeQuoted = canBeQuoted;
|
||||
this.noMatchText = makeNoMatchText ?? this.makeNoMatchText;
|
||||
this.noOptionstext = makeNoOptionsText ?? this.makeNoOptionsText;
|
||||
}
|
||||
|
||||
|
||||
export class AutoCompleteNameResult extends AutoCompleteNameResultBase {
|
||||
/**
|
||||
*
|
||||
* @param {string} text The whole text
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
import { SlashCommandNamedArgumentAutoCompleteOption } from '../slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js';
|
||||
import { AutoCompleteOption } from './AutoCompleteOption.js';
|
||||
|
||||
|
||||
|
||||
export class AutoCompleteNameResultBase {
|
||||
/**@type {string} */ name;
|
||||
/**@type {number} */ start;
|
||||
/**@type {AutoCompleteOption[]} */ optionList = [];
|
||||
/**@type {boolean} */ canBeQuoted = false;
|
||||
/**@type {()=>string} */ makeNoMatchText = ()=>`No matches found for "${this.name}"`;
|
||||
/**@type {()=>string} */ makeNoOptionsText = ()=>'No options';
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} name Name (potentially partial) of the name at the requested index.
|
||||
* @param {number} start Index where the name starts.
|
||||
* @param {AutoCompleteOption[]} optionList A list of autocomplete options found in the current scope.
|
||||
* @param {boolean} canBeQuoted Whether the name can be inside quotes.
|
||||
* @param {()=>string} makeNoMatchText Function that returns text to show when no matches where found.
|
||||
* @param {()=>string} makeNoOptionsText Function that returns text to show when no options are available to match against.
|
||||
*/
|
||||
constructor(name, start, optionList = [], canBeQuoted = false, makeNoMatchText = null, makeNoOptionsText = null) {
|
||||
this.name = name;
|
||||
this.start = start;
|
||||
this.optionList = optionList;
|
||||
this.canBeQuoted = canBeQuoted;
|
||||
this.noMatchText = makeNoMatchText ?? this.makeNoMatchText;
|
||||
this.noOptionstext = makeNoOptionsText ?? this.makeNoOptionsText;
|
||||
}
|
||||
}
|
|
@ -11,6 +11,9 @@ export class AutoCompleteOption {
|
|||
/**@type {AutoCompleteFuzzyScore}*/ score;
|
||||
/**@type {string}*/ replacer;
|
||||
/**@type {HTMLElement}*/ dom;
|
||||
/**@type {(input:string)=>boolean}*/ matchProvider;
|
||||
/**@type {(input:string)=>string}*/ valueProvider;
|
||||
/**@type {boolean}*/ makeSelectable = false;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,14 +24,21 @@ export class AutoCompleteOption {
|
|||
return this.name;
|
||||
}
|
||||
|
||||
get isSelectable() {
|
||||
return this.makeSelectable || !this.valueProvider;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
*/
|
||||
constructor(name, typeIcon = ' ', type = '') {
|
||||
constructor(name, typeIcon = ' ', type = '', matchProvider = null, valueProvider = null, makeSelectable = false) {
|
||||
this.name = name;
|
||||
this.typeIcon = typeIcon;
|
||||
this.type = type;
|
||||
this.matchProvider = matchProvider;
|
||||
this.valueProvider = valueProvider;
|
||||
this.makeSelectable = makeSelectable;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { AutoCompleteNameResult } from './AutoCompleteNameResult.js';
|
||||
import { AutoCompleteNameResultBase } from './AutoCompleteNameResultBase.js';
|
||||
|
||||
export class AutoCompleteSecondaryNameResult extends AutoCompleteNameResult {
|
||||
export class AutoCompleteSecondaryNameResult extends AutoCompleteNameResultBase {
|
||||
/**@type {boolean}*/ isRequired = false;
|
||||
/**@type {boolean}*/ forceMatch = true;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
saveChatConditional,
|
||||
saveItemizedPrompts,
|
||||
} from '../script.js';
|
||||
import { humanizedDateTime } from './RossAscends-mods.js';
|
||||
import { humanizedDateTime, getMessageTimeStamp } from './RossAscends-mods.js';
|
||||
import {
|
||||
getGroupPastChats,
|
||||
group_activation_strategy,
|
||||
|
@ -297,7 +297,7 @@ async function convertSoloToGroupChat() {
|
|||
if (groupChat.length === 0) {
|
||||
const newMessage = {
|
||||
...system_messages[system_message_types.GROUP],
|
||||
send_date: humanizedDateTime(),
|
||||
send_date: getMessageTimeStamp(),
|
||||
extra: { type: system_message_types.GROUP },
|
||||
};
|
||||
groupChat.push(newMessage);
|
||||
|
|
|
@ -989,6 +989,28 @@ export async function writeExtensionField(characterId, key, value) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts the user to enter the Git URL of the extension to import.
|
||||
* After obtaining the Git URL, makes a POST request to '/api/extensions/install' to import the extension.
|
||||
* If the extension is imported successfully, a success message is displayed.
|
||||
* If the extension import fails, an error message is displayed and the error is logged to the console.
|
||||
* After successfully importing the extension, the extension settings are reloaded and a 'EXTENSION_SETTINGS_LOADED' event is emitted.
|
||||
* @param {string} [suggestUrl] Suggested URL to install
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function openThirdPartyExtensionMenu(suggestUrl = '') {
|
||||
const html = await renderTemplateAsync('installExtension');
|
||||
const input = await callGenericPopup(html, POPUP_TYPE.INPUT, suggestUrl ?? '');
|
||||
|
||||
if (!input) {
|
||||
console.debug('Extension install cancelled');
|
||||
return;
|
||||
}
|
||||
|
||||
const url = String(input).trim();
|
||||
await installExtension(url);
|
||||
}
|
||||
|
||||
jQuery(async function () {
|
||||
await addExtensionsButtonAndMenu();
|
||||
$('#extensionsMenuButton').css('display', 'flex');
|
||||
|
@ -1004,28 +1026,8 @@ jQuery(async function () {
|
|||
|
||||
/**
|
||||
* Handles the click event for the third-party extension import button.
|
||||
* Prompts the user to enter the Git URL of the extension to import.
|
||||
* After obtaining the Git URL, makes a POST request to '/api/extensions/install' to import the extension.
|
||||
* If the extension is imported successfully, a success message is displayed.
|
||||
* If the extension import fails, an error message is displayed and the error is logged to the console.
|
||||
* After successfully importing the extension, the extension settings are reloaded and a 'EXTENSION_SETTINGS_LOADED' event is emitted.
|
||||
*
|
||||
* @listens #third_party_extension_button#click - The click event of the '#third_party_extension_button' element.
|
||||
*/
|
||||
$('#third_party_extension_button').on('click', async () => {
|
||||
const html = `<h3>Enter the Git URL of the extension to install</h3>
|
||||
<br>
|
||||
<p><b>Disclaimer:</b> Please be aware that using external extensions can have unintended side effects and may pose security risks. Always make sure you trust the source before importing an extension. We are not responsible for any damage caused by third-party extensions.</p>
|
||||
<br>
|
||||
<p>Example: <tt> https://github.com/author/extension-name </tt></p>`;
|
||||
const input = await callGenericPopup(html, POPUP_TYPE.INPUT, '');
|
||||
|
||||
if (!input) {
|
||||
console.debug('Extension install cancelled');
|
||||
return;
|
||||
}
|
||||
|
||||
const url = String(input).trim();
|
||||
await installExtension(url);
|
||||
});
|
||||
$('#third_party_extension_button').on('click', () => openThirdPartyExtensionMenu());
|
||||
});
|
||||
|
|
|
@ -8,13 +8,12 @@ import { textgen_types, textgenerationwebui_settings } from '../../textgen-setti
|
|||
import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
|
||||
import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||
import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';
|
||||
import { commonEnumProviders } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||
export { MODULE_NAME };
|
||||
|
||||
const MODULE_NAME = 'caption';
|
||||
|
||||
const PROMPT_DEFAULT = 'What’s in this image?';
|
||||
const PROMPT_DEFAULT = 'What\'s in this image?';
|
||||
const TEMPLATE_DEFAULT = '[{{user}} sends {{char}} a picture that contains: {{caption}}]';
|
||||
|
||||
/**
|
||||
|
@ -170,7 +169,11 @@ async function sendCaptionedMessage(caption, image) {
|
|||
},
|
||||
};
|
||||
context.chat.push(message);
|
||||
const messageId = context.chat.length - 1;
|
||||
await eventSource.emit(event_types.MESSAGE_SENT, messageId);
|
||||
context.addOneMessage(message);
|
||||
await eventSource.emit(event_types.USER_MESSAGE_RENDERED, messageId);
|
||||
await context.saveChat();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -334,7 +337,7 @@ async function getCaptionForFile(file, prompt, quiet) {
|
|||
}
|
||||
catch (error) {
|
||||
const errorMessage = error.message || 'Unknown error';
|
||||
toastr.error(errorMessage, "Failed to caption image.");
|
||||
toastr.error(errorMessage, 'Failed to caption image.');
|
||||
console.error(error);
|
||||
return '';
|
||||
}
|
||||
|
@ -399,6 +402,7 @@ jQuery(async function () {
|
|||
(modules.includes('caption') && extension_settings.caption.source === 'extras') ||
|
||||
(extension_settings.caption.source === 'multimodal' && extension_settings.caption.multimodal_api === 'openai' && (secret_state[SECRET_KEYS.OPENAI] || extension_settings.caption.allow_reverse_proxy)) ||
|
||||
(extension_settings.caption.source === 'multimodal' && extension_settings.caption.multimodal_api === 'openrouter' && secret_state[SECRET_KEYS.OPENROUTER]) ||
|
||||
(extension_settings.caption.source === 'multimodal' && extension_settings.caption.multimodal_api === 'zerooneai' && secret_state[SECRET_KEYS.ZEROONEAI]) ||
|
||||
(extension_settings.caption.source === 'multimodal' && extension_settings.caption.multimodal_api === 'google' && (secret_state[SECRET_KEYS.MAKERSUITE] || extension_settings.caption.allow_reverse_proxy)) ||
|
||||
(extension_settings.caption.source === 'multimodal' && extension_settings.caption.multimodal_api === 'anthropic' && (secret_state[SECRET_KEYS.CLAUDE] || extension_settings.caption.allow_reverse_proxy)) ||
|
||||
(extension_settings.caption.source === 'multimodal' && extension_settings.caption.multimodal_api === 'ollama' && textgenerationwebui_settings.server_urls[textgen_types.OLLAMA]) ||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<div class="flex1 flex-container flexFlowColumn flexNoGap">
|
||||
<label for="caption_multimodal_api" data-i18n="API">API</label>
|
||||
<select id="caption_multimodal_api" class="flex1 text_pole">
|
||||
<option value="zerooneai">01.AI (Yi)</option>
|
||||
<option value="anthropic">Anthropic</option>
|
||||
<option value="custom" data-i18n="Custom (OpenAI-compatible)">Custom (OpenAI-compatible)</option>
|
||||
<option value="google">Google MakerSuite</option>
|
||||
|
@ -32,16 +33,20 @@
|
|||
<div class="flex1 flex-container flexFlowColumn flexNoGap">
|
||||
<label for="caption_multimodal_model" data-i18n="Model">Model</label>
|
||||
<select id="caption_multimodal_model" class="flex1 text_pole">
|
||||
<option data-type="zerooneai" value="yi-vision">yi-vision</option>
|
||||
<option data-type="openai" value="gpt-4-vision-preview">gpt-4-vision-preview</option>
|
||||
<option data-type="openai" value="gpt-4-turbo">gpt-4-turbo</option>
|
||||
<option data-type="openai" value="gpt-4o">gpt-4o</option>
|
||||
<option data-type="openai" value="gpt-4o-mini">gpt-4o-mini</option>
|
||||
<option data-type="openai" value="chatgpt-4o-latest">chatgpt-4o-latest</option>
|
||||
<option data-type="anthropic" value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option>
|
||||
<option data-type="anthropic" value="claude-3-opus-20240229">claude-3-opus-20240229</option>
|
||||
<option data-type="anthropic" value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option>
|
||||
<option data-type="anthropic" value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
|
||||
<option data-type="google" value="gemini-pro-vision">gemini-pro-vision</option>
|
||||
<option data-type="google" value="gemini-1.5-flash-latest">gemini-1.5-flash-latest</option>
|
||||
<option data-type="google" value="gemini-1.5-pro-latest">gemini-1.5-pro-latest</option>
|
||||
<option data-type="google" value="gemini-1.5-pro-exp-0801">gemini-1.5-pro-exp-0801</option>
|
||||
<option data-type="openrouter" value="openai/gpt-4-vision-preview">openai/gpt-4-vision-preview</option>
|
||||
<option data-type="openrouter" value="openai/gpt-4o">openai/gpt-4o</option>
|
||||
<option data-type="openrouter" value="openai/gpt-4-turbo">openai/gpt-4-turbo</option>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { callPopup, eventSource, event_types, generateQuietPrompt, getRequestHeaders, online_status, saveSettingsDebounced, substituteParams, substituteParamsExtended, system_message_types } from '../../../script.js';
|
||||
import { callPopup, eventSource, event_types, generateRaw, getRequestHeaders, main_api, online_status, saveSettingsDebounced, substituteParams, substituteParamsExtended, system_message_types } from '../../../script.js';
|
||||
import { dragElement, isMobile } from '../../RossAscends-mods.js';
|
||||
import { getContext, getApiUrl, modules, extension_settings, ModuleWorkerWrapper, doExtrasFetch, renderExtensionTemplateAsync } from '../../extensions.js';
|
||||
import { loadMovingUIState, power_user } from '../../power-user.js';
|
||||
|
@ -1156,7 +1156,7 @@ async function getExpressionLabel(text) {
|
|||
|
||||
functionResult = args?.arguments;
|
||||
});
|
||||
const emotionResponse = await generateQuietPrompt(prompt, false, false);
|
||||
const emotionResponse = await generateRaw(text, main_api, false, false, prompt);
|
||||
return parseLlmResponse(functionResult || emotionResponse, expressionsList);
|
||||
}
|
||||
// Extras
|
||||
|
@ -1387,7 +1387,8 @@ async function getExpressionsList() {
|
|||
}
|
||||
|
||||
// If there was no specific list, or an error, just return the default expressions
|
||||
return DEFAULT_EXPRESSIONS;
|
||||
expressionsList = DEFAULT_EXPRESSIONS.filter(e => e !== 'talkinghead').slice();
|
||||
return expressionsList;
|
||||
}
|
||||
|
||||
const result = await resolveExpressionsList();
|
||||
|
@ -1618,11 +1619,13 @@ async function onClickExpressionRemoveCustom() {
|
|||
moduleWorker();
|
||||
}
|
||||
|
||||
function onExperesionApiChanged() {
|
||||
function onExpressionApiChanged() {
|
||||
const tempApi = this.value;
|
||||
if (tempApi) {
|
||||
extension_settings.expressions.api = Number(tempApi);
|
||||
$('.expression_llm_prompt_block').toggle(extension_settings.expressions.api === EXPRESSION_API.llm);
|
||||
expressionsList = null;
|
||||
spriteCache = {};
|
||||
moduleWorker();
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
@ -1972,7 +1975,7 @@ function migrateSettings() {
|
|||
$('#expression_custom_add').on('click', onClickExpressionAddCustom);
|
||||
$('#expression_custom_remove').on('click', onClickExpressionRemoveCustom);
|
||||
$('#expression_fallback').on('change', onExpressionFallbackChanged);
|
||||
$('#expression_api').on('change', onExperesionApiChanged);
|
||||
$('#expression_api').on('change', onExpressionApiChanged);
|
||||
}
|
||||
|
||||
// Pause Talkinghead to save resources when the ST tab is not visible or the window is minimized.
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<!-- I18n data for tools used to auto generate translations -->
|
||||
<div data-i18n="Show Gallery">Show Gallery</div>
|
|
@ -3,6 +3,7 @@ import {
|
|||
this_chid,
|
||||
characters,
|
||||
getRequestHeaders,
|
||||
event_types,
|
||||
} from '../../../script.js';
|
||||
import { groups, selected_group } from '../../group-chats.js';
|
||||
import { loadFileToDocument, delay } from '../../utils.js';
|
||||
|
@ -13,6 +14,7 @@ import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
|||
import { ARGUMENT_TYPE, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||
import { DragAndDropHandler } from '../../dragdrop.js';
|
||||
import { commonEnumProviders } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||
import { translate } from '../../i18n.js';
|
||||
|
||||
const extensionName = 'gallery';
|
||||
const extensionFolderPath = `scripts/extensions/${extensionName}/`;
|
||||
|
@ -24,6 +26,27 @@ let paginationVisiblePages = 10;
|
|||
let paginationMaxLinesPerPage = 2;
|
||||
let galleryMaxRows = 3;
|
||||
|
||||
$('body').on('click', '.dragClose', function () {
|
||||
const relatedId = $(this).data('related-id'); // Get the ID of the related draggable
|
||||
$(`body > .draggable[id="${relatedId}"]`).remove(); // Remove the associated draggable
|
||||
});
|
||||
|
||||
const CUSTOM_GALLERY_REMOVED_EVENT = 'galleryRemoved';
|
||||
|
||||
const mutationObserver = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.removedNodes.forEach((node) => {
|
||||
if (node instanceof HTMLElement && node.tagName === 'DIV' && node.id === 'gallery') {
|
||||
eventSource.emit(CUSTOM_GALLERY_REMOVED_EVENT);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
mutationObserver.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: false,
|
||||
});
|
||||
|
||||
/**
|
||||
* Retrieves a list of gallery items based on a given URL. This function calls an API endpoint
|
||||
|
@ -58,7 +81,9 @@ async function getGalleryItems(url) {
|
|||
* @returns {Promise<void>} - Promise representing the completion of the gallery initialization.
|
||||
*/
|
||||
async function initGallery(items, url) {
|
||||
const nonce = `nonce-${Math.random().toString(36).substring(2, 15)}`;
|
||||
const gallery = $('#dragGallery');
|
||||
gallery.addClass(nonce);
|
||||
gallery.nanogallery2({
|
||||
'items': items,
|
||||
thumbnailWidth: 'auto',
|
||||
|
@ -81,16 +106,26 @@ async function initGallery(items, url) {
|
|||
fnThumbnailOpen: viewWithDragbox,
|
||||
});
|
||||
|
||||
|
||||
eventSource.on('resizeUI', function (elmntName) {
|
||||
gallery.nanogallery2('resize');
|
||||
});
|
||||
|
||||
const dragDropHandler = new DragAndDropHandler('#dragGallery', async (files, event) => {
|
||||
const dragDropHandler = new DragAndDropHandler(`#dragGallery.${nonce}`, async (files, event) => {
|
||||
let file = files[0];
|
||||
uploadFile(file, url); // Added url parameter to know where to upload
|
||||
});
|
||||
|
||||
const resizeHandler = function () {
|
||||
gallery.nanogallery2('resize');
|
||||
};
|
||||
|
||||
eventSource.on('resizeUI', resizeHandler);
|
||||
|
||||
eventSource.once(event_types.CHAT_CHANGED, function () {
|
||||
gallery.closest('#gallery').remove();
|
||||
});
|
||||
|
||||
eventSource.once(CUSTOM_GALLERY_REMOVED_EVENT, function () {
|
||||
gallery.nanogallery2('destroy');
|
||||
dragDropHandler.destroy();
|
||||
eventSource.removeListener('resizeUI', resizeHandler);
|
||||
});
|
||||
|
||||
// Set dropzone height to be the same as the parent
|
||||
gallery.css('height', gallery.parent().css('height'));
|
||||
|
@ -139,16 +174,10 @@ async function showCharGallery() {
|
|||
|
||||
const items = await getGalleryItems(url);
|
||||
// if there already is a gallery, destroy it and place this one in its place
|
||||
if ($('#dragGallery').length) {
|
||||
$('#dragGallery').nanogallery2('destroy');
|
||||
initGallery(items, url);
|
||||
} else {
|
||||
makeMovable();
|
||||
setTimeout(async () => {
|
||||
await initGallery(items, url);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
$('#dragGallery').closest('#gallery').remove();
|
||||
makeMovable();
|
||||
await delay(100);
|
||||
await initGallery(items, url);
|
||||
} catch (err) {
|
||||
console.trace();
|
||||
console.error(err);
|
||||
|
@ -201,11 +230,11 @@ async function uploadFile(file, url) {
|
|||
toastr.success('File uploaded successfully. Saved at: ' + result.path);
|
||||
|
||||
// Refresh the gallery
|
||||
$('#dragGallery').nanogallery2('destroy'); // Destroy old gallery
|
||||
const newItems = await getGalleryItems(url); // Fetch the latest items
|
||||
initGallery(newItems, url); // Reinitialize the gallery with new items and pass 'url'
|
||||
|
||||
|
||||
$('#dragGallery').closest('#gallery').remove(); // Destroy old gallery
|
||||
makeMovable();
|
||||
await delay(100);
|
||||
await initGallery(newItems, url); // Reinitialize the gallery with new items and pass 'url'
|
||||
} catch (error) {
|
||||
console.error('There was an issue uploading the file:', error);
|
||||
|
||||
|
@ -228,7 +257,7 @@ $(document).ready(function () {
|
|||
$('#char-management-dropdown').append(
|
||||
$('<option>', {
|
||||
id: 'show_char_gallery',
|
||||
text: 'Show Gallery',
|
||||
text: translate('Show Gallery'),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
@ -272,11 +301,6 @@ function makeMovable(id = 'gallery') {
|
|||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('body').on('click', '.dragClose', function () {
|
||||
const relatedId = $(this).data('related-id'); // Get the ID of the related draggable
|
||||
$(`#${relatedId}`).remove(); // Remove the associated draggable
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -357,11 +381,6 @@ function makeDragImg(id, url) {
|
|||
} else {
|
||||
console.error('Failed to append the template content or retrieve the appended content.');
|
||||
}
|
||||
|
||||
$('body').on('click', '.dragClose', function () {
|
||||
const relatedId = $(this).data('related-id'); // Get the ID of the related draggable
|
||||
$(`#${relatedId}`).remove(); // Remove the associated draggable
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,7 +419,8 @@ function viewWithDragbox(items) {
|
|||
|
||||
|
||||
// Registers a simple command for opening the char gallery.
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'show-gallery',
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'show-gallery',
|
||||
aliases: ['sg'],
|
||||
callback: () => {
|
||||
showCharGallery();
|
||||
|
@ -408,7 +428,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'show-gallery
|
|||
},
|
||||
helpString: 'Shows the gallery.',
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'list-gallery',
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'list-gallery',
|
||||
aliases: ['lg'],
|
||||
callback: listGalleryCommand,
|
||||
returns: 'list of images',
|
||||
|
@ -431,14 +452,14 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'list-gallery
|
|||
|
||||
async function listGalleryCommand(args) {
|
||||
try {
|
||||
let url = args.char ?? (args.group ? groups.find(it=>it.name == args.group)?.id : null) ?? (selected_group || this_chid);
|
||||
let url = args.char ?? (args.group ? groups.find(it => it.name == args.group)?.id : null) ?? (selected_group || this_chid);
|
||||
if (!args.char && !args.group && !selected_group && this_chid) {
|
||||
const char = characters[this_chid];
|
||||
url = char.avatar.replace('.png', '');
|
||||
}
|
||||
|
||||
const items = await getGalleryItems(url);
|
||||
return JSON.stringify(items.map(it=>it.src));
|
||||
return JSON.stringify(items.map(it => it.src));
|
||||
|
||||
} catch (err) {
|
||||
console.trace();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"optional": [
|
||||
],
|
||||
"js": "index.js",
|
||||
"css": "",
|
||||
"css": "style.css",
|
||||
"author": "City-Unit",
|
||||
"version": "1.5.0",
|
||||
"homePage": "https://github.com/SillyTavern/SillyTavern"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
.nGY2 .nGY2GalleryBottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
|
@ -14,6 +14,7 @@ import {
|
|||
substituteParamsExtended,
|
||||
generateRaw,
|
||||
getMaxContextSize,
|
||||
setExtensionPrompt,
|
||||
} from '../../../script.js';
|
||||
import { is_group_generating, selected_group } from '../../group-chats.js';
|
||||
import { loadMovingUIState } from '../../power-user.js';
|
||||
|
@ -24,6 +25,7 @@ import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
|
|||
import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||
import { MacrosParser } from '../../macros.js';
|
||||
import { countWebLlmTokens, generateWebLlmChatPrompt, getWebLlmContextSize, isWebLlmSupported } from '../shared.js';
|
||||
export { MODULE_NAME };
|
||||
|
||||
const MODULE_NAME = '1_memory';
|
||||
|
@ -35,6 +37,41 @@ let lastMessageHash = null;
|
|||
let lastMessageId = null;
|
||||
let inApiCall = false;
|
||||
|
||||
/**
|
||||
* Count the number of tokens in the provided text.
|
||||
* @param {string} text Text to count tokens for
|
||||
* @param {number} padding Number of additional tokens to add to the count
|
||||
* @returns {Promise<number>} Number of tokens in the text
|
||||
*/
|
||||
async function countSourceTokens(text, padding = 0) {
|
||||
if (extension_settings.memory.source === summary_sources.webllm) {
|
||||
const count = await countWebLlmTokens(text);
|
||||
return count + padding;
|
||||
}
|
||||
|
||||
if (extension_settings.memory.source === summary_sources.extras) {
|
||||
const count = getTextTokens(tokenizers.GPT2, text).length;
|
||||
return count + padding;
|
||||
}
|
||||
|
||||
return await getTokenCountAsync(text, padding);
|
||||
}
|
||||
|
||||
async function getSourceContextSize() {
|
||||
const overrideLength = extension_settings.memory.overrideResponseLength;
|
||||
|
||||
if (extension_settings.memory.source === summary_sources.webllm) {
|
||||
const maxContext = await getWebLlmContextSize();
|
||||
return overrideLength > 0 ? (maxContext - overrideLength) : Math.round(maxContext * 0.75);
|
||||
}
|
||||
|
||||
if (extension_settings.source === summary_sources.extras) {
|
||||
return 1024 - 64;
|
||||
}
|
||||
|
||||
return getMaxContextSize(overrideLength);
|
||||
}
|
||||
|
||||
const formatMemoryValue = function (value) {
|
||||
if (!value) {
|
||||
return '';
|
||||
|
@ -54,6 +91,7 @@ const saveChatDebounced = debounce(() => getContext().saveChat(), debounce_timeo
|
|||
const summary_sources = {
|
||||
'extras': 'extras',
|
||||
'main': 'main',
|
||||
'webllm': 'webllm',
|
||||
};
|
||||
|
||||
const prompt_builders = {
|
||||
|
@ -73,6 +111,7 @@ const defaultSettings = {
|
|||
template: defaultTemplate,
|
||||
position: extension_prompt_types.IN_PROMPT,
|
||||
role: extension_prompt_roles.SYSTEM,
|
||||
scan: false,
|
||||
depth: 2,
|
||||
promptWords: 200,
|
||||
promptMinWords: 25,
|
||||
|
@ -122,17 +161,18 @@ function loadSettings() {
|
|||
$(`input[name="memory_prompt_builder"][value="${extension_settings.memory.prompt_builder}"]`).prop('checked', true).trigger('input');
|
||||
$('#memory_override_response_length').val(extension_settings.memory.overrideResponseLength).trigger('input');
|
||||
$('#memory_max_messages_per_request').val(extension_settings.memory.maxMessagesPerRequest).trigger('input');
|
||||
$('#memory_include_wi_scan').prop('checked', extension_settings.memory.scan).trigger('input');
|
||||
switchSourceControls(extension_settings.memory.source);
|
||||
}
|
||||
|
||||
async function onPromptForceWordsAutoClick() {
|
||||
const context = getContext();
|
||||
const maxPromptLength = getMaxContextSize(extension_settings.memory.overrideResponseLength);
|
||||
const maxPromptLength = await getSourceContextSize();
|
||||
const chat = context.chat;
|
||||
const allMessages = chat.filter(m => !m.is_system && m.mes).map(m => m.mes);
|
||||
const messagesWordCount = allMessages.map(m => extractAllWords(m)).flat().length;
|
||||
const averageMessageWordCount = messagesWordCount / allMessages.length;
|
||||
const tokensPerWord = await getTokenCountAsync(allMessages.join('\n')) / messagesWordCount;
|
||||
const tokensPerWord = await countSourceTokens(allMessages.join('\n')) / messagesWordCount;
|
||||
const wordsPerToken = 1 / tokensPerWord;
|
||||
const maxPromptLengthWords = Math.round(maxPromptLength * wordsPerToken);
|
||||
// How many words should pass so that messages will start be dropped out of context;
|
||||
|
@ -165,15 +205,15 @@ async function onPromptForceWordsAutoClick() {
|
|||
|
||||
async function onPromptIntervalAutoClick() {
|
||||
const context = getContext();
|
||||
const maxPromptLength = getMaxContextSize(extension_settings.memory.overrideResponseLength);
|
||||
const maxPromptLength = await getSourceContextSize();
|
||||
const chat = context.chat;
|
||||
const allMessages = chat.filter(m => !m.is_system && m.mes).map(m => m.mes);
|
||||
const messagesWordCount = allMessages.map(m => extractAllWords(m)).flat().length;
|
||||
const messagesTokenCount = await getTokenCountAsync(allMessages.join('\n'));
|
||||
const messagesTokenCount = await countSourceTokens(allMessages.join('\n'));
|
||||
const tokensPerWord = messagesTokenCount / messagesWordCount;
|
||||
const averageMessageTokenCount = messagesTokenCount / allMessages.length;
|
||||
const targetSummaryTokens = Math.round(extension_settings.memory.promptWords * tokensPerWord);
|
||||
const promptTokens = await getTokenCountAsync(extension_settings.memory.prompt);
|
||||
const promptTokens = await countSourceTokens(extension_settings.memory.prompt);
|
||||
const promptAllowance = maxPromptLength - promptTokens - targetSummaryTokens;
|
||||
const maxMessagesPerSummary = extension_settings.memory.maxMessagesPerRequest || 0;
|
||||
const averageMessagesPerPrompt = Math.floor(promptAllowance / averageMessageTokenCount);
|
||||
|
@ -210,8 +250,8 @@ function onSummarySourceChange(event) {
|
|||
|
||||
function switchSourceControls(value) {
|
||||
$('#memory_settings [data-summary-source]').each((_, element) => {
|
||||
const source = $(element).data('summary-source');
|
||||
$(element).toggle(source === value);
|
||||
const source = element.dataset.summarySource.split(',').map(s => s.trim());
|
||||
$(element).toggle(source.includes(value));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -279,6 +319,13 @@ function onMemoryPositionChange(e) {
|
|||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
function onMemoryIncludeWIScanInput() {
|
||||
const value = !!$(this).prop('checked');
|
||||
extension_settings.memory.scan = value;
|
||||
reinsertMemory();
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
function onMemoryPromptWordsForceInput() {
|
||||
const value = $(this).val();
|
||||
extension_settings.memory.promptForceWords = Number(value);
|
||||
|
@ -343,10 +390,13 @@ function getIndexOfLatestChatSummary(chat) {
|
|||
|
||||
async function onChatEvent() {
|
||||
// Module not enabled
|
||||
if (extension_settings.memory.source === summary_sources.extras) {
|
||||
if (!modules.includes('summarize')) {
|
||||
return;
|
||||
}
|
||||
if (extension_settings.memory.source === summary_sources.extras && !modules.includes('summarize')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// WebLLM is not supported
|
||||
if (extension_settings.memory.source === summary_sources.webllm && !isWebLlmSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const context = getContext();
|
||||
|
@ -421,8 +471,12 @@ async function forceSummarizeChat() {
|
|||
return '';
|
||||
}
|
||||
|
||||
toastr.info('Summarizing chat...', 'Please wait');
|
||||
const value = await summarizeChatMain(context, true, skipWIAN);
|
||||
const toast = toastr.info('Summarizing chat...', 'Please wait', { timeOut: 0, extendedTimeOut: 0 });
|
||||
const value = extension_settings.memory.source === summary_sources.main
|
||||
? await summarizeChatMain(context, true, skipWIAN)
|
||||
: await summarizeChatWebLLM(context, true);
|
||||
|
||||
toastr.clear(toast);
|
||||
|
||||
if (!value) {
|
||||
toastr.warning('Failed to summarize chat');
|
||||
|
@ -454,6 +508,11 @@ async function summarizeCallback(args, text) {
|
|||
return await callExtrasSummarizeAPI(text);
|
||||
case summary_sources.main:
|
||||
return await generateRaw(text, '', false, false, prompt, extension_settings.memory.overrideResponseLength);
|
||||
case summary_sources.webllm: {
|
||||
const messages = [{ role: 'system', content: prompt }, { role: 'user', content: text }].filter(m => m.content);
|
||||
const params = extension_settings.memory.overrideResponseLength > 0 ? { max_tokens: extension_settings.memory.overrideResponseLength } : {};
|
||||
return await generateWebLlmChatPrompt(messages, params);
|
||||
}
|
||||
default:
|
||||
toastr.warning('Invalid summarization source specified');
|
||||
return '';
|
||||
|
@ -474,16 +533,25 @@ async function summarizeChat(context) {
|
|||
case summary_sources.main:
|
||||
await summarizeChatMain(context, false, skipWIAN);
|
||||
break;
|
||||
case summary_sources.webllm:
|
||||
await summarizeChatWebLLM(context, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async function summarizeChatMain(context, force, skipWIAN) {
|
||||
|
||||
/**
|
||||
* Check if the chat should be summarized based on the current conditions.
|
||||
* Return summary prompt if it should be summarized.
|
||||
* @param {any} context ST context
|
||||
* @param {boolean} force Summarize the chat regardless of the conditions
|
||||
* @returns {Promise<string>} Summary prompt or empty string
|
||||
*/
|
||||
async function getSummaryPromptForNow(context, force) {
|
||||
if (extension_settings.memory.promptInterval === 0 && !force) {
|
||||
console.debug('Prompt interval is set to 0, skipping summarization');
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -495,17 +563,17 @@ async function summarizeChatMain(context, force, skipWIAN) {
|
|||
waitUntilCondition(() => is_send_press === false, 30000, 100);
|
||||
} catch {
|
||||
console.debug('Timeout waiting for is_send_press');
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!context.chat.length) {
|
||||
console.debug('No messages in chat to summarize');
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
if (context.chat.length < extension_settings.memory.promptInterval && !force) {
|
||||
console.debug(`Not enough messages in chat to summarize (chat: ${context.chat.length}, interval: ${extension_settings.memory.promptInterval})`);
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
let messagesSinceLastSummary = 0;
|
||||
|
@ -529,7 +597,7 @@ async function summarizeChatMain(context, force, skipWIAN) {
|
|||
|
||||
if (!conditionSatisfied && !force) {
|
||||
console.debug(`Summary conditions not satisfied (messages: ${messagesSinceLastSummary}, interval: ${extension_settings.memory.promptInterval}, words: ${wordsSinceLastSummary}, force words: ${extension_settings.memory.promptForceWords})`);
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
console.log('Summarizing chat, messages since last summary: ' + messagesSinceLastSummary, 'words since last summary: ' + wordsSinceLastSummary);
|
||||
|
@ -537,6 +605,63 @@ async function summarizeChatMain(context, force, skipWIAN) {
|
|||
|
||||
if (!prompt) {
|
||||
console.debug('Summarization prompt is empty. Skipping summarization.');
|
||||
return '';
|
||||
}
|
||||
|
||||
return prompt;
|
||||
}
|
||||
|
||||
async function summarizeChatWebLLM(context, force) {
|
||||
if (!isWebLlmSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const prompt = await getSummaryPromptForNow(context, force);
|
||||
|
||||
if (!prompt) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { rawPrompt, lastUsedIndex } = await getRawSummaryPrompt(context, prompt);
|
||||
|
||||
if (lastUsedIndex === null || lastUsedIndex === -1) {
|
||||
if (force) {
|
||||
toastr.info('To try again, remove the latest summary.', 'No messages found to summarize');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const messages = [
|
||||
{ role: 'system', content: prompt },
|
||||
{ role: 'user', content: rawPrompt },
|
||||
];
|
||||
|
||||
const params = {};
|
||||
|
||||
if (extension_settings.memory.overrideResponseLength > 0) {
|
||||
params.max_tokens = extension_settings.memory.overrideResponseLength;
|
||||
}
|
||||
|
||||
const summary = await generateWebLlmChatPrompt(messages, params);
|
||||
const newContext = getContext();
|
||||
|
||||
// something changed during summarization request
|
||||
if (newContext.groupId !== context.groupId ||
|
||||
newContext.chatId !== context.chatId ||
|
||||
(!newContext.groupId && (newContext.characterId !== context.characterId))) {
|
||||
console.log('Context changed, summary discarded');
|
||||
return;
|
||||
}
|
||||
|
||||
setMemoryContext(summary, true, lastUsedIndex);
|
||||
return summary;
|
||||
}
|
||||
|
||||
async function summarizeChatMain(context, force, skipWIAN) {
|
||||
const prompt = await getSummaryPromptForNow(context, force);
|
||||
|
||||
if (!prompt) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -624,7 +749,7 @@ async function getRawSummaryPrompt(context, prompt) {
|
|||
chat.pop(); // We always exclude the last message from the buffer
|
||||
const chatBuffer = [];
|
||||
const PADDING = 64;
|
||||
const PROMPT_SIZE = getMaxContextSize(extension_settings.memory.overrideResponseLength);
|
||||
const PROMPT_SIZE = await getSourceContextSize();
|
||||
let latestUsedMessage = null;
|
||||
|
||||
for (let index = latestSummaryIndex + 1; index < chat.length; index++) {
|
||||
|
@ -641,7 +766,7 @@ async function getRawSummaryPrompt(context, prompt) {
|
|||
const entry = `${message.name}:\n${message.mes}`;
|
||||
chatBuffer.push(entry);
|
||||
|
||||
const tokens = await getTokenCountAsync(getMemoryString(true), PADDING);
|
||||
const tokens = await countSourceTokens(getMemoryString(true), PADDING);
|
||||
|
||||
if (tokens > PROMPT_SIZE) {
|
||||
chatBuffer.pop();
|
||||
|
@ -670,7 +795,7 @@ async function summarizeChatExtras(context) {
|
|||
const reversedChat = chat.slice().reverse();
|
||||
reversedChat.shift();
|
||||
const memoryBuffer = [];
|
||||
const CONTEXT_SIZE = 1024 - 64;
|
||||
const CONTEXT_SIZE = await getSourceContextSize();
|
||||
|
||||
for (const message of reversedChat) {
|
||||
// we reached the point of latest memory
|
||||
|
@ -688,14 +813,14 @@ async function summarizeChatExtras(context) {
|
|||
memoryBuffer.push(entry);
|
||||
|
||||
// check if token limit was reached
|
||||
const tokens = getTextTokens(tokenizers.GPT2, getMemoryString()).length;
|
||||
const tokens = await countSourceTokens(getMemoryString());
|
||||
if (tokens >= CONTEXT_SIZE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const resultingString = getMemoryString();
|
||||
const resultingTokens = getTextTokens(tokenizers.GPT2, resultingString).length;
|
||||
const resultingTokens = await countSourceTokens(resultingString);
|
||||
|
||||
if (!resultingString || resultingTokens < CONTEXT_SIZE) {
|
||||
console.debug('Not enough context to summarize');
|
||||
|
@ -800,8 +925,7 @@ function reinsertMemory() {
|
|||
* @param {number|null} index Index of the chat message to save the summary to. If null, the pre-last message is used.
|
||||
*/
|
||||
function setMemoryContext(value, saveToMessage, index = null) {
|
||||
const context = getContext();
|
||||
context.setExtensionPrompt(MODULE_NAME, formatMemoryValue(value), extension_settings.memory.position, extension_settings.memory.depth, false, extension_settings.memory.role);
|
||||
setExtensionPrompt(MODULE_NAME, formatMemoryValue(value), extension_settings.memory.position, extension_settings.memory.depth, extension_settings.memory.scan, extension_settings.memory.role);
|
||||
$('#memory_contents').val(value);
|
||||
|
||||
const summaryLog = value
|
||||
|
@ -809,6 +933,7 @@ function setMemoryContext(value, saveToMessage, index = null) {
|
|||
: 'Summary has no content';
|
||||
console.debug(summaryLog);
|
||||
|
||||
const context = getContext();
|
||||
if (saveToMessage && context.chat.length) {
|
||||
const idx = index ?? context.chat.length - 2;
|
||||
const mes = context.chat[idx < 0 ? 0 : idx];
|
||||
|
@ -894,6 +1019,7 @@ function setupListeners() {
|
|||
$('#memory_prompt_words_auto').off('click').on('click', onPromptForceWordsAutoClick);
|
||||
$('#memory_override_response_length').off('click').on('input', onOverrideResponseLengthInput);
|
||||
$('#memory_max_messages_per_request').off('click').on('input', onMaxMessagesPerRequestInput);
|
||||
$('#memory_include_wi_scan').off('input').on('input', onMemoryIncludeWIScanInput);
|
||||
$('#summarySettingsBlockToggle').off('click').on('click', function () {
|
||||
console.log('saw settings button click');
|
||||
$('#summarySettingsBlock').slideToggle(200, 'swing'); //toggleClass("hidden");
|
||||
|
@ -922,7 +1048,7 @@ jQuery(async function () {
|
|||
name: 'summarize',
|
||||
callback: summarizeCallback,
|
||||
namedArgumentList: [
|
||||
new SlashCommandNamedArgument('source', 'API to use for summarization', [ARGUMENT_TYPE.STRING], false, false, '', ['main', 'extras']),
|
||||
new SlashCommandNamedArgument('source', 'API to use for summarization', [ARGUMENT_TYPE.STRING], false, false, '', Object.values(summary_sources)),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'prompt',
|
||||
description: 'prompt to use for summarization',
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<select id="summary_source">
|
||||
<option value="main" data-i18n="ext_sum_main_api">Main API</option>
|
||||
<option value="extras">Extras API</option>
|
||||
<option value="webllm" data-i18n="ext_sum_webllm">WebLLM Extension</option>
|
||||
</select><br>
|
||||
|
||||
<div class="flex-container justifyspacebetween alignitemscenter">
|
||||
|
@ -24,7 +25,7 @@
|
|||
|
||||
<textarea id="memory_contents" class="text_pole textarea_compact" rows="6" data-i18n="[placeholder]ext_sum_memory_placeholder" placeholder="Summary will be generated here..."></textarea>
|
||||
<div class="memory_contents_controls">
|
||||
<div id="memory_force_summarize" data-summary-source="main" class="menu_button menu_button_icon" title="Trigger a summary update right now." data-i18n="[title]ext_sum_force_tip">
|
||||
<div id="memory_force_summarize" data-summary-source="main,webllm" class="menu_button menu_button_icon" title="Trigger a summary update right now." data-i18n="[title]ext_sum_force_tip">
|
||||
<i class="fa-solid fa-database"></i>
|
||||
<span data-i18n="ext_sum_force_text">Summarize now</span>
|
||||
</div>
|
||||
|
@ -58,7 +59,7 @@
|
|||
<span data-i18n="ext_sum_prompt_builder_3">Classic, blocking</span>
|
||||
</label>
|
||||
</div>
|
||||
<div data-summary-source="main">
|
||||
<div data-summary-source="main,webllm">
|
||||
<label for="memory_prompt" class="title_restorable">
|
||||
<span data-i18n="Summary Prompt">Summary Prompt</span>
|
||||
<div id="memory_prompt_restore" data-i18n="[title]ext_sum_restore_default_prompt_tip" title="Restore default prompt" class="right_menu_button">
|
||||
|
@ -74,7 +75,7 @@
|
|||
</label>
|
||||
<input id="memory_override_response_length" type="range" value="{{defaultSettings.overrideResponseLength}}" min="{{defaultSettings.overrideResponseLengthMin}}" max="{{defaultSettings.overrideResponseLengthMax}}" step="{{defaultSettings.overrideResponseLengthStep}}" />
|
||||
<label for="memory_max_messages_per_request">
|
||||
<span data-i18n="ext_sum_raw_max_msg">[Raw] Max messages per request</span> (<span id="memory_max_messages_per_request_value"></span>)
|
||||
<span data-i18n="ext_sum_raw_max_msg">[Raw/WebLLM] Max messages per request</span> (<span id="memory_max_messages_per_request_value"></span>)
|
||||
<small class="memory_disabled_hint" data-i18n="ext_sum_0_unlimited">0 = unlimited</small>
|
||||
</label>
|
||||
<input id="memory_max_messages_per_request" type="range" value="{{defaultSettings.maxMessagesPerRequest}}" min="{{defaultSettings.maxMessagesPerRequestMin}}" max="{{defaultSettings.maxMessagesPerRequestMax}}" step="{{defaultSettings.maxMessagesPerRequestStep}}" />
|
||||
|
@ -109,7 +110,16 @@
|
|||
<textarea id="memory_template" class="text_pole textarea_compact" rows="2" data-i18n="[placeholder]ext_sum_memory_template_placeholder" placeholder="{{summary}} will resolve to the current summary contents."></textarea>
|
||||
</div>
|
||||
<label for="memory_position" data-i18n="ext_sum_injection_position">Injection Position</label>
|
||||
<label class="checkbox_label" for="memory_include_wi_scan" data-i18n="[title]ext_sum_include_wi_scan_desc" title="Include the latest summary in the WI scan.">
|
||||
<input id="memory_include_wi_scan" type="checkbox" />
|
||||
<span data-i18n="ext_sum_include_wi_scan">Include in World Info Scanning</span>
|
||||
</label>
|
||||
<div class="radio_group">
|
||||
<label>
|
||||
<input type="radio" name="memory_position" value="-1" />
|
||||
<span data-i18n="None (not injected)">None (not injected)</span>
|
||||
<i class="fa-solid fa-info-circle" title="The summary will not be injected into the prompt. You can still access it via the {{summary}} macro." data-i18n="[title]ext_sum_injection_position_none"></i>
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="memory_position" value="2" />
|
||||
<span data-i18n="Before Main Prompt / Story String">Before Main Prompt / Story String</span>
|
||||
|
|
|
@ -23,10 +23,18 @@ export class QuickReplyApi {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* @param {QuickReply} qr
|
||||
* @returns {QuickReplySet}
|
||||
*/
|
||||
getSetByQr(qr) {
|
||||
return QuickReplySet.list.find(it=>it.qrList.includes(qr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and returns an existing Quick Reply Set by its name.
|
||||
*
|
||||
* @param {String} name name of the quick reply set
|
||||
* @param {string} name name of the quick reply set
|
||||
* @returns the quick reply set, or undefined if not found
|
||||
*/
|
||||
getSetByName(name) {
|
||||
|
@ -36,13 +44,14 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Finds and returns an existing Quick Reply by its set's name and its label.
|
||||
*
|
||||
* @param {String} setName name of the quick reply set
|
||||
* @param {String} label label of the quick reply
|
||||
* @param {string} setName name of the quick reply set
|
||||
* @param {string|number} label label or numeric ID of the quick reply
|
||||
* @returns the quick reply, or undefined if not found
|
||||
*/
|
||||
getQrByLabel(setName, label) {
|
||||
const set = this.getSetByName(setName);
|
||||
if (!set) return;
|
||||
if (Number.isInteger(label)) return set.qrList.find(it=>it.id == label);
|
||||
return set.qrList.find(it=>it.label == label);
|
||||
}
|
||||
|
||||
|
@ -70,24 +79,25 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Executes an existing quick reply.
|
||||
*
|
||||
* @param {String} setName name of the existing quick reply set
|
||||
* @param {String} label label of the existing quick reply (text on the button)
|
||||
* @param {Object} [args] optional arguments
|
||||
* @param {string} setName name of the existing quick reply set
|
||||
* @param {string|number} label label of the existing quick reply (text on the button) or its numeric ID
|
||||
* @param {object} [args] optional arguments
|
||||
* @param {import('../../../slash-commands.js').ExecuteSlashCommandsOptions} [options] optional execution options
|
||||
*/
|
||||
async executeQuickReply(setName, label, args = {}) {
|
||||
async executeQuickReply(setName, label, args = {}, options = {}) {
|
||||
const qr = this.getQrByLabel(setName, label);
|
||||
if (!qr) {
|
||||
throw new Error(`No quick reply with label "${label}" in set "${setName}" found.`);
|
||||
}
|
||||
return await qr.execute(args);
|
||||
return await qr.execute(args, false, false, options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds or removes a quick reply set to the list of globally active quick reply sets.
|
||||
*
|
||||
* @param {String} name the name of the set
|
||||
* @param {Boolean} isVisible whether to show the set's buttons or not
|
||||
* @param {string} name the name of the set
|
||||
* @param {boolean} isVisible whether to show the set's buttons or not
|
||||
*/
|
||||
toggleGlobalSet(name, isVisible = true) {
|
||||
const set = this.getSetByName(name);
|
||||
|
@ -104,8 +114,8 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Adds a quick reply set to the list of globally active quick reply sets.
|
||||
*
|
||||
* @param {String} name the name of the set
|
||||
* @param {Boolean} isVisible whether to show the set's buttons or not
|
||||
* @param {string} name the name of the set
|
||||
* @param {boolean} isVisible whether to show the set's buttons or not
|
||||
*/
|
||||
addGlobalSet(name, isVisible = true) {
|
||||
const set = this.getSetByName(name);
|
||||
|
@ -118,7 +128,7 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Removes a quick reply set from the list of globally active quick reply sets.
|
||||
*
|
||||
* @param {String} name the name of the set
|
||||
* @param {string} name the name of the set
|
||||
*/
|
||||
removeGlobalSet(name) {
|
||||
const set = this.getSetByName(name);
|
||||
|
@ -132,8 +142,8 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Adds or removes a quick reply set to the list of the current chat's active quick reply sets.
|
||||
*
|
||||
* @param {String} name the name of the set
|
||||
* @param {Boolean} isVisible whether to show the set's buttons or not
|
||||
* @param {string} name the name of the set
|
||||
* @param {boolean} isVisible whether to show the set's buttons or not
|
||||
*/
|
||||
toggleChatSet(name, isVisible = true) {
|
||||
if (!this.settings.chatConfig) return;
|
||||
|
@ -151,8 +161,8 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Adds a quick reply set to the list of the current chat's active quick reply sets.
|
||||
*
|
||||
* @param {String} name the name of the set
|
||||
* @param {Boolean} isVisible whether to show the set's buttons or not
|
||||
* @param {string} name the name of the set
|
||||
* @param {boolean} isVisible whether to show the set's buttons or not
|
||||
*/
|
||||
addChatSet(name, isVisible = true) {
|
||||
if (!this.settings.chatConfig) return;
|
||||
|
@ -166,7 +176,7 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Removes a quick reply set from the list of the current chat's active quick reply sets.
|
||||
*
|
||||
* @param {String} name the name of the set
|
||||
* @param {string} name the name of the set
|
||||
*/
|
||||
removeChatSet(name) {
|
||||
if (!this.settings.chatConfig) return;
|
||||
|
@ -181,21 +191,26 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Creates a new quick reply in an existing quick reply set.
|
||||
*
|
||||
* @param {String} setName name of the quick reply set to insert the new quick reply into
|
||||
* @param {String} label label for the new quick reply (text on the button)
|
||||
* @param {Object} [props]
|
||||
* @param {String} [props.message] the message to be sent or slash command to be executed by the new quick reply
|
||||
* @param {String} [props.title] the title / tooltip to be shown on the quick reply button
|
||||
* @param {Boolean} [props.isHidden] whether to hide or show the button
|
||||
* @param {Boolean} [props.executeOnStartup] whether to execute the quick reply when SillyTavern starts
|
||||
* @param {Boolean} [props.executeOnUser] whether to execute the quick reply after a user has sent a message
|
||||
* @param {Boolean} [props.executeOnAi] whether to execute the quick reply after the AI has sent a message
|
||||
* @param {Boolean} [props.executeOnChatChange] whether to execute the quick reply when a new chat is loaded
|
||||
* @param {Boolean} [props.executeOnGroupMemberDraft] whether to execute the quick reply when a group member is selected
|
||||
* @param {String} [props.automationId] when not empty, the quick reply will be executed when the WI with the given automation ID is activated
|
||||
* @param {string} setName name of the quick reply set to insert the new quick reply into
|
||||
* @param {string} label label for the new quick reply (text on the button)
|
||||
* @param {object} [props]
|
||||
* @param {string} [props.icon] the icon to show on the QR button
|
||||
* @param {boolean} [props.showLabel] whether to show the label even when an icon is assigned
|
||||
* @param {string} [props.message] the message to be sent or slash command to be executed by the new quick reply
|
||||
* @param {string} [props.title] the title / tooltip to be shown on the quick reply button
|
||||
* @param {boolean} [props.isHidden] whether to hide or show the button
|
||||
* @param {boolean} [props.executeOnStartup] whether to execute the quick reply when SillyTavern starts
|
||||
* @param {boolean} [props.executeOnUser] whether to execute the quick reply after a user has sent a message
|
||||
* @param {boolean} [props.executeOnAi] whether to execute the quick reply after the AI has sent a message
|
||||
* @param {boolean} [props.executeOnChatChange] whether to execute the quick reply when a new chat is loaded
|
||||
* @param {boolean} [props.executeOnGroupMemberDraft] whether to execute the quick reply when a group member is selected
|
||||
* @param {boolean} [props.executeOnNewChat] whether to execute the quick reply when a new chat is created
|
||||
* @param {string} [props.automationId] when not empty, the quick reply will be executed when the WI with the given automation ID is activated
|
||||
* @returns {QuickReply} the new quick reply
|
||||
*/
|
||||
createQuickReply(setName, label, {
|
||||
icon,
|
||||
showLabel,
|
||||
message,
|
||||
title,
|
||||
isHidden,
|
||||
|
@ -204,6 +219,7 @@ export class QuickReplyApi {
|
|||
executeOnAi,
|
||||
executeOnChatChange,
|
||||
executeOnGroupMemberDraft,
|
||||
executeOnNewChat,
|
||||
automationId,
|
||||
} = {}) {
|
||||
const set = this.getSetByName(setName);
|
||||
|
@ -212,6 +228,8 @@ export class QuickReplyApi {
|
|||
}
|
||||
const qr = set.addQuickReply();
|
||||
qr.label = label ?? '';
|
||||
qr.icon = icon ?? '';
|
||||
qr.showLabel = showLabel ?? false;
|
||||
qr.message = message ?? '';
|
||||
qr.title = title ?? '';
|
||||
qr.isHidden = isHidden ?? false;
|
||||
|
@ -220,6 +238,7 @@ export class QuickReplyApi {
|
|||
qr.executeOnAi = executeOnAi ?? false;
|
||||
qr.executeOnChatChange = executeOnChatChange ?? false;
|
||||
qr.executeOnGroupMemberDraft = executeOnGroupMemberDraft ?? false;
|
||||
qr.executeOnNewChat = executeOnNewChat ?? false;
|
||||
qr.automationId = automationId ?? '';
|
||||
qr.onUpdate();
|
||||
return qr;
|
||||
|
@ -228,22 +247,27 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Updates an existing quick reply.
|
||||
*
|
||||
* @param {String} setName name of the existing quick reply set
|
||||
* @param {String} label label of the existing quick reply (text on the button)
|
||||
* @param {Object} [props]
|
||||
* @param {String} [props.newLabel] new label for quick reply (text on the button)
|
||||
* @param {String} [props.message] the message to be sent or slash command to be executed by the quick reply
|
||||
* @param {String} [props.title] the title / tooltip to be shown on the quick reply button
|
||||
* @param {Boolean} [props.isHidden] whether to hide or show the button
|
||||
* @param {Boolean} [props.executeOnStartup] whether to execute the quick reply when SillyTavern starts
|
||||
* @param {Boolean} [props.executeOnUser] whether to execute the quick reply after a user has sent a message
|
||||
* @param {Boolean} [props.executeOnAi] whether to execute the quick reply after the AI has sent a message
|
||||
* @param {Boolean} [props.executeOnChatChange] whether to execute the quick reply when a new chat is loaded
|
||||
* @param {Boolean} [props.executeOnGroupMemberDraft] whether to execute the quick reply when a group member is selected
|
||||
* @param {String} [props.automationId] when not empty, the quick reply will be executed when the WI with the given automation ID is activated
|
||||
* @param {string} setName name of the existing quick reply set
|
||||
* @param {string|number} label label of the existing quick reply (text on the button) or its numeric ID
|
||||
* @param {object} [props]
|
||||
* @param {string} [props.icon] the icon to show on the QR button
|
||||
* @param {boolean} [props.showLabel] whether to show the label even when an icon is assigned
|
||||
* @param {string} [props.newLabel] new label for quick reply (text on the button)
|
||||
* @param {string} [props.message] the message to be sent or slash command to be executed by the quick reply
|
||||
* @param {string} [props.title] the title / tooltip to be shown on the quick reply button
|
||||
* @param {boolean} [props.isHidden] whether to hide or show the button
|
||||
* @param {boolean} [props.executeOnStartup] whether to execute the quick reply when SillyTavern starts
|
||||
* @param {boolean} [props.executeOnUser] whether to execute the quick reply after a user has sent a message
|
||||
* @param {boolean} [props.executeOnAi] whether to execute the quick reply after the AI has sent a message
|
||||
* @param {boolean} [props.executeOnChatChange] whether to execute the quick reply when a new chat is loaded
|
||||
* @param {boolean} [props.executeOnGroupMemberDraft] whether to execute the quick reply when a group member is selected
|
||||
* @param {boolean} [props.executeOnNewChat] whether to execute the quick reply when a new chat is created
|
||||
* @param {string} [props.automationId] when not empty, the quick reply will be executed when the WI with the given automation ID is activated
|
||||
* @returns {QuickReply} the altered quick reply
|
||||
*/
|
||||
updateQuickReply(setName, label, {
|
||||
icon,
|
||||
showLabel,
|
||||
newLabel,
|
||||
message,
|
||||
title,
|
||||
|
@ -253,12 +277,15 @@ export class QuickReplyApi {
|
|||
executeOnAi,
|
||||
executeOnChatChange,
|
||||
executeOnGroupMemberDraft,
|
||||
executeOnNewChat,
|
||||
automationId,
|
||||
} = {}) {
|
||||
const qr = this.getQrByLabel(setName, label);
|
||||
if (!qr) {
|
||||
throw new Error(`No quick reply with label "${label}" in set "${setName}" found.`);
|
||||
}
|
||||
qr.updateIcon(icon ?? qr.icon);
|
||||
qr.updateShowLabel(showLabel ?? qr.showLabel);
|
||||
qr.updateLabel(newLabel ?? qr.label);
|
||||
qr.updateMessage(message ?? qr.message);
|
||||
qr.updateTitle(title ?? qr.title);
|
||||
|
@ -268,6 +295,7 @@ export class QuickReplyApi {
|
|||
qr.executeOnAi = executeOnAi ?? qr.executeOnAi;
|
||||
qr.executeOnChatChange = executeOnChatChange ?? qr.executeOnChatChange;
|
||||
qr.executeOnGroupMemberDraft = executeOnGroupMemberDraft ?? qr.executeOnGroupMemberDraft;
|
||||
qr.executeOnNewChat = executeOnNewChat ?? qr.executeOnNewChat;
|
||||
qr.automationId = automationId ?? qr.automationId;
|
||||
qr.onUpdate();
|
||||
return qr;
|
||||
|
@ -276,8 +304,8 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Deletes an existing quick reply.
|
||||
*
|
||||
* @param {String} setName name of the existing quick reply set
|
||||
* @param {String} label label of the existing quick reply (text on the button)
|
||||
* @param {string} setName name of the existing quick reply set
|
||||
* @param {string|number} label label of the existing quick reply (text on the button) or its numeric ID
|
||||
*/
|
||||
deleteQuickReply(setName, label) {
|
||||
const qr = this.getQrByLabel(setName, label);
|
||||
|
@ -291,10 +319,10 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Adds an existing quick reply set as a context menu to an existing quick reply.
|
||||
*
|
||||
* @param {String} setName name of the existing quick reply set containing the quick reply
|
||||
* @param {String} label label of the existing quick reply
|
||||
* @param {String} contextSetName name of the existing quick reply set to be used as a context menu
|
||||
* @param {Boolean} isChained whether or not to chain the context menu quick replies
|
||||
* @param {string} setName name of the existing quick reply set containing the quick reply
|
||||
* @param {string|number} label label of the existing quick reply or its numeric ID
|
||||
* @param {string} contextSetName name of the existing quick reply set to be used as a context menu
|
||||
* @param {boolean} isChained whether or not to chain the context menu quick replies
|
||||
*/
|
||||
createContextItem(setName, label, contextSetName, isChained = false) {
|
||||
const qr = this.getQrByLabel(setName, label);
|
||||
|
@ -314,9 +342,9 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Removes a quick reply set from a quick reply's context menu.
|
||||
*
|
||||
* @param {String} setName name of the existing quick reply set containing the quick reply
|
||||
* @param {String} label label of the existing quick reply
|
||||
* @param {String} contextSetName name of the existing quick reply set to be used as a context menu
|
||||
* @param {string} setName name of the existing quick reply set containing the quick reply
|
||||
* @param {string|number} label label of the existing quick reply or its numeric ID
|
||||
* @param {string} contextSetName name of the existing quick reply set to be used as a context menu
|
||||
*/
|
||||
deleteContextItem(setName, label, contextSetName) {
|
||||
const qr = this.getQrByLabel(setName, label);
|
||||
|
@ -333,8 +361,8 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Removes all entries from a quick reply's context menu.
|
||||
*
|
||||
* @param {String} setName name of the existing quick reply set containing the quick reply
|
||||
* @param {String} label label of the existing quick reply
|
||||
* @param {string} setName name of the existing quick reply set containing the quick reply
|
||||
* @param {string|number} label label of the existing quick reply or its numeric ID
|
||||
*/
|
||||
clearContextMenu(setName, label) {
|
||||
const qr = this.getQrByLabel(setName, label);
|
||||
|
@ -348,11 +376,11 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Create a new quick reply set.
|
||||
*
|
||||
* @param {String} name name of the new quick reply set
|
||||
* @param {Object} [props]
|
||||
* @param {Boolean} [props.disableSend] whether or not to send the quick replies or put the message or slash command into the char input box
|
||||
* @param {Boolean} [props.placeBeforeInput] whether or not to place the quick reply contents before the existing user input
|
||||
* @param {Boolean} [props.injectInput] whether or not to automatically inject the user input at the end of the quick reply
|
||||
* @param {string} name name of the new quick reply set
|
||||
* @param {object} [props]
|
||||
* @param {boolean} [props.disableSend] whether or not to send the quick replies or put the message or slash command into the char input box
|
||||
* @param {boolean} [props.placeBeforeInput] whether or not to place the quick reply contents before the existing user input
|
||||
* @param {boolean} [props.injectInput] whether or not to automatically inject the user input at the end of the quick reply
|
||||
* @returns {Promise<QuickReplySet>} the new quick reply set
|
||||
*/
|
||||
async createSet(name, {
|
||||
|
@ -384,11 +412,11 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Update an existing quick reply set.
|
||||
*
|
||||
* @param {String} name name of the existing quick reply set
|
||||
* @param {Object} [props]
|
||||
* @param {Boolean} [props.disableSend] whether or not to send the quick replies or put the message or slash command into the char input box
|
||||
* @param {Boolean} [props.placeBeforeInput] whether or not to place the quick reply contents before the existing user input
|
||||
* @param {Boolean} [props.injectInput] whether or not to automatically inject the user input at the end of the quick reply
|
||||
* @param {string} name name of the existing quick reply set
|
||||
* @param {object} [props]
|
||||
* @param {boolean} [props.disableSend] whether or not to send the quick replies or put the message or slash command into the char input box
|
||||
* @param {boolean} [props.placeBeforeInput] whether or not to place the quick reply contents before the existing user input
|
||||
* @param {boolean} [props.injectInput] whether or not to automatically inject the user input at the end of the quick reply
|
||||
* @returns {Promise<QuickReplySet>} the altered quick reply set
|
||||
*/
|
||||
async updateSet(name, {
|
||||
|
@ -411,7 +439,7 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Delete an existing quick reply set.
|
||||
*
|
||||
* @param {String} name name of the existing quick reply set
|
||||
* @param {string} name name of the existing quick reply set
|
||||
*/
|
||||
async deleteSet(name) {
|
||||
const set = this.getSetByName(name);
|
||||
|
@ -451,7 +479,7 @@ export class QuickReplyApi {
|
|||
/**
|
||||
* Gets a list of all quick replies in the quick reply set.
|
||||
*
|
||||
* @param {String} setName name of the existing quick reply set
|
||||
* @param {string} setName name of the existing quick reply set
|
||||
* @returns array with the labels of this set's quick replies
|
||||
*/
|
||||
listQuickReplies(setName) {
|
||||
|
|
|
@ -2,10 +2,23 @@
|
|||
<div id="qr--main">
|
||||
<h3 data-i18n="Labels and Message">Labels and Message</h3>
|
||||
<div class="qr--labels">
|
||||
<label>
|
||||
<span class="qr--labelText" data-i18n="Label">Label</span>
|
||||
<input type="text" class="text_pole" id="qr--modal-label">
|
||||
<label class="qr--fit">
|
||||
<span class="qr--labelText" data-i18n="Label">Icon</span>
|
||||
<small class="qr--labelHint"> </small>
|
||||
<div class="menu_button fa-fw" id="qr--modal-icon" title="Click to change icon"></div>
|
||||
</label>
|
||||
<div class="label">
|
||||
<span class="qr--labelText" data-i18n="Label">Label</span>
|
||||
<small class="qr--labelHint" data-i18n="(label of the button, if no icon is chosen) ">(label of the button, if no icon is chosen)</small>
|
||||
<div class="qr--inputGroup">
|
||||
<label class="checkbox_label" title="Show label even if an icon is assigned">
|
||||
<input type="checkbox" id="qr--modal-showLabel">
|
||||
Show
|
||||
</label>
|
||||
<input type="text" class="text_pole" id="qr--modal-label">
|
||||
<div class="menu_button fa-fw fa-solid fa-chevron-down" id="qr--modal-switcher" title="Switch to another QR"></div>
|
||||
</div>
|
||||
</div>
|
||||
<label>
|
||||
<span class="qr--labelText" data-i18n="Title">Title</span>
|
||||
<small class="qr--labelHint" data-i18n="(tooltip, leave empty to show message or /command)">(tooltip, leave empty to show message or /command)</small>
|
||||
|
@ -33,6 +46,8 @@
|
|||
<input type="checkbox" id="qr--modal-syntax">
|
||||
<span>Syntax highlight</span>
|
||||
</label>
|
||||
<small>Ctrl+Alt+Click (or F9) to set / remove breakpoints</small>
|
||||
<small>Ctrl+<span id="qr--modal-commentKey"></span> to toggle block comments</small>
|
||||
</div>
|
||||
<div id="qr--modal-messageHolder">
|
||||
<pre id="qr--modal-messageSyntax"><code id="qr--modal-messageSyntaxInner" class="hljs language-stscript"></code></pre>
|
||||
|
@ -43,6 +58,10 @@
|
|||
|
||||
|
||||
|
||||
<div id="qr--resizeHandle"></div>
|
||||
|
||||
|
||||
|
||||
<div id="qr--qrOptions">
|
||||
<h3 data-i18n="Context Menu">Context Menu</h3>
|
||||
<div id="qr--ctxEditor">
|
||||
|
@ -64,7 +83,7 @@
|
|||
|
||||
|
||||
<h3 data-i18n="Auto-Execute">Auto-Execute</h3>
|
||||
<div class="flex-container flexFlowColumn">
|
||||
<div id="qr--autoExec" class="flex-container flexFlowColumn">
|
||||
<label class="checkbox_label" title="Prevent this quick reply from triggering other auto-executed quick replies while auto-executing (i.e., prevent recursive auto-execution)">
|
||||
<input type="checkbox" id="qr--preventAutoExecute" >
|
||||
<span><i class="fa-solid fa-fw fa-plane-slash"></i><span data-i18n="Don't trigger auto-execute">Don't trigger auto-execute</span></span>
|
||||
|
@ -89,6 +108,10 @@
|
|||
<input type="checkbox" id="qr--executeOnChatChange" >
|
||||
<span><i class="fa-solid fa-fw fa-message"></i><span data-i18n="Execute on chat change">Execute on chat change</span></span>
|
||||
</label>
|
||||
<label class="checkbox_label">
|
||||
<input type="checkbox" id="qr--executeOnNewChat">
|
||||
<span><i class="fa-solid fa-fw fa-comments"></i><span data-i18n="Execute on new chat">Execute on new chat</span></span>
|
||||
</label>
|
||||
<label class="checkbox_label">
|
||||
<input type="checkbox" id="qr--executeOnGroupMemberDraft">
|
||||
<span><i class="fa-solid fa-fw fa-people-group"></i><span data-i18n="Execute on group member draft">Execute on group member draft</span></span>
|
||||
|
@ -117,11 +140,18 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="qr--modal-executeProgress"></div>
|
||||
<label class="checkbox_label">
|
||||
<input type="checkbox" id="qr--modal-executeHide">
|
||||
<span title="Hide editor while executing"> Hide editor while executing</span>
|
||||
</label>
|
||||
<div id="qr--modal-executeErrors"></div>
|
||||
<div id="qr--modal-executeResult"></div>
|
||||
|
||||
<div id="qr--modal-debugButtons">
|
||||
<div title="Resume" id="qr--modal-resume" class="qr--modal-debugButton menu_button"></div>
|
||||
<div title="Step Over" id="qr--modal-step" class="qr--modal-debugButton menu_button"></div>
|
||||
<div title="Step Into" id="qr--modal-stepInto" class="qr--modal-debugButton menu_button"></div>
|
||||
<div title="Step Out" id="qr--modal-stepOut" class="qr--modal-debugButton menu_button"></div>
|
||||
<div title="Minimize" id="qr--modal-minimize" class="qr--modal-debugButton menu_button fa-solid fa-minimize"></div>
|
||||
<div title="Maximize" id="qr--modal-maximize" class="qr--modal-debugButton menu_button fa-solid fa-maximize"></div>
|
||||
</div>
|
||||
<textarea rows="1" id="qr--modal-send_textarea" placeholder="Chat input for use with {{input}}" title="Chat input for use with {{input}}"></textarea>
|
||||
<div id="qr--modal-debugState"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -60,10 +60,20 @@
|
|||
<label class="flex-container" id="qr--injectInputContainer">
|
||||
<input type="checkbox" id="qr--injectInput"> <span><span data-i18n="Inject user input automatically">Inject user input automatically</span> <small><span data-i18n="(if disabled, use ">(if disabled, use</span><code>{{input}}</code> <span data-i18n="macro for manual injection)">macro for manual injection)</span></small></span>
|
||||
</label>
|
||||
<div class="flex-container alignItemsCenter">
|
||||
<toolcool-color-picker id="qr--color"></toolcool-color-picker>
|
||||
<div class="menu_button" id="qr--colorClear">Clear</div>
|
||||
<span data-i18n="Color">Color</span>
|
||||
</div>
|
||||
<label class="flex-container" id="qr--onlyBorderColorContainer">
|
||||
<input type="checkbox" id="qr--onlyBorderColor"> <span data-i18n="Only apply color as accent">Only apply color as accent</span>
|
||||
</label>
|
||||
</div>
|
||||
<div id="qr--set-qrList" class="qr--qrList"></div>
|
||||
<div class="qr--set-qrListActions">
|
||||
<div class="qr--add menu_button menu_button_icon fa-solid fa-plus" id="qr--set-add" title="Add quick reply"></div>
|
||||
<div class="qr--paste menu_button menu_button_icon fa-solid fa-paste" id="qr--set-paste" title="Paste quick reply from clipboard"></div>
|
||||
<div class="qr--import menu_button menu_button_icon fa-solid fa-file-import" id="qr--set-importQr" title="Import quick reply from file"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -105,6 +105,7 @@ const loadSets = async () => {
|
|||
qr.executeOnAi = slot.autoExecute_botMessage ?? false;
|
||||
qr.executeOnChatChange = slot.autoExecute_chatLoad ?? false;
|
||||
qr.executeOnGroupMemberDraft = slot.autoExecute_groupMemberDraft ?? false;
|
||||
qr.executeOnNewChat = slot.autoExecute_newChat ?? false;
|
||||
qr.automationId = slot.automationId ?? '';
|
||||
qr.contextList = (slot.contextMenu ?? []).map(it=>({
|
||||
set: it.preset,
|
||||
|
@ -176,7 +177,7 @@ const init = async () => {
|
|||
buttons.show();
|
||||
settings.onSave = ()=>buttons.refresh();
|
||||
|
||||
window['executeQuickReplyByName'] = async(name, args = {}) => {
|
||||
window['executeQuickReplyByName'] = async(name, args = {}, options = {}) => {
|
||||
let qr = [...settings.config.setList, ...(settings.chatConfig?.setList ?? [])]
|
||||
.map(it=>it.set.qrList)
|
||||
.flat()
|
||||
|
@ -191,7 +192,7 @@ const init = async () => {
|
|||
}
|
||||
}
|
||||
if (qr && qr.onExecute) {
|
||||
return await qr.execute(args, false, true);
|
||||
return await qr.execute(args, false, true, options);
|
||||
} else {
|
||||
throw new Error(`No Quick Reply found for "${name}".`);
|
||||
}
|
||||
|
@ -260,3 +261,8 @@ const onWIActivation = async (entries) => {
|
|||
await autoExec.handleWIActivation(entries);
|
||||
};
|
||||
eventSource.on(event_types.WORLD_INFO_ACTIVATED, (...args) => executeIfReadyElseQueue(onWIActivation, args));
|
||||
|
||||
const onNewChat = async () => {
|
||||
await autoExec.handleNewChat();
|
||||
};
|
||||
eventSource.on(event_types.CHAT_CREATED, (...args) => executeIfReadyElseQueue(onNewChat, args));
|
||||
|
|
|
@ -0,0 +1,769 @@
|
|||
var DOCUMENT_FRAGMENT_NODE = 11;
|
||||
|
||||
function morphAttrs(fromNode, toNode) {
|
||||
var toNodeAttrs = toNode.attributes;
|
||||
var attr;
|
||||
var attrName;
|
||||
var attrNamespaceURI;
|
||||
var attrValue;
|
||||
var fromValue;
|
||||
|
||||
// document-fragments dont have attributes so lets not do anything
|
||||
if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE || fromNode.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// update attributes on original DOM element
|
||||
for (var i = toNodeAttrs.length - 1; i >= 0; i--) {
|
||||
attr = toNodeAttrs[i];
|
||||
attrName = attr.name;
|
||||
attrNamespaceURI = attr.namespaceURI;
|
||||
attrValue = attr.value;
|
||||
|
||||
if (attrNamespaceURI) {
|
||||
attrName = attr.localName || attrName;
|
||||
fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName);
|
||||
|
||||
if (fromValue !== attrValue) {
|
||||
if (attr.prefix === 'xmlns'){
|
||||
attrName = attr.name; // It's not allowed to set an attribute with the XMLNS namespace without specifying the `xmlns` prefix
|
||||
}
|
||||
fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue);
|
||||
}
|
||||
} else {
|
||||
fromValue = fromNode.getAttribute(attrName);
|
||||
|
||||
if (fromValue !== attrValue) {
|
||||
fromNode.setAttribute(attrName, attrValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any extra attributes found on the original DOM element that
|
||||
// weren't found on the target element.
|
||||
var fromNodeAttrs = fromNode.attributes;
|
||||
|
||||
for (var d = fromNodeAttrs.length - 1; d >= 0; d--) {
|
||||
attr = fromNodeAttrs[d];
|
||||
attrName = attr.name;
|
||||
attrNamespaceURI = attr.namespaceURI;
|
||||
|
||||
if (attrNamespaceURI) {
|
||||
attrName = attr.localName || attrName;
|
||||
|
||||
if (!toNode.hasAttributeNS(attrNamespaceURI, attrName)) {
|
||||
fromNode.removeAttributeNS(attrNamespaceURI, attrName);
|
||||
}
|
||||
} else {
|
||||
if (!toNode.hasAttribute(attrName)) {
|
||||
fromNode.removeAttribute(attrName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var range; // Create a range object for efficently rendering strings to elements.
|
||||
var NS_XHTML = 'http://www.w3.org/1999/xhtml';
|
||||
|
||||
var doc = typeof document === 'undefined' ? undefined : document;
|
||||
var HAS_TEMPLATE_SUPPORT = !!doc && 'content' in doc.createElement('template');
|
||||
var HAS_RANGE_SUPPORT = !!doc && doc.createRange && 'createContextualFragment' in doc.createRange();
|
||||
|
||||
function createFragmentFromTemplate(str) {
|
||||
var template = doc.createElement('template');
|
||||
template.innerHTML = str;
|
||||
return template.content.childNodes[0];
|
||||
}
|
||||
|
||||
function createFragmentFromRange(str) {
|
||||
if (!range) {
|
||||
range = doc.createRange();
|
||||
range.selectNode(doc.body);
|
||||
}
|
||||
|
||||
var fragment = range.createContextualFragment(str);
|
||||
return fragment.childNodes[0];
|
||||
}
|
||||
|
||||
function createFragmentFromWrap(str) {
|
||||
var fragment = doc.createElement('body');
|
||||
fragment.innerHTML = str;
|
||||
return fragment.childNodes[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* This is about the same
|
||||
* var html = new DOMParser().parseFromString(str, 'text/html');
|
||||
* return html.body.firstChild;
|
||||
*
|
||||
* @method toElement
|
||||
* @param {String} str
|
||||
*/
|
||||
function toElement(str) {
|
||||
str = str.trim();
|
||||
if (HAS_TEMPLATE_SUPPORT) {
|
||||
// avoid restrictions on content for things like `<tr><th>Hi</th></tr>` which
|
||||
// createContextualFragment doesn't support
|
||||
// <template> support not available in IE
|
||||
return createFragmentFromTemplate(str);
|
||||
} else if (HAS_RANGE_SUPPORT) {
|
||||
return createFragmentFromRange(str);
|
||||
}
|
||||
|
||||
return createFragmentFromWrap(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if two node's names are the same.
|
||||
*
|
||||
* NOTE: We don't bother checking `namespaceURI` because you will never find two HTML elements with the same
|
||||
* nodeName and different namespace URIs.
|
||||
*
|
||||
* @param {Element} a
|
||||
* @param {Element} b The target element
|
||||
* @return {boolean}
|
||||
*/
|
||||
function compareNodeNames(fromEl, toEl) {
|
||||
var fromNodeName = fromEl.nodeName;
|
||||
var toNodeName = toEl.nodeName;
|
||||
var fromCodeStart, toCodeStart;
|
||||
|
||||
if (fromNodeName === toNodeName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fromCodeStart = fromNodeName.charCodeAt(0);
|
||||
toCodeStart = toNodeName.charCodeAt(0);
|
||||
|
||||
// If the target element is a virtual DOM node or SVG node then we may
|
||||
// need to normalize the tag name before comparing. Normal HTML elements that are
|
||||
// in the "http://www.w3.org/1999/xhtml"
|
||||
// are converted to upper case
|
||||
if (fromCodeStart <= 90 && toCodeStart >= 97) { // from is upper and to is lower
|
||||
return fromNodeName === toNodeName.toUpperCase();
|
||||
} else if (toCodeStart <= 90 && fromCodeStart >= 97) { // to is upper and from is lower
|
||||
return toNodeName === fromNodeName.toUpperCase();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an element, optionally with a known namespace URI.
|
||||
*
|
||||
* @param {string} name the element name, e.g. 'div' or 'svg'
|
||||
* @param {string} [namespaceURI] the element's namespace URI, i.e. the value of
|
||||
* its `xmlns` attribute or its inferred namespace.
|
||||
*
|
||||
* @return {Element}
|
||||
*/
|
||||
function createElementNS(name, namespaceURI) {
|
||||
return !namespaceURI || namespaceURI === NS_XHTML ?
|
||||
doc.createElement(name) :
|
||||
doc.createElementNS(namespaceURI, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the children of one DOM element to another DOM element
|
||||
*/
|
||||
function moveChildren(fromEl, toEl) {
|
||||
var curChild = fromEl.firstChild;
|
||||
while (curChild) {
|
||||
var nextChild = curChild.nextSibling;
|
||||
toEl.appendChild(curChild);
|
||||
curChild = nextChild;
|
||||
}
|
||||
return toEl;
|
||||
}
|
||||
|
||||
function syncBooleanAttrProp(fromEl, toEl, name) {
|
||||
if (fromEl[name] !== toEl[name]) {
|
||||
fromEl[name] = toEl[name];
|
||||
if (fromEl[name]) {
|
||||
fromEl.setAttribute(name, '');
|
||||
} else {
|
||||
fromEl.removeAttribute(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var specialElHandlers = {
|
||||
OPTION: function(fromEl, toEl) {
|
||||
var parentNode = fromEl.parentNode;
|
||||
if (parentNode) {
|
||||
var parentName = parentNode.nodeName.toUpperCase();
|
||||
if (parentName === 'OPTGROUP') {
|
||||
parentNode = parentNode.parentNode;
|
||||
parentName = parentNode && parentNode.nodeName.toUpperCase();
|
||||
}
|
||||
if (parentName === 'SELECT' && !parentNode.hasAttribute('multiple')) {
|
||||
if (fromEl.hasAttribute('selected') && !toEl.selected) {
|
||||
// Workaround for MS Edge bug where the 'selected' attribute can only be
|
||||
// removed if set to a non-empty value:
|
||||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12087679/
|
||||
fromEl.setAttribute('selected', 'selected');
|
||||
fromEl.removeAttribute('selected');
|
||||
}
|
||||
// We have to reset select element's selectedIndex to -1, otherwise setting
|
||||
// fromEl.selected using the syncBooleanAttrProp below has no effect.
|
||||
// The correct selectedIndex will be set in the SELECT special handler below.
|
||||
parentNode.selectedIndex = -1;
|
||||
}
|
||||
}
|
||||
syncBooleanAttrProp(fromEl, toEl, 'selected');
|
||||
},
|
||||
/**
|
||||
* The "value" attribute is special for the <input> element since it sets
|
||||
* the initial value. Changing the "value" attribute without changing the
|
||||
* "value" property will have no effect since it is only used to the set the
|
||||
* initial value. Similar for the "checked" attribute, and "disabled".
|
||||
*/
|
||||
INPUT: function(fromEl, toEl) {
|
||||
syncBooleanAttrProp(fromEl, toEl, 'checked');
|
||||
syncBooleanAttrProp(fromEl, toEl, 'disabled');
|
||||
|
||||
if (fromEl.value !== toEl.value) {
|
||||
fromEl.value = toEl.value;
|
||||
}
|
||||
|
||||
if (!toEl.hasAttribute('value')) {
|
||||
fromEl.removeAttribute('value');
|
||||
}
|
||||
},
|
||||
|
||||
TEXTAREA: function(fromEl, toEl) {
|
||||
var newValue = toEl.value;
|
||||
if (fromEl.value !== newValue) {
|
||||
fromEl.value = newValue;
|
||||
}
|
||||
|
||||
var firstChild = fromEl.firstChild;
|
||||
if (firstChild) {
|
||||
// Needed for IE. Apparently IE sets the placeholder as the
|
||||
// node value and vise versa. This ignores an empty update.
|
||||
var oldValue = firstChild.nodeValue;
|
||||
|
||||
if (oldValue == newValue || (!newValue && oldValue == fromEl.placeholder)) {
|
||||
return;
|
||||
}
|
||||
|
||||
firstChild.nodeValue = newValue;
|
||||
}
|
||||
},
|
||||
SELECT: function(fromEl, toEl) {
|
||||
if (!toEl.hasAttribute('multiple')) {
|
||||
var selectedIndex = -1;
|
||||
var i = 0;
|
||||
// We have to loop through children of fromEl, not toEl since nodes can be moved
|
||||
// from toEl to fromEl directly when morphing.
|
||||
// At the time this special handler is invoked, all children have already been morphed
|
||||
// and appended to / removed from fromEl, so using fromEl here is safe and correct.
|
||||
var curChild = fromEl.firstChild;
|
||||
var optgroup;
|
||||
var nodeName;
|
||||
while(curChild) {
|
||||
nodeName = curChild.nodeName && curChild.nodeName.toUpperCase();
|
||||
if (nodeName === 'OPTGROUP') {
|
||||
optgroup = curChild;
|
||||
curChild = optgroup.firstChild;
|
||||
} else {
|
||||
if (nodeName === 'OPTION') {
|
||||
if (curChild.hasAttribute('selected')) {
|
||||
selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
curChild = curChild.nextSibling;
|
||||
if (!curChild && optgroup) {
|
||||
curChild = optgroup.nextSibling;
|
||||
optgroup = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fromEl.selectedIndex = selectedIndex;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var ELEMENT_NODE = 1;
|
||||
var DOCUMENT_FRAGMENT_NODE$1 = 11;
|
||||
var TEXT_NODE = 3;
|
||||
var COMMENT_NODE = 8;
|
||||
|
||||
function noop() {}
|
||||
|
||||
function defaultGetNodeKey(node) {
|
||||
if (node) {
|
||||
return (node.getAttribute && node.getAttribute('id')) || node.id;
|
||||
}
|
||||
}
|
||||
|
||||
function morphdomFactory(morphAttrs) {
|
||||
|
||||
return function morphdom(fromNode, toNode, options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof toNode === 'string') {
|
||||
if (fromNode.nodeName === '#document' || fromNode.nodeName === 'HTML' || fromNode.nodeName === 'BODY') {
|
||||
var toNodeHtml = toNode;
|
||||
toNode = doc.createElement('html');
|
||||
toNode.innerHTML = toNodeHtml;
|
||||
} else {
|
||||
toNode = toElement(toNode);
|
||||
}
|
||||
} else if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE$1) {
|
||||
toNode = toNode.firstElementChild;
|
||||
}
|
||||
|
||||
var getNodeKey = options.getNodeKey || defaultGetNodeKey;
|
||||
var onBeforeNodeAdded = options.onBeforeNodeAdded || noop;
|
||||
var onNodeAdded = options.onNodeAdded || noop;
|
||||
var onBeforeElUpdated = options.onBeforeElUpdated || noop;
|
||||
var onElUpdated = options.onElUpdated || noop;
|
||||
var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop;
|
||||
var onNodeDiscarded = options.onNodeDiscarded || noop;
|
||||
var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || noop;
|
||||
var skipFromChildren = options.skipFromChildren || noop;
|
||||
var addChild = options.addChild || function(parent, child){ return parent.appendChild(child); };
|
||||
var childrenOnly = options.childrenOnly === true;
|
||||
|
||||
// This object is used as a lookup to quickly find all keyed elements in the original DOM tree.
|
||||
var fromNodesLookup = Object.create(null);
|
||||
var keyedRemovalList = [];
|
||||
|
||||
function addKeyedRemoval(key) {
|
||||
keyedRemovalList.push(key);
|
||||
}
|
||||
|
||||
function walkDiscardedChildNodes(node, skipKeyedNodes) {
|
||||
if (node.nodeType === ELEMENT_NODE) {
|
||||
var curChild = node.firstChild;
|
||||
while (curChild) {
|
||||
|
||||
var key = undefined;
|
||||
|
||||
if (skipKeyedNodes && (key = getNodeKey(curChild))) {
|
||||
// If we are skipping keyed nodes then we add the key
|
||||
// to a list so that it can be handled at the very end.
|
||||
addKeyedRemoval(key);
|
||||
} else {
|
||||
// Only report the node as discarded if it is not keyed. We do this because
|
||||
// at the end we loop through all keyed elements that were unmatched
|
||||
// and then discard them in one final pass.
|
||||
onNodeDiscarded(curChild);
|
||||
if (curChild.firstChild) {
|
||||
walkDiscardedChildNodes(curChild, skipKeyedNodes);
|
||||
}
|
||||
}
|
||||
|
||||
curChild = curChild.nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a DOM node out of the original DOM
|
||||
*
|
||||
* @param {Node} node The node to remove
|
||||
* @param {Node} parentNode The nodes parent
|
||||
* @param {Boolean} skipKeyedNodes If true then elements with keys will be skipped and not discarded.
|
||||
* @return {undefined}
|
||||
*/
|
||||
function removeNode(node, parentNode, skipKeyedNodes) {
|
||||
if (onBeforeNodeDiscarded(node) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parentNode) {
|
||||
parentNode.removeChild(node);
|
||||
}
|
||||
|
||||
onNodeDiscarded(node);
|
||||
walkDiscardedChildNodes(node, skipKeyedNodes);
|
||||
}
|
||||
|
||||
// // TreeWalker implementation is no faster, but keeping this around in case this changes in the future
|
||||
// function indexTree(root) {
|
||||
// var treeWalker = document.createTreeWalker(
|
||||
// root,
|
||||
// NodeFilter.SHOW_ELEMENT);
|
||||
//
|
||||
// var el;
|
||||
// while((el = treeWalker.nextNode())) {
|
||||
// var key = getNodeKey(el);
|
||||
// if (key) {
|
||||
// fromNodesLookup[key] = el;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // NodeIterator implementation is no faster, but keeping this around in case this changes in the future
|
||||
//
|
||||
// function indexTree(node) {
|
||||
// var nodeIterator = document.createNodeIterator(node, NodeFilter.SHOW_ELEMENT);
|
||||
// var el;
|
||||
// while((el = nodeIterator.nextNode())) {
|
||||
// var key = getNodeKey(el);
|
||||
// if (key) {
|
||||
// fromNodesLookup[key] = el;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
function indexTree(node) {
|
||||
if (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE$1) {
|
||||
var curChild = node.firstChild;
|
||||
while (curChild) {
|
||||
var key = getNodeKey(curChild);
|
||||
if (key) {
|
||||
fromNodesLookup[key] = curChild;
|
||||
}
|
||||
|
||||
// Walk recursively
|
||||
indexTree(curChild);
|
||||
|
||||
curChild = curChild.nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
indexTree(fromNode);
|
||||
|
||||
function handleNodeAdded(el) {
|
||||
onNodeAdded(el);
|
||||
|
||||
var curChild = el.firstChild;
|
||||
while (curChild) {
|
||||
var nextSibling = curChild.nextSibling;
|
||||
|
||||
var key = getNodeKey(curChild);
|
||||
if (key) {
|
||||
var unmatchedFromEl = fromNodesLookup[key];
|
||||
// if we find a duplicate #id node in cache, replace `el` with cache value
|
||||
// and morph it to the child node.
|
||||
if (unmatchedFromEl && compareNodeNames(curChild, unmatchedFromEl)) {
|
||||
curChild.parentNode.replaceChild(unmatchedFromEl, curChild);
|
||||
morphEl(unmatchedFromEl, curChild);
|
||||
} else {
|
||||
handleNodeAdded(curChild);
|
||||
}
|
||||
} else {
|
||||
// recursively call for curChild and it's children to see if we find something in
|
||||
// fromNodesLookup
|
||||
handleNodeAdded(curChild);
|
||||
}
|
||||
|
||||
curChild = nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
function cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey) {
|
||||
// We have processed all of the "to nodes". If curFromNodeChild is
|
||||
// non-null then we still have some from nodes left over that need
|
||||
// to be removed
|
||||
while (curFromNodeChild) {
|
||||
var fromNextSibling = curFromNodeChild.nextSibling;
|
||||
if ((curFromNodeKey = getNodeKey(curFromNodeChild))) {
|
||||
// Since the node is keyed it might be matched up later so we defer
|
||||
// the actual removal to later
|
||||
addKeyedRemoval(curFromNodeKey);
|
||||
} else {
|
||||
// NOTE: we skip nested keyed nodes from being removed since there is
|
||||
// still a chance they will be matched up later
|
||||
removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);
|
||||
}
|
||||
curFromNodeChild = fromNextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
function morphEl(fromEl, toEl, childrenOnly) {
|
||||
var toElKey = getNodeKey(toEl);
|
||||
|
||||
if (toElKey) {
|
||||
// If an element with an ID is being morphed then it will be in the final
|
||||
// DOM so clear it out of the saved elements collection
|
||||
delete fromNodesLookup[toElKey];
|
||||
}
|
||||
|
||||
if (!childrenOnly) {
|
||||
// optional
|
||||
var beforeUpdateResult = onBeforeElUpdated(fromEl, toEl);
|
||||
if (beforeUpdateResult === false) {
|
||||
return;
|
||||
} else if (beforeUpdateResult instanceof HTMLElement) {
|
||||
fromEl = beforeUpdateResult;
|
||||
// reindex the new fromEl in case it's not in the same
|
||||
// tree as the original fromEl
|
||||
// (Phoenix LiveView sometimes returns a cloned tree,
|
||||
// but keyed lookups would still point to the original tree)
|
||||
indexTree(fromEl);
|
||||
}
|
||||
|
||||
// update attributes on original DOM element first
|
||||
morphAttrs(fromEl, toEl);
|
||||
// optional
|
||||
onElUpdated(fromEl);
|
||||
|
||||
if (onBeforeElChildrenUpdated(fromEl, toEl) === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (fromEl.nodeName !== 'TEXTAREA') {
|
||||
morphChildren(fromEl, toEl);
|
||||
} else {
|
||||
specialElHandlers.TEXTAREA(fromEl, toEl);
|
||||
}
|
||||
}
|
||||
|
||||
function morphChildren(fromEl, toEl) {
|
||||
var skipFrom = skipFromChildren(fromEl, toEl);
|
||||
var curToNodeChild = toEl.firstChild;
|
||||
var curFromNodeChild = fromEl.firstChild;
|
||||
var curToNodeKey;
|
||||
var curFromNodeKey;
|
||||
|
||||
var fromNextSibling;
|
||||
var toNextSibling;
|
||||
var matchingFromEl;
|
||||
|
||||
// walk the children
|
||||
outer: while (curToNodeChild) {
|
||||
toNextSibling = curToNodeChild.nextSibling;
|
||||
curToNodeKey = getNodeKey(curToNodeChild);
|
||||
|
||||
// walk the fromNode children all the way through
|
||||
while (!skipFrom && curFromNodeChild) {
|
||||
fromNextSibling = curFromNodeChild.nextSibling;
|
||||
|
||||
if (curToNodeChild.isSameNode && curToNodeChild.isSameNode(curFromNodeChild)) {
|
||||
curToNodeChild = toNextSibling;
|
||||
curFromNodeChild = fromNextSibling;
|
||||
continue outer;
|
||||
}
|
||||
|
||||
curFromNodeKey = getNodeKey(curFromNodeChild);
|
||||
|
||||
var curFromNodeType = curFromNodeChild.nodeType;
|
||||
|
||||
// this means if the curFromNodeChild doesnt have a match with the curToNodeChild
|
||||
var isCompatible = undefined;
|
||||
|
||||
if (curFromNodeType === curToNodeChild.nodeType) {
|
||||
if (curFromNodeType === ELEMENT_NODE) {
|
||||
// Both nodes being compared are Element nodes
|
||||
|
||||
if (curToNodeKey) {
|
||||
// The target node has a key so we want to match it up with the correct element
|
||||
// in the original DOM tree
|
||||
if (curToNodeKey !== curFromNodeKey) {
|
||||
// The current element in the original DOM tree does not have a matching key so
|
||||
// let's check our lookup to see if there is a matching element in the original
|
||||
// DOM tree
|
||||
if ((matchingFromEl = fromNodesLookup[curToNodeKey])) {
|
||||
if (fromNextSibling === matchingFromEl) {
|
||||
// Special case for single element removals. To avoid removing the original
|
||||
// DOM node out of the tree (since that can break CSS transitions, etc.),
|
||||
// we will instead discard the current node and wait until the next
|
||||
// iteration to properly match up the keyed target element with its matching
|
||||
// element in the original tree
|
||||
isCompatible = false;
|
||||
} else {
|
||||
// We found a matching keyed element somewhere in the original DOM tree.
|
||||
// Let's move the original DOM node into the current position and morph
|
||||
// it.
|
||||
|
||||
// NOTE: We use insertBefore instead of replaceChild because we want to go through
|
||||
// the `removeNode()` function for the node that is being discarded so that
|
||||
// all lifecycle hooks are correctly invoked
|
||||
fromEl.insertBefore(matchingFromEl, curFromNodeChild);
|
||||
|
||||
// fromNextSibling = curFromNodeChild.nextSibling;
|
||||
|
||||
if (curFromNodeKey) {
|
||||
// Since the node is keyed it might be matched up later so we defer
|
||||
// the actual removal to later
|
||||
addKeyedRemoval(curFromNodeKey);
|
||||
} else {
|
||||
// NOTE: we skip nested keyed nodes from being removed since there is
|
||||
// still a chance they will be matched up later
|
||||
removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);
|
||||
}
|
||||
|
||||
curFromNodeChild = matchingFromEl;
|
||||
curFromNodeKey = getNodeKey(curFromNodeChild);
|
||||
}
|
||||
} else {
|
||||
// The nodes are not compatible since the "to" node has a key and there
|
||||
// is no matching keyed node in the source tree
|
||||
isCompatible = false;
|
||||
}
|
||||
}
|
||||
} else if (curFromNodeKey) {
|
||||
// The original has a key
|
||||
isCompatible = false;
|
||||
}
|
||||
|
||||
isCompatible = isCompatible !== false && compareNodeNames(curFromNodeChild, curToNodeChild);
|
||||
if (isCompatible) {
|
||||
// We found compatible DOM elements so transform
|
||||
// the current "from" node to match the current
|
||||
// target DOM node.
|
||||
// MORPH
|
||||
morphEl(curFromNodeChild, curToNodeChild);
|
||||
}
|
||||
|
||||
} else if (curFromNodeType === TEXT_NODE || curFromNodeType == COMMENT_NODE) {
|
||||
// Both nodes being compared are Text or Comment nodes
|
||||
isCompatible = true;
|
||||
// Simply update nodeValue on the original node to
|
||||
// change the text value
|
||||
if (curFromNodeChild.nodeValue !== curToNodeChild.nodeValue) {
|
||||
curFromNodeChild.nodeValue = curToNodeChild.nodeValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (isCompatible) {
|
||||
// Advance both the "to" child and the "from" child since we found a match
|
||||
// Nothing else to do as we already recursively called morphChildren above
|
||||
curToNodeChild = toNextSibling;
|
||||
curFromNodeChild = fromNextSibling;
|
||||
continue outer;
|
||||
}
|
||||
|
||||
// No compatible match so remove the old node from the DOM and continue trying to find a
|
||||
// match in the original DOM. However, we only do this if the from node is not keyed
|
||||
// since it is possible that a keyed node might match up with a node somewhere else in the
|
||||
// target tree and we don't want to discard it just yet since it still might find a
|
||||
// home in the final DOM tree. After everything is done we will remove any keyed nodes
|
||||
// that didn't find a home
|
||||
if (curFromNodeKey) {
|
||||
// Since the node is keyed it might be matched up later so we defer
|
||||
// the actual removal to later
|
||||
addKeyedRemoval(curFromNodeKey);
|
||||
} else {
|
||||
// NOTE: we skip nested keyed nodes from being removed since there is
|
||||
// still a chance they will be matched up later
|
||||
removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);
|
||||
}
|
||||
|
||||
curFromNodeChild = fromNextSibling;
|
||||
} // END: while(curFromNodeChild) {}
|
||||
|
||||
// If we got this far then we did not find a candidate match for
|
||||
// our "to node" and we exhausted all of the children "from"
|
||||
// nodes. Therefore, we will just append the current "to" node
|
||||
// to the end
|
||||
if (curToNodeKey && (matchingFromEl = fromNodesLookup[curToNodeKey]) && compareNodeNames(matchingFromEl, curToNodeChild)) {
|
||||
// MORPH
|
||||
if(!skipFrom){ addChild(fromEl, matchingFromEl); }
|
||||
morphEl(matchingFromEl, curToNodeChild);
|
||||
} else {
|
||||
var onBeforeNodeAddedResult = onBeforeNodeAdded(curToNodeChild);
|
||||
if (onBeforeNodeAddedResult !== false) {
|
||||
if (onBeforeNodeAddedResult) {
|
||||
curToNodeChild = onBeforeNodeAddedResult;
|
||||
}
|
||||
|
||||
if (curToNodeChild.actualize) {
|
||||
curToNodeChild = curToNodeChild.actualize(fromEl.ownerDocument || doc);
|
||||
}
|
||||
addChild(fromEl, curToNodeChild);
|
||||
handleNodeAdded(curToNodeChild);
|
||||
}
|
||||
}
|
||||
|
||||
curToNodeChild = toNextSibling;
|
||||
curFromNodeChild = fromNextSibling;
|
||||
}
|
||||
|
||||
cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey);
|
||||
|
||||
var specialElHandler = specialElHandlers[fromEl.nodeName];
|
||||
if (specialElHandler) {
|
||||
specialElHandler(fromEl, toEl);
|
||||
}
|
||||
} // END: morphChildren(...)
|
||||
|
||||
var morphedNode = fromNode;
|
||||
var morphedNodeType = morphedNode.nodeType;
|
||||
var toNodeType = toNode.nodeType;
|
||||
|
||||
if (!childrenOnly) {
|
||||
// Handle the case where we are given two DOM nodes that are not
|
||||
// compatible (e.g. <div> --> <span> or <div> --> TEXT)
|
||||
if (morphedNodeType === ELEMENT_NODE) {
|
||||
if (toNodeType === ELEMENT_NODE) {
|
||||
if (!compareNodeNames(fromNode, toNode)) {
|
||||
onNodeDiscarded(fromNode);
|
||||
morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI));
|
||||
}
|
||||
} else {
|
||||
// Going from an element node to a text node
|
||||
morphedNode = toNode;
|
||||
}
|
||||
} else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) { // Text or comment node
|
||||
if (toNodeType === morphedNodeType) {
|
||||
if (morphedNode.nodeValue !== toNode.nodeValue) {
|
||||
morphedNode.nodeValue = toNode.nodeValue;
|
||||
}
|
||||
|
||||
return morphedNode;
|
||||
} else {
|
||||
// Text node to something else
|
||||
morphedNode = toNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (morphedNode === toNode) {
|
||||
// The "to node" was not compatible with the "from node" so we had to
|
||||
// toss out the "from node" and use the "to node"
|
||||
onNodeDiscarded(fromNode);
|
||||
} else {
|
||||
if (toNode.isSameNode && toNode.isSameNode(morphedNode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
morphEl(morphedNode, toNode, childrenOnly);
|
||||
|
||||
// We now need to loop over any keyed nodes that might need to be
|
||||
// removed. We only do the removal if we know that the keyed node
|
||||
// never found a match. When a keyed node is matched up we remove
|
||||
// it out of fromNodesLookup and we use fromNodesLookup to determine
|
||||
// if a keyed node has been matched up or not
|
||||
if (keyedRemovalList) {
|
||||
for (var i=0, len=keyedRemovalList.length; i<len; i++) {
|
||||
var elToRemove = fromNodesLookup[keyedRemovalList[i]];
|
||||
if (elToRemove) {
|
||||
removeNode(elToRemove, elToRemove.parentNode, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) {
|
||||
if (morphedNode.actualize) {
|
||||
morphedNode = morphedNode.actualize(fromNode.ownerDocument || doc);
|
||||
}
|
||||
// If we had to swap out the from node with a new node because the old
|
||||
// node was not compatible with the target node then we need to
|
||||
// replace the old DOM node in the original DOM tree. This is only
|
||||
// possible if the original DOM node was part of a DOM tree which
|
||||
// we know is the case if it has a parent node.
|
||||
fromNode.parentNode.replaceChild(morphedNode, fromNode);
|
||||
}
|
||||
|
||||
return morphedNode;
|
||||
};
|
||||
}
|
||||
|
||||
var morphdom = morphdomFactory(morphAttrs);
|
||||
|
||||
export default morphdom;
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Patrick Steele-Idem <pnidem@gmail.com> (psteeleidem.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -83,6 +83,15 @@ export class AutoExecuteHandler {
|
|||
await this.performAutoExecute(qrList);
|
||||
}
|
||||
|
||||
async handleNewChat() {
|
||||
if (!this.checkExecute()) return;
|
||||
const qrList = [
|
||||
...this.settings.config.setList.map(link=>link.set.qrList.filter(qr=>qr.executeOnNewChat)).flat(),
|
||||
...(this.settings.chatConfig?.setList?.map(link=>link.set.qrList.filter(qr=>qr.executeOnNewChat))?.flat() ?? []),
|
||||
];
|
||||
await this.performAutoExecute(qrList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any[]} entries Set of activated entries
|
||||
*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -60,7 +60,12 @@ export class QuickReplyConfig {
|
|||
/**@type {HTMLElement}*/
|
||||
this.setListDom = root.querySelector('.qr--setList');
|
||||
root.querySelector('.qr--setListAdd').addEventListener('click', ()=>{
|
||||
this.addSet(QuickReplySet.list[0]);
|
||||
const newSet = QuickReplySet.list.find(qr=>!this.setList.find(qrl=>qrl.set == qr));
|
||||
if (newSet) {
|
||||
this.addSet(newSet);
|
||||
} else {
|
||||
toastr.warning('All existing QR Sets have already been added.');
|
||||
}
|
||||
});
|
||||
this.updateSetListDom();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import { getRequestHeaders, substituteParams } from '../../../../script.js';
|
||||
import { Popup, POPUP_RESULT, POPUP_TYPE } from '../../../popup.js';
|
||||
import { executeSlashCommands, executeSlashCommandsOnChatInput, executeSlashCommandsWithOptions } from '../../../slash-commands.js';
|
||||
import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js';
|
||||
import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js';
|
||||
import { debounceAsync, warn } from '../index.js';
|
||||
import { debounceAsync, log, warn } from '../index.js';
|
||||
import { QuickReply } from './QuickReply.js';
|
||||
|
||||
export class QuickReplySet {
|
||||
|
@ -16,7 +18,7 @@ export class QuickReplySet {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {String} name - name of the QuickReplySet
|
||||
* @param {string} name - name of the QuickReplySet
|
||||
*/
|
||||
static get(name) {
|
||||
return this.list.find(it=>it.name == name);
|
||||
|
@ -25,17 +27,19 @@ export class QuickReplySet {
|
|||
|
||||
|
||||
|
||||
/**@type {String}*/ name;
|
||||
/**@type {Boolean}*/ disableSend = false;
|
||||
/**@type {Boolean}*/ placeBeforeInput = false;
|
||||
/**@type {Boolean}*/ injectInput = false;
|
||||
/**@type {string}*/ name;
|
||||
/**@type {boolean}*/ disableSend = false;
|
||||
/**@type {boolean}*/ placeBeforeInput = false;
|
||||
/**@type {boolean}*/ injectInput = false;
|
||||
/**@type {string}*/ color = 'transparent';
|
||||
/**@type {boolean}*/ onlyBorderColor = false;
|
||||
/**@type {QuickReply[]}*/ qrList = [];
|
||||
|
||||
/**@type {Number}*/ idIndex = 0;
|
||||
/**@type {number}*/ idIndex = 0;
|
||||
|
||||
/**@type {Boolean}*/ isDeleted = false;
|
||||
/**@type {boolean}*/ isDeleted = false;
|
||||
|
||||
/**@type {Function}*/ save;
|
||||
/**@type {function}*/ save;
|
||||
|
||||
/**@type {HTMLElement}*/ dom;
|
||||
/**@type {HTMLElement}*/ settingsDom;
|
||||
|
@ -64,6 +68,7 @@ export class QuickReplySet {
|
|||
const root = document.createElement('div'); {
|
||||
this.dom = root;
|
||||
root.classList.add('qr--buttons');
|
||||
this.updateColor();
|
||||
this.qrList.filter(qr=>!qr.isHidden).forEach(qr=>{
|
||||
root.append(qr.render());
|
||||
});
|
||||
|
@ -78,6 +83,22 @@ export class QuickReplySet {
|
|||
this.dom.append(qr.render());
|
||||
});
|
||||
}
|
||||
updateColor() {
|
||||
if (!this.dom) return;
|
||||
if (this.color && this.color != 'transparent') {
|
||||
this.dom.style.setProperty('--qr--color', this.color);
|
||||
this.dom.classList.add('qr--color');
|
||||
if (this.onlyBorderColor) {
|
||||
this.dom.classList.add('qr--borderColor');
|
||||
} else {
|
||||
this.dom.classList.remove('qr--borderColor');
|
||||
}
|
||||
} else {
|
||||
this.dom.style.setProperty('--qr--color', 'transparent');
|
||||
this.dom.classList.remove('qr--color');
|
||||
this.dom.classList.remove('qr--borderColor');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -93,6 +114,11 @@ export class QuickReplySet {
|
|||
}
|
||||
return this.settingsDom;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {QuickReply} qr
|
||||
* @param {number} idx
|
||||
*/
|
||||
renderSettingsItem(qr, idx) {
|
||||
this.settingsDom.append(qr.renderSettings(idx));
|
||||
}
|
||||
|
@ -100,6 +126,18 @@ export class QuickReplySet {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {QuickReply} qr
|
||||
*/
|
||||
async debug(qr) {
|
||||
const parser = new SlashCommandParser();
|
||||
const closure = parser.parse(qr.message, true, [], qr.abortController, qr.debugController);
|
||||
closure.source = `${this.name}.${qr.label}`;
|
||||
closure.onProgress = (done, total) => qr.updateEditorProgress(done, total);
|
||||
closure.scope.setMacro('arg::*', '');
|
||||
return (await closure.execute())?.pipe;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {QuickReply} qr The QR to execute.
|
||||
|
@ -109,6 +147,7 @@ export class QuickReplySet {
|
|||
* @param {boolean} [options.isEditor] (false) whether the execution is triggered by the QR editor
|
||||
* @param {boolean} [options.isRun] (false) whether the execution is triggered by /run or /: (window.executeQuickReplyByName)
|
||||
* @param {SlashCommandScope} [options.scope] (null) scope to be used when running the command
|
||||
* @param {import('../../../slash-commands.js').ExecuteSlashCommandsOptions} [options.executionOptions] ({}) further execution options
|
||||
* @returns
|
||||
*/
|
||||
async executeWithOptions(qr, options = {}) {
|
||||
|
@ -118,7 +157,9 @@ export class QuickReplySet {
|
|||
isEditor:false,
|
||||
isRun:false,
|
||||
scope:null,
|
||||
executionOptions:{},
|
||||
}, options);
|
||||
const execOptions = options.executionOptions;
|
||||
/**@type {HTMLTextAreaElement}*/
|
||||
const ta = document.querySelector('#send_textarea');
|
||||
const finalMessage = options.message ?? qr.message;
|
||||
|
@ -136,21 +177,24 @@ export class QuickReplySet {
|
|||
if (input[0] == '/' && !this.disableSend) {
|
||||
let result;
|
||||
if (options.isAutoExecute || options.isRun) {
|
||||
result = await executeSlashCommandsWithOptions(input, {
|
||||
result = await executeSlashCommandsWithOptions(input, Object.assign(execOptions, {
|
||||
handleParserErrors: true,
|
||||
scope: options.scope,
|
||||
});
|
||||
source: `${this.name}.${qr.label}`,
|
||||
}));
|
||||
} else if (options.isEditor) {
|
||||
result = await executeSlashCommandsWithOptions(input, {
|
||||
result = await executeSlashCommandsWithOptions(input, Object.assign(execOptions, {
|
||||
handleParserErrors: false,
|
||||
scope: options.scope,
|
||||
abortController: qr.abortController,
|
||||
source: `${this.name}.${qr.label}`,
|
||||
onProgress: (done, total) => qr.updateEditorProgress(done, total),
|
||||
});
|
||||
}));
|
||||
} else {
|
||||
result = await executeSlashCommandsOnChatInput(input, {
|
||||
result = await executeSlashCommandsOnChatInput(input, Object.assign(execOptions, {
|
||||
scope: options.scope,
|
||||
});
|
||||
source: `${this.name}.${qr.label}`,
|
||||
}));
|
||||
}
|
||||
return typeof result === 'object' ? result?.pipe : '';
|
||||
}
|
||||
|
@ -165,7 +209,7 @@ export class QuickReplySet {
|
|||
}
|
||||
/**
|
||||
* @param {QuickReply} qr
|
||||
* @param {String} [message] - optional altered message to be used
|
||||
* @param {string} [message] - optional altered message to be used
|
||||
* @param {SlashCommandScope} [scope] - optional scope to be used when running the command
|
||||
*/
|
||||
async execute(qr, message = null, isAutoExecute = false, scope = null) {
|
||||
|
@ -179,10 +223,11 @@ export class QuickReplySet {
|
|||
|
||||
|
||||
|
||||
addQuickReply() {
|
||||
addQuickReply(data = {}) {
|
||||
const id = Math.max(this.idIndex, this.qrList.reduce((max,qr)=>Math.max(max,qr.id),0)) + 1;
|
||||
data.id =
|
||||
this.idIndex = id + 1;
|
||||
const qr = QuickReply.from({ id });
|
||||
const qr = QuickReply.from(data);
|
||||
this.qrList.push(qr);
|
||||
this.hookQuickReply(qr);
|
||||
if (this.settingsDom) {
|
||||
|
@ -194,11 +239,131 @@ export class QuickReplySet {
|
|||
this.save();
|
||||
return qr;
|
||||
}
|
||||
addQuickReplyFromText(qrJson) {
|
||||
let data;
|
||||
if (qrJson) {
|
||||
try {
|
||||
data = JSON.parse(qrJson ?? '{}');
|
||||
delete data.id;
|
||||
} catch {
|
||||
// not JSON data
|
||||
}
|
||||
if (data) {
|
||||
// JSON data
|
||||
if (data.label === undefined || data.message === undefined) {
|
||||
// not a QR
|
||||
toastr.error('Not a QR.');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// no JSON, use plaintext as QR message
|
||||
data = { message: qrJson };
|
||||
}
|
||||
} else {
|
||||
data = {};
|
||||
}
|
||||
const newQr = this.addQuickReply(data);
|
||||
return newQr;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {QuickReply} qr
|
||||
*/
|
||||
hookQuickReply(qr) {
|
||||
qr.onDebug = ()=>this.debug(qr);
|
||||
qr.onExecute = (_, options)=>this.executeWithOptions(qr, options);
|
||||
qr.onDelete = ()=>this.removeQuickReply(qr);
|
||||
qr.onUpdate = ()=>this.save();
|
||||
qr.onInsertBefore = (qrJson)=>{
|
||||
this.addQuickReplyFromText(qrJson);
|
||||
const newQr = this.qrList.pop();
|
||||
this.qrList.splice(this.qrList.indexOf(qr), 0, newQr);
|
||||
if (qr.settingsDom) {
|
||||
qr.settingsDom.insertAdjacentElement('beforebegin', newQr.settingsDom);
|
||||
}
|
||||
this.save();
|
||||
};
|
||||
qr.onTransfer = async()=>{
|
||||
/**@type {HTMLSelectElement} */
|
||||
let sel;
|
||||
let isCopy = false;
|
||||
const dom = document.createElement('div'); {
|
||||
dom.classList.add('qr--transferModal');
|
||||
const title = document.createElement('h3'); {
|
||||
title.textContent = 'Transfer Quick Reply';
|
||||
dom.append(title);
|
||||
}
|
||||
const subTitle = document.createElement('h4'); {
|
||||
const entryName = qr.label;
|
||||
const bookName = this.name;
|
||||
subTitle.textContent = `${bookName}: ${entryName}`;
|
||||
dom.append(subTitle);
|
||||
}
|
||||
sel = document.createElement('select'); {
|
||||
sel.classList.add('qr--transferSelect');
|
||||
sel.setAttribute('autofocus', '1');
|
||||
const noOpt = document.createElement('option'); {
|
||||
noOpt.value = '';
|
||||
noOpt.textContent = '-- Select QR Set --';
|
||||
sel.append(noOpt);
|
||||
}
|
||||
for (const qrs of QuickReplySet.list) {
|
||||
const opt = document.createElement('option'); {
|
||||
opt.value = qrs.name;
|
||||
opt.textContent = qrs.name;
|
||||
sel.append(opt);
|
||||
}
|
||||
}
|
||||
sel.addEventListener('keyup', (evt)=>{
|
||||
if (evt.key == 'Shift') {
|
||||
(dlg.dom ?? dlg.dlg).classList.remove('qr--isCopy');
|
||||
return;
|
||||
}
|
||||
});
|
||||
sel.addEventListener('keydown', (evt)=>{
|
||||
if (evt.key == 'Shift') {
|
||||
(dlg.dom ?? dlg.dlg).classList.add('qr--isCopy');
|
||||
return;
|
||||
}
|
||||
if (!evt.ctrlKey && !evt.altKey && evt.key == 'Enter') {
|
||||
evt.preventDefault();
|
||||
if (evt.shiftKey) isCopy = true;
|
||||
dlg.completeAffirmative();
|
||||
}
|
||||
});
|
||||
dom.append(sel);
|
||||
}
|
||||
const hintP = document.createElement('p'); {
|
||||
const hint = document.createElement('small'); {
|
||||
hint.textContent = 'Type or arrows to select QR Set. Enter to transfer. Shift+Enter to copy.';
|
||||
hintP.append(hint);
|
||||
}
|
||||
dom.append(hintP);
|
||||
}
|
||||
}
|
||||
const dlg = new Popup(dom, POPUP_TYPE.CONFIRM, null, { okButton:'Transfer', cancelButton:'Cancel' });
|
||||
const copyBtn = document.createElement('div'); {
|
||||
copyBtn.classList.add('qr--copy');
|
||||
copyBtn.classList.add('menu_button');
|
||||
copyBtn.textContent = 'Copy';
|
||||
copyBtn.addEventListener('click', ()=>{
|
||||
isCopy = true;
|
||||
dlg.completeAffirmative();
|
||||
});
|
||||
(dlg.ok ?? dlg.okButton).insertAdjacentElement('afterend', copyBtn);
|
||||
}
|
||||
const prom = dlg.show();
|
||||
sel.focus();
|
||||
await prom;
|
||||
if (dlg.result == POPUP_RESULT.AFFIRMATIVE) {
|
||||
const qrs = QuickReplySet.list.find(it=>it.name == sel.value);
|
||||
qrs.addQuickReply(qr.toJSON());
|
||||
if (!isCopy) {
|
||||
qr.delete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
removeQuickReply(qr) {
|
||||
|
@ -214,6 +379,8 @@ export class QuickReplySet {
|
|||
disableSend: this.disableSend,
|
||||
placeBeforeInput: this.placeBeforeInput,
|
||||
injectInput: this.injectInput,
|
||||
color: this.color,
|
||||
onlyBorderColor: this.onlyBorderColor,
|
||||
qrList: this.qrList,
|
||||
idIndex: this.idIndex,
|
||||
};
|
||||
|
@ -245,8 +412,12 @@ export class QuickReplySet {
|
|||
if (response.ok) {
|
||||
this.unrender();
|
||||
const idx = QuickReplySet.list.indexOf(this);
|
||||
QuickReplySet.list.splice(idx, 1);
|
||||
this.isDeleted = true;
|
||||
if (idx > -1) {
|
||||
QuickReplySet.list.splice(idx, 1);
|
||||
this.isDeleted = true;
|
||||
} else {
|
||||
warn(`Deleted Quick Reply Set was not found in the list of sets: ${this.name}`);
|
||||
}
|
||||
} else {
|
||||
warn(`Failed to delete Quick Reply Set: ${this.name}`);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ export class QuickReplySetLink {
|
|||
this.set = QuickReplySet.get(set.value);
|
||||
this.update();
|
||||
});
|
||||
QuickReplySet.list.forEach(qrs=>{
|
||||
QuickReplySet.list.toSorted((a,b)=>a.name.toLowerCase().localeCompare(b.name.toLowerCase())).forEach(qrs=>{
|
||||
const opt = document.createElement('option'); {
|
||||
opt.value = qrs.name;
|
||||
opt.textContent = qrs.name;
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
import { SlashCommand } from '../../../slash-commands/SlashCommand.js';
|
||||
import { SlashCommandAbortController } from '../../../slash-commands/SlashCommandAbortController.js';
|
||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../../slash-commands/SlashCommandArgument.js';
|
||||
import { SlashCommandClosure } from '../../../slash-commands/SlashCommandClosure.js';
|
||||
import { enumIcons } from '../../../slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||
import { SlashCommandDebugController } from '../../../slash-commands/SlashCommandDebugController.js';
|
||||
import { SlashCommandEnumValue, enumTypes } from '../../../slash-commands/SlashCommandEnumValue.js';
|
||||
import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js';
|
||||
import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js';
|
||||
import { isTrueBoolean } from '../../../utils.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReplyApi } from '../api/QuickReplyApi.js';
|
||||
|
@ -47,6 +51,13 @@ export class SlashCommandHandler {
|
|||
return new SlashCommandEnumValue(qr.label, message, enumTypes.enum, enumIcons.qr);
|
||||
}) ?? [],
|
||||
|
||||
/** All QRs inside a set, utilizing the "set" named argument, returns the QR's ID */
|
||||
qrIds: (executor) => QuickReplySet.get(String(executor.namedArgumentList.find(x => x.name == 'set')?.value))?.qrList.map(qr => {
|
||||
const icons = getExecutionIcons(qr);
|
||||
const message = `${qr.automationId ? `[${qr.automationId}]` : ''}${icons ? `[auto: ${icons}]` : ''} ${qr.title || qr.message}`.trim();
|
||||
return new SlashCommandEnumValue(qr.label, message, enumTypes.enum, enumIcons.qr, null, ()=>qr.id.toString(), true);
|
||||
}) ?? [],
|
||||
|
||||
/** All QRs as a set.name string, to be able to execute, for example via the /run command */
|
||||
qrExecutables: () => {
|
||||
const globalSetList = this.api.settings.config.setList;
|
||||
|
@ -63,7 +74,7 @@ export class SlashCommandHandler {
|
|||
...otherQrs.map(x => new SlashCommandEnumValue(`${x.set.name}.${x.qr.label}`, `${x.qr.title || x.qr.message}`, enumTypes.qr, enumIcons.qr)),
|
||||
];
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
window['qrEnumProviderExecutables'] = localEnumProviders.qrExecutables;
|
||||
|
||||
|
@ -234,8 +245,20 @@ export class SlashCommandHandler {
|
|||
name: 'label',
|
||||
description: 'text on the button, e.g., label=MyButton',
|
||||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
isRequired: true,
|
||||
enumProvider: localEnumProviders.qrLabels,
|
||||
isRequired: false,
|
||||
enumProvider: localEnumProviders.qrEntries,
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'icon',
|
||||
description: 'icon to show on the button, e.g., icon=fa-pencil',
|
||||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
isRequired: false,
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'showlabel',
|
||||
description: 'whether to show the label even when an icon is assigned, e.g., icon=fa-pencil showlabel=true',
|
||||
typeList: [ARGUMENT_TYPE.BOOLEAN],
|
||||
isRequired: false,
|
||||
}),
|
||||
new SlashCommandNamedArgument('hidden', 'whether the button should be hidden, e.g., hidden=true', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false'),
|
||||
new SlashCommandNamedArgument('startup', 'auto execute on app startup, e.g., startup=true', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false'),
|
||||
|
@ -247,6 +270,13 @@ export class SlashCommandHandler {
|
|||
];
|
||||
const qrUpdateArgs = [
|
||||
new SlashCommandNamedArgument('newlabel', 'new text for the button', [ARGUMENT_TYPE.STRING], false),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'id',
|
||||
description: 'numeric ID of the QR, e.g., id=42',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
isRequired: false,
|
||||
enumProvider: localEnumProviders.qrIds,
|
||||
}),
|
||||
];
|
||||
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-create',
|
||||
|
@ -272,13 +302,61 @@ export class SlashCommandHandler {
|
|||
</div>
|
||||
`,
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-get',
|
||||
callback: (args, _) => {
|
||||
return this.getQuickReply(args);
|
||||
},
|
||||
namedArgumentList: [
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'set',
|
||||
description: 'name of the QR set, e.g., set=PresetName1',
|
||||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
isRequired: true,
|
||||
enumProvider: localEnumProviders.qrSets,
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'label',
|
||||
description: 'text on the button, e.g., label=MyButton',
|
||||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
isRequired: false,
|
||||
enumProvider: localEnumProviders.qrEntries,
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'id',
|
||||
description: 'numeric ID of the QR, e.g., id=42',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
isRequired: false,
|
||||
enumProvider: localEnumProviders.qrIds,
|
||||
}),
|
||||
],
|
||||
returns: 'a dictionary with all the QR\'s properties',
|
||||
helpString: `
|
||||
<div>Get a Quick Reply's properties.</div>
|
||||
<div>
|
||||
<strong>Examples:</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<pre><code>/qr-get set=MyPreset label=MyButton | /echo</code></pre>
|
||||
<pre><code>/qr-get set=MyPreset id=42 | /echo</code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-update',
|
||||
callback: (args, message) => {
|
||||
this.updateQuickReply(args, message);
|
||||
return '';
|
||||
},
|
||||
returns: 'updated quick reply',
|
||||
namedArgumentList: [...qrUpdateArgs, ...qrArgs],
|
||||
namedArgumentList: [...qrUpdateArgs, ...qrArgs.map(it=>{
|
||||
if (it.name == 'label') {
|
||||
const clone = SlashCommandNamedArgument.fromProps(it);
|
||||
clone.isRequired = false;
|
||||
return clone;
|
||||
}
|
||||
return it;
|
||||
})],
|
||||
unnamedArgumentList: [
|
||||
new SlashCommandArgument('command', [ARGUMENT_TYPE.STRING]),
|
||||
],
|
||||
|
@ -315,6 +393,12 @@ export class SlashCommandHandler {
|
|||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
enumProvider: localEnumProviders.qrEntries,
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'id',
|
||||
description: 'numeric ID of the QR, e.g., id=42',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
enumProvider: localEnumProviders.qrIds,
|
||||
}),
|
||||
],
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
|
@ -344,6 +428,12 @@ export class SlashCommandHandler {
|
|||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
enumProvider: localEnumProviders.qrEntries,
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'id',
|
||||
description: 'numeric ID of the QR, e.g., id=42',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
enumProvider: localEnumProviders.qrIds,
|
||||
}),
|
||||
new SlashCommandNamedArgument(
|
||||
'chain', 'boolean', [ARGUMENT_TYPE.BOOLEAN], false, false, 'false',
|
||||
),
|
||||
|
@ -389,6 +479,12 @@ export class SlashCommandHandler {
|
|||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
enumProvider: localEnumProviders.qrEntries,
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'id',
|
||||
description: 'numeric ID of the QR, e.g., id=42',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
enumProvider: localEnumProviders.qrIds,
|
||||
}),
|
||||
],
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
|
@ -425,6 +521,12 @@ export class SlashCommandHandler {
|
|||
isRequired: true,
|
||||
enumProvider: localEnumProviders.qrSets,
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'id',
|
||||
description: 'numeric ID of the QR, e.g., id=42',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
enumProvider: localEnumProviders.qrIds,
|
||||
}),
|
||||
],
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
|
@ -454,8 +556,8 @@ export class SlashCommandHandler {
|
|||
new SlashCommandNamedArgument('inject', 'inject user input automatically (if disabled use {{input}})', [ARGUMENT_TYPE.BOOLEAN], false),
|
||||
];
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-create',
|
||||
callback: (args, name) => {
|
||||
this.createSet(name, args);
|
||||
callback: async (args, name) => {
|
||||
await this.createSet(name, args);
|
||||
return '';
|
||||
},
|
||||
aliases: ['qr-presetadd'],
|
||||
|
@ -485,8 +587,8 @@ export class SlashCommandHandler {
|
|||
}));
|
||||
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-update',
|
||||
callback: (args, name) => {
|
||||
this.updateSet(name, args);
|
||||
callback: async (args, name) => {
|
||||
await this.updateSet(name, args);
|
||||
return '';
|
||||
},
|
||||
aliases: ['qr-presetupdate'],
|
||||
|
@ -510,8 +612,8 @@ export class SlashCommandHandler {
|
|||
`,
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-delete',
|
||||
callback: (_, name) => {
|
||||
this.deleteSet(name);
|
||||
callback: async (_, name) => {
|
||||
await this.deleteSet(name);
|
||||
return '';
|
||||
},
|
||||
aliases: ['qr-presetdelete'],
|
||||
|
@ -533,6 +635,134 @@ export class SlashCommandHandler {
|
|||
</div>
|
||||
`,
|
||||
}));
|
||||
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-arg',
|
||||
callback: ({ _scope }, [key, value]) => {
|
||||
_scope.setMacro(`arg::${key}`, value, key.includes('*'));
|
||||
return '';
|
||||
},
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({ description: 'argument name',
|
||||
typeList: ARGUMENT_TYPE.STRING,
|
||||
isRequired: true,
|
||||
}),
|
||||
SlashCommandArgument.fromProps({ description: 'argument value',
|
||||
typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.BOOLEAN, ARGUMENT_TYPE.LIST, ARGUMENT_TYPE.DICTIONARY],
|
||||
isRequired: true,
|
||||
}),
|
||||
],
|
||||
splitUnnamedArgument: true,
|
||||
splitUnnamedArgumentCount: 2,
|
||||
helpString: `
|
||||
<div>
|
||||
Set a fallback value for a Quick Reply argument.
|
||||
</div>
|
||||
<div>
|
||||
<strong>Example:</strong>
|
||||
<pre><code>/qr-arg x foo |\n/echo {{arg::x}}</code></pre>
|
||||
</div>
|
||||
`,
|
||||
}));
|
||||
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'import',
|
||||
/**
|
||||
*
|
||||
* @param {{_scope:SlashCommandScope, _abortController:SlashCommandAbortController, _debugController:SlashCommandDebugController, from:string}} args
|
||||
* @param {string} value
|
||||
*/
|
||||
callback: (args, value) => {
|
||||
if (!args.from) throw new Error('/import requires from= to be set.');
|
||||
if (!value) throw new Error('/import requires the unnamed argument to be set.');
|
||||
let qr = [...this.api.listGlobalSets(), ...this.api.listChatSets()]
|
||||
.map(it=>this.api.getSetByName(it)?.qrList ?? [])
|
||||
.flat()
|
||||
.find(it=>it.label == args.from)
|
||||
;
|
||||
if (!qr) {
|
||||
let [setName, ...qrNameParts] = args.from.split('.');
|
||||
let qrName = qrNameParts.join('.');
|
||||
let qrs = QuickReplySet.get(setName);
|
||||
if (qrs) {
|
||||
qr = qrs.qrList.find(it=>it.label == qrName);
|
||||
}
|
||||
}
|
||||
if (qr) {
|
||||
const parser = new SlashCommandParser();
|
||||
const closure = parser.parse(qr.message, true, [], args._abortController, args._debugController);
|
||||
if (args._debugController) {
|
||||
closure.source = args.from;
|
||||
}
|
||||
const testCandidates = (executor)=>{
|
||||
return (
|
||||
executor.namedArgumentList.find(arg=>arg.name == 'key')
|
||||
&& executor.unnamedArgumentList.length > 0
|
||||
&& executor.unnamedArgumentList[0].value instanceof SlashCommandClosure
|
||||
) || (
|
||||
!executor.namedArgumentList.find(arg=>arg.name == 'key')
|
||||
&& executor.unnamedArgumentList.length > 1
|
||||
&& executor.unnamedArgumentList[1].value instanceof SlashCommandClosure
|
||||
);
|
||||
};
|
||||
const candidates = closure.executorList
|
||||
.filter(executor=>['let', 'var'].includes(executor.command.name))
|
||||
.filter(testCandidates)
|
||||
.map(executor=>({
|
||||
key: executor.namedArgumentList.find(arg=>arg.name == 'key')?.value ?? executor.unnamedArgumentList[0].value,
|
||||
value: executor.unnamedArgumentList[executor.namedArgumentList.find(arg=>arg.name == 'key') ? 0 : 1].value,
|
||||
}))
|
||||
;
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const srcName = value[i];
|
||||
let dstName = srcName;
|
||||
if (i + 2 < value.length && value[i + 1] == 'as') {
|
||||
dstName = value[i + 2];
|
||||
i += 2;
|
||||
}
|
||||
const pick = candidates.find(it=>it.key == srcName);
|
||||
if (!pick) throw new Error(`No scoped closure named "${srcName}" found in "${args.from}"`);
|
||||
if (args._scope.existsVariableInScope(dstName)) {
|
||||
args._scope.setVariable(dstName, pick.value);
|
||||
} else {
|
||||
args._scope.letVariable(dstName, pick.value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Error(`No Quick Reply found for "${name}".`);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
namedArgumentList: [
|
||||
SlashCommandNamedArgument.fromProps({ name: 'from',
|
||||
description: 'Quick Reply to import from (QRSet.QRLabel)',
|
||||
typeList: ARGUMENT_TYPE.STRING,
|
||||
isRequired: true,
|
||||
}),
|
||||
],
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({ description: 'what to import (x or x as y)',
|
||||
acceptsMultiple: true,
|
||||
typeList: ARGUMENT_TYPE.STRING,
|
||||
isRequired: true,
|
||||
}),
|
||||
],
|
||||
splitUnnamedArgument: true,
|
||||
helpString: `
|
||||
<div>
|
||||
Import one or more closures from another Quick Reply.
|
||||
</div>
|
||||
<div>
|
||||
Only imports closures that are directly assigned a scoped variable via <code>/let</code> or <code>/var</code>.
|
||||
</div>
|
||||
<div>
|
||||
<strong>Examples:</strong>
|
||||
<ul>
|
||||
<li><pre><code>/import from=LibraryQrSet.FooBar foo |\n/:foo</code></pre></li>
|
||||
<li><pre><code>/import from=LibraryQrSet.FooBar\n\tfoo\n\tbar\n|\n/:foo |\n/:bar</code></pre></li>
|
||||
<li><pre><code>/import from=LibraryQrSet.FooBar\n\tfoo as x\n\tbar as y\n|\n/:x |\n/:y</code></pre></li>
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
@ -618,6 +848,8 @@ export class SlashCommandHandler {
|
|||
args.set ?? '',
|
||||
args.label ?? '',
|
||||
{
|
||||
icon: args.icon,
|
||||
showLabel: args.showlabel === undefined ? undefined : isTrueBoolean(args.showlabel),
|
||||
message: message ?? '',
|
||||
title: args.title,
|
||||
isHidden: isTrueBoolean(args.hidden),
|
||||
|
@ -633,12 +865,21 @@ export class SlashCommandHandler {
|
|||
toastr.error(ex.message);
|
||||
}
|
||||
}
|
||||
getQuickReply(args) {
|
||||
try {
|
||||
return JSON.stringify(this.api.getQrByLabel(args.set, args.id !== undefined ? Number(args.id) : args.label));
|
||||
} catch (ex) {
|
||||
toastr.error(ex.message);
|
||||
}
|
||||
}
|
||||
updateQuickReply(args, message) {
|
||||
try {
|
||||
this.api.updateQuickReply(
|
||||
args.set ?? '',
|
||||
args.label ?? '',
|
||||
args.id !== undefined ? Number(args.id) : (args.label ?? ''),
|
||||
{
|
||||
icon: args.icon,
|
||||
showLabel: args.showlabel === undefined ? undefined : isTrueBoolean(args.showlabel),
|
||||
newLabel: args.newlabel,
|
||||
message: (message ?? '').trim().length > 0 ? message : undefined,
|
||||
title: args.title,
|
||||
|
@ -657,7 +898,7 @@ export class SlashCommandHandler {
|
|||
}
|
||||
deleteQuickReply(args, label) {
|
||||
try {
|
||||
this.api.deleteQuickReply(args.set, args.label ?? label);
|
||||
this.api.deleteQuickReply(args.set, args.id !== undefined ? Number(args.id) : (args.label ?? label));
|
||||
} catch (ex) {
|
||||
toastr.error(ex.message);
|
||||
}
|
||||
|
@ -692,9 +933,9 @@ export class SlashCommandHandler {
|
|||
}
|
||||
|
||||
|
||||
createSet(name, args) {
|
||||
async createSet(name, args) {
|
||||
try {
|
||||
this.api.createSet(
|
||||
await this.api.createSet(
|
||||
args.name ?? name ?? '',
|
||||
{
|
||||
disableSend: isTrueBoolean(args.nosend),
|
||||
|
@ -706,9 +947,9 @@ export class SlashCommandHandler {
|
|||
toastr.error(ex.message);
|
||||
}
|
||||
}
|
||||
updateSet(name, args) {
|
||||
async updateSet(name, args) {
|
||||
try {
|
||||
this.api.updateSet(
|
||||
await this.api.updateSet(
|
||||
args.name ?? name ?? '',
|
||||
{
|
||||
disableSend: args.nosend !== undefined ? isTrueBoolean(args.nosend) : undefined,
|
||||
|
@ -720,9 +961,9 @@ export class SlashCommandHandler {
|
|||
toastr.error(ex.message);
|
||||
}
|
||||
}
|
||||
deleteSet(name) {
|
||||
async deleteSet(name) {
|
||||
try {
|
||||
this.api.deleteSet(name ?? '');
|
||||
await this.api.deleteSet(name ?? '');
|
||||
} catch (ex) {
|
||||
toastr.error(ex.message);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ export class SettingsUi {
|
|||
/**@type {HTMLInputElement}*/ disableSend;
|
||||
/**@type {HTMLInputElement}*/ placeBeforeInput;
|
||||
/**@type {HTMLInputElement}*/ injectInput;
|
||||
/**@type {HTMLInputElement}*/ color;
|
||||
/**@type {HTMLInputElement}*/ onlyBorderColor;
|
||||
/**@type {HTMLSelectElement}*/ currentSet;
|
||||
|
||||
|
||||
|
@ -117,10 +119,29 @@ export class SettingsUi {
|
|||
this.dom.querySelector('#qr--set-add').addEventListener('click', async()=>{
|
||||
this.currentQrSet.addQuickReply();
|
||||
});
|
||||
this.dom.querySelector('#qr--set-paste').addEventListener('click', async()=>{
|
||||
const text = await navigator.clipboard.readText();
|
||||
this.currentQrSet.addQuickReplyFromText(text);
|
||||
});
|
||||
this.dom.querySelector('#qr--set-importQr').addEventListener('click', async()=>{
|
||||
const inp = document.createElement('input'); {
|
||||
inp.type = 'file';
|
||||
inp.accept = '.json';
|
||||
inp.addEventListener('change', async()=>{
|
||||
if (inp.files.length > 0) {
|
||||
for (const file of inp.files) {
|
||||
const text = await file.text();
|
||||
this.currentQrSet.addQuickReply(JSON.parse(text));
|
||||
}
|
||||
}
|
||||
});
|
||||
inp.click();
|
||||
}
|
||||
});
|
||||
this.qrList = this.dom.querySelector('#qr--set-qrList');
|
||||
this.currentSet = this.dom.querySelector('#qr--set');
|
||||
this.currentSet.addEventListener('change', ()=>this.onQrSetChange());
|
||||
QuickReplySet.list.forEach(qrs=>{
|
||||
QuickReplySet.list.toSorted((a,b)=>a.name.toLowerCase().localeCompare(b.name.toLowerCase())).forEach(qrs=>{
|
||||
const opt = document.createElement('option'); {
|
||||
opt.value = qrs.name;
|
||||
opt.textContent = qrs.name;
|
||||
|
@ -145,6 +166,34 @@ export class SettingsUi {
|
|||
qrs.injectInput = this.injectInput.checked;
|
||||
qrs.save();
|
||||
});
|
||||
let initialColorChange = true;
|
||||
this.color = this.dom.querySelector('#qr--color');
|
||||
this.color.color = this.currentQrSet?.color ?? 'transparent';
|
||||
this.color.addEventListener('change', (evt)=>{
|
||||
if (!this.dom.closest('body')) return;
|
||||
const qrs = this.currentQrSet;
|
||||
if (initialColorChange) {
|
||||
initialColorChange = false;
|
||||
this.color.color = qrs.color;
|
||||
return;
|
||||
}
|
||||
qrs.color = evt.detail.rgb;
|
||||
qrs.save();
|
||||
this.currentQrSet.updateColor();
|
||||
});
|
||||
this.dom.querySelector('#qr--colorClear').addEventListener('click', (evt)=>{
|
||||
const qrs = this.currentQrSet;
|
||||
this.color.color = 'transparent';
|
||||
qrs.save();
|
||||
this.currentQrSet.updateColor();
|
||||
});
|
||||
this.onlyBorderColor = this.dom.querySelector('#qr--onlyBorderColor');
|
||||
this.onlyBorderColor.addEventListener('click', ()=>{
|
||||
const qrs = this.currentQrSet;
|
||||
qrs.onlyBorderColor = this.onlyBorderColor.checked;
|
||||
qrs.save();
|
||||
this.currentQrSet.updateColor();
|
||||
});
|
||||
this.onQrSetChange();
|
||||
}
|
||||
onQrSetChange() {
|
||||
|
@ -152,6 +201,8 @@ export class SettingsUi {
|
|||
this.disableSend.checked = this.currentQrSet.disableSend;
|
||||
this.placeBeforeInput.checked = this.currentQrSet.placeBeforeInput;
|
||||
this.injectInput.checked = this.currentQrSet.injectInput;
|
||||
this.color.color = this.currentQrSet.color ?? 'transparent';
|
||||
this.onlyBorderColor.checked = this.currentQrSet.onlyBorderColor;
|
||||
this.qrList.innerHTML = '';
|
||||
const qrsDom = this.currentQrSet.renderSettings();
|
||||
this.qrList.append(qrsDom);
|
||||
|
@ -265,7 +316,7 @@ export class SettingsUi {
|
|||
const qrs = new QuickReplySet();
|
||||
qrs.name = name;
|
||||
qrs.addQuickReply();
|
||||
const idx = QuickReplySet.list.findIndex(it=>it.name.localeCompare(name) == 1);
|
||||
const idx = QuickReplySet.list.findIndex(it=>it.name.toLowerCase().localeCompare(name.toLowerCase()) == 1);
|
||||
if (idx > -1) {
|
||||
QuickReplySet.list.splice(idx, 0, qrs);
|
||||
} else {
|
||||
|
@ -321,7 +372,7 @@ export class SettingsUi {
|
|||
this.prepareChatSetList();
|
||||
}
|
||||
} else {
|
||||
const idx = QuickReplySet.list.findIndex(it=>it.name.localeCompare(qrs.name) == 1);
|
||||
const idx = QuickReplySet.list.findIndex(it=>it.name.toLowerCase().localeCompare(qrs.name.toLowerCase()) == 1);
|
||||
if (idx > -1) {
|
||||
QuickReplySet.list.splice(idx, 0, qrs);
|
||||
} else {
|
||||
|
|
|
@ -33,11 +33,14 @@ export class ContextMenu {
|
|||
*/
|
||||
build(qr, chainedMessage = null, hierarchy = [], labelHierarchy = []) {
|
||||
const tree = {
|
||||
icon: qr.icon,
|
||||
showLabel: qr.showLabel,
|
||||
label: qr.label,
|
||||
message: (chainedMessage && qr.message ? `${chainedMessage} | ` : '') + qr.message,
|
||||
children: [],
|
||||
};
|
||||
qr.contextList.forEach((cl) => {
|
||||
if (!cl.set) return;
|
||||
if (!hierarchy.includes(cl.set)) {
|
||||
const nextHierarchy = [...hierarchy, cl.set];
|
||||
const nextLabelHierarchy = [...labelHierarchy, tree.label];
|
||||
|
@ -45,6 +48,8 @@ export class ContextMenu {
|
|||
cl.set.qrList.forEach(subQr => {
|
||||
const subTree = this.build(subQr, cl.isChained ? tree.message : null, nextHierarchy, nextLabelHierarchy);
|
||||
tree.children.push(new MenuItem(
|
||||
subTree.icon,
|
||||
subTree.showLabel,
|
||||
subTree.label,
|
||||
subTree.message,
|
||||
(evt) => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { MenuItem } from './MenuItem.js';
|
|||
|
||||
export class MenuHeader extends MenuItem {
|
||||
constructor(/**@type {String}*/label) {
|
||||
super(label, null, null);
|
||||
super(null, null, label, null, null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,21 +1,34 @@
|
|||
import { SubMenu } from './SubMenu.js';
|
||||
|
||||
export class MenuItem {
|
||||
/**@type {String}*/ label;
|
||||
/**@type {Object}*/ value;
|
||||
/**@type {Function}*/ callback;
|
||||
/**@type {string}*/ icon;
|
||||
/**@type {boolean}*/ showLabel;
|
||||
/**@type {string}*/ label;
|
||||
/**@type {object}*/ value;
|
||||
/**@type {function}*/ callback;
|
||||
/**@type {MenuItem[]}*/ childList = [];
|
||||
/**@type {SubMenu}*/ subMenu;
|
||||
/**@type {Boolean}*/ isForceExpanded = false;
|
||||
/**@type {boolean}*/ isForceExpanded = false;
|
||||
|
||||
/**@type {HTMLElement}*/ root;
|
||||
|
||||
/**@type {Function}*/ onExpand;
|
||||
/**@type {function}*/ onExpand;
|
||||
|
||||
|
||||
|
||||
|
||||
constructor(/**@type {String}*/label, /**@type {Object}*/value, /**@type {function}*/callback, /**@type {MenuItem[]}*/children = []) {
|
||||
/**
|
||||
*
|
||||
* @param {string} icon
|
||||
* @param {boolean} showLabel
|
||||
* @param {string} label
|
||||
* @param {object} value
|
||||
* @param {function} callback
|
||||
* @param {MenuItem[]} children
|
||||
*/
|
||||
constructor(icon, showLabel, label, value, callback, children = []) {
|
||||
this.icon = icon;
|
||||
this.showLabel = showLabel;
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
this.callback = callback;
|
||||
|
@ -33,7 +46,21 @@ export class MenuItem {
|
|||
if (this.callback) {
|
||||
item.addEventListener('click', (evt) => this.callback(evt, this));
|
||||
}
|
||||
item.append(this.label);
|
||||
const icon = document.createElement('div'); {
|
||||
this.domIcon = icon;
|
||||
icon.classList.add('qr--button-icon');
|
||||
icon.classList.add('fa-solid');
|
||||
if (!this.icon) icon.classList.add('qr--hidden');
|
||||
else icon.classList.add(this.icon);
|
||||
item.append(icon);
|
||||
}
|
||||
const lbl = document.createElement('div'); {
|
||||
this.domLabel = lbl;
|
||||
lbl.classList.add('qr--button-label');
|
||||
if (this.icon && !this.showLabel) lbl.classList.add('qr--hidden');
|
||||
lbl.textContent = this.label;
|
||||
item.append(lbl);
|
||||
}
|
||||
if (this.childList.length > 0) {
|
||||
item.classList.add('ctx-has-children');
|
||||
const sub = new SubMenu(this.childList);
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
@keyframes qr--success {
|
||||
0%,
|
||||
100% {
|
||||
color: var(--SmartThemeBodyColor);
|
||||
}
|
||||
25%,
|
||||
75% {
|
||||
color: #51a351;
|
||||
}
|
||||
}
|
||||
.qr--success {
|
||||
animation-name: qr--success;
|
||||
animation-duration: 3s;
|
||||
animation-timing-function: linear;
|
||||
animation-delay: 0s;
|
||||
animation-iteration-count: 1;
|
||||
}
|
||||
#qr--bar {
|
||||
outline: none;
|
||||
margin: 0;
|
||||
|
@ -41,6 +58,7 @@
|
|||
}
|
||||
#qr--bar > .qr--buttons,
|
||||
#qr--popout > .qr--body > .qr--buttons {
|
||||
--qr--color: transparent;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
|
@ -49,10 +67,44 @@
|
|||
gap: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
#qr--bar > .qr--buttons.qr--color,
|
||||
#qr--popout > .qr--body > .qr--buttons.qr--color {
|
||||
background-color: var(--qr--color);
|
||||
}
|
||||
#qr--bar > .qr--buttons.qr--borderColor,
|
||||
#qr--popout > .qr--body > .qr--buttons.qr--borderColor {
|
||||
background-color: transparent;
|
||||
border-left: 5px solid var(--qr--color);
|
||||
border-right: 5px solid var(--qr--color);
|
||||
}
|
||||
#qr--bar > .qr--buttons:has(.qr--buttons.qr--color),
|
||||
#qr--popout > .qr--body > .qr--buttons:has(.qr--buttons.qr--color) {
|
||||
margin: 5px;
|
||||
}
|
||||
#qr--bar > .qr--buttons > .qr--buttons,
|
||||
#qr--popout > .qr--body > .qr--buttons > .qr--buttons {
|
||||
display: contents;
|
||||
}
|
||||
#qr--bar > .qr--buttons > .qr--buttons.qr--color .qr--button:before,
|
||||
#qr--popout > .qr--body > .qr--buttons > .qr--buttons.qr--color .qr--button:before {
|
||||
content: '';
|
||||
background-color: var(--qr--color);
|
||||
position: absolute;
|
||||
inset: -5px;
|
||||
z-index: -1;
|
||||
}
|
||||
#qr--bar > .qr--buttons > .qr--buttons.qr--color.qr--borderColor .qr--button:before,
|
||||
#qr--popout > .qr--body > .qr--buttons > .qr--buttons.qr--color.qr--borderColor .qr--button:before {
|
||||
display: none;
|
||||
}
|
||||
#qr--bar > .qr--buttons > .qr--buttons.qr--color.qr--borderColor:before,
|
||||
#qr--popout > .qr--body > .qr--buttons > .qr--buttons.qr--color.qr--borderColor:before,
|
||||
#qr--bar > .qr--buttons > .qr--buttons.qr--color.qr--borderColor:after,
|
||||
#qr--popout > .qr--body > .qr--buttons > .qr--buttons.qr--color.qr--borderColor:after {
|
||||
content: '';
|
||||
width: 5px;
|
||||
background-color: var(--qr--color);
|
||||
}
|
||||
#qr--bar > .qr--buttons .qr--button,
|
||||
#qr--popout > .qr--body > .qr--buttons .qr--button {
|
||||
color: var(--SmartThemeBodyColor);
|
||||
|
@ -66,11 +118,19 @@
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
#qr--bar > .qr--buttons .qr--button:hover,
|
||||
#qr--popout > .qr--body > .qr--buttons .qr--button:hover {
|
||||
opacity: 1;
|
||||
filter: brightness(1.2);
|
||||
background-color: #4d4d4d;
|
||||
}
|
||||
#qr--bar > .qr--buttons .qr--button .qr--hidden,
|
||||
#qr--popout > .qr--body > .qr--buttons .qr--button .qr--hidden {
|
||||
display: none;
|
||||
}
|
||||
#qr--bar > .qr--buttons .qr--button .qr--button-icon,
|
||||
#qr--popout > .qr--body > .qr--buttons .qr--button .qr--button-icon {
|
||||
margin: 0 0.5em;
|
||||
}
|
||||
#qr--bar > .qr--buttons .qr--button > .qr--button-expander,
|
||||
#qr--popout > .qr--body > .qr--buttons .qr--button > .qr--button-expander {
|
||||
|
@ -170,36 +230,80 @@
|
|||
#qr--settings #qr--set-qrList .qr--set-qrListContents {
|
||||
padding: 0 0.5em;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item {
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemAdder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
opacity: 0;
|
||||
transition: 100ms;
|
||||
margin: -2px 0 -11px 0;
|
||||
position: relative;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemAdder .qr--actions {
|
||||
display: flex;
|
||||
gap: 0.25em;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemAdder .qr--actions .qr--action {
|
||||
margin: 0;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemAdder:before,
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemAdder:after {
|
||||
content: "";
|
||||
display: block;
|
||||
flex: 1 1 auto;
|
||||
border: 1px solid;
|
||||
margin: 0 1em;
|
||||
height: 0;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemAdder:hover,
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemAdder:focus-within {
|
||||
opacity: 1;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5em;
|
||||
align-items: baseline;
|
||||
padding: 0.25em 0;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item > :nth-child(1) {
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content > :nth-child(2) {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item > :nth-child(2) {
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content > :nth-child(2) {
|
||||
flex: 1 1 25%;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item > :nth-child(3) {
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content > :nth-child(3) {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item > :nth-child(4) {
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content > :nth-child(4) {
|
||||
flex: 1 1 75%;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item > :nth-child(5) {
|
||||
flex: 0 0 auto;
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content > :nth-child(5) {
|
||||
flex: 0 1 auto;
|
||||
display: flex;
|
||||
gap: 0.25em;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item > .drag-handle {
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content > .drag-handle {
|
||||
padding: 0.75em;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemLabel,
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--action {
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content .qr--set-itemLabelContainer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content .qr--set-itemLabelContainer .qr--set-itemIcon:not(.fa-solid) {
|
||||
display: none;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content .qr--set-itemLabelContainer .qr--set-itemLabel {
|
||||
min-width: 24px;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content .qr--set-itemLabel,
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content .qr--action {
|
||||
margin: 0;
|
||||
}
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--set-itemMessage {
|
||||
#qr--settings #qr--set-qrList .qr--set-qrListContents > .qr--set-item .qr--content .qr--set-itemMessage {
|
||||
font-size: smaller;
|
||||
}
|
||||
#qr--settings .qr--set-qrListActions {
|
||||
|
@ -212,6 +316,7 @@
|
|||
#qr--qrOptions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-right: 1px;
|
||||
}
|
||||
#qr--qrOptions > #qr--ctxEditor .qr--ctxItem {
|
||||
display: flex;
|
||||
|
@ -219,6 +324,12 @@
|
|||
gap: 0.5em;
|
||||
align-items: baseline;
|
||||
}
|
||||
#qr--qrOptions > #qr--autoExec .checkbox_label {
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
#qr--qrOptions > #qr--autoExec .checkbox_label .fa-fw {
|
||||
margin-right: 2px;
|
||||
}
|
||||
@media screen and (max-width: 750px) {
|
||||
body .popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor {
|
||||
flex-direction: column;
|
||||
|
@ -231,13 +342,79 @@
|
|||
flex-direction: column;
|
||||
}
|
||||
body .popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--modal-messageContainer > #qr--modal-messageHolder {
|
||||
min-height: 50svh;
|
||||
height: 50svh;
|
||||
min-height: 50dvh;
|
||||
height: 50dvh;
|
||||
}
|
||||
}
|
||||
.popup:has(#qr--modalEditor) {
|
||||
aspect-ratio: unset;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) {
|
||||
min-width: unset;
|
||||
min-height: unset;
|
||||
height: auto !important;
|
||||
width: min-content !important;
|
||||
position: absolute;
|
||||
right: 1em;
|
||||
top: 1em;
|
||||
left: unset;
|
||||
bottom: unset;
|
||||
margin: unset;
|
||||
padding: 0;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized)::backdrop {
|
||||
backdrop-filter: unset;
|
||||
background-color: transparent;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-body {
|
||||
flex: 0 0 auto;
|
||||
height: min-content;
|
||||
width: min-content;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content {
|
||||
flex: 0 0 auto;
|
||||
margin-top: 0;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor {
|
||||
max-height: 50vh;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor > #qr--main,
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor > #qr--resizeHandle,
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor > #qr--qrOptions > h3,
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor > #qr--qrOptions > #qr--modal-executeButtons,
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor > #qr--qrOptions > #qr--modal-executeProgress {
|
||||
display: none;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor #qr--qrOptions {
|
||||
width: auto;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton#qr--modal-maximize {
|
||||
display: flex;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton#qr--modal-minimize {
|
||||
display: none;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting.qr--minimized) .popup-content > #qr--modalEditor #qr--modal-debugState {
|
||||
padding-top: 0;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting) .popup-controls {
|
||||
display: none;
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting) .qr--highlight {
|
||||
position: absolute;
|
||||
z-index: 50000;
|
||||
pointer-events: none;
|
||||
background-color: rgba(47, 150, 180, 0.5);
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting) .qr--highlight.qr--unresolved {
|
||||
background-color: rgba(255, 255, 0, 0.5);
|
||||
}
|
||||
.popup:has(#qr--modalEditor):has(.qr--isExecuting) .qr--highlight-secondary {
|
||||
position: absolute;
|
||||
z-index: 50000;
|
||||
pointer-events: none;
|
||||
border: 3px solid red;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -249,6 +426,67 @@
|
|||
gap: 1em;
|
||||
overflow: hidden;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--main > h3:first-child,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--main > .qr--labels,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--main > .qr--modal-messageContainer > .qr--modal-editorSettings,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--qrOptions > h3:first-child,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--qrOptions > #qr--ctxEditor,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--qrOptions > .qr--ctxEditorActions,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--qrOptions > .qr--ctxEditorActions + h3,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--qrOptions > .qr--ctxEditorActions + h3 + div {
|
||||
display: none;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--main > .qr--modal-messageContainer > #qr--modal-messageHolder > #qr--modal-message {
|
||||
visibility: hidden;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--modal-debugButtons {
|
||||
display: flex;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--modal-debugButtons .menu_button:not(#qr--modal-minimize, #qr--modal-maximize) {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
transition: 200ms;
|
||||
border-color: transparent;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting.qr--isPaused #qr--modal-debugButtons .menu_button:not(#qr--modal-minimize, #qr--modal-maximize) {
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
pointer-events: all;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting.qr--isPaused #qr--modal-debugButtons .menu_button:not(#qr--modal-minimize, #qr--modal-maximize)#qr--modal-resume {
|
||||
animation-name: qr--debugPulse;
|
||||
animation-duration: 1500ms;
|
||||
animation-timing-function: ease-in-out;
|
||||
animation-delay: 0s;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting.qr--isPaused #qr--modal-debugButtons .menu_button:not(#qr--modal-minimize, #qr--modal-maximize)#qr--modal-resume {
|
||||
border-color: #51a351;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting.qr--isPaused #qr--modal-debugButtons .menu_button:not(#qr--modal-minimize, #qr--modal-maximize)#qr--modal-step {
|
||||
border-color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting.qr--isPaused #qr--modal-debugButtons .menu_button:not(#qr--modal-minimize, #qr--modal-maximize)#qr--modal-stepInto {
|
||||
border-color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting.qr--isPaused #qr--modal-debugButtons .menu_button:not(#qr--modal-minimize, #qr--modal-maximize)#qr--modal-stepOut {
|
||||
border-color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--resizeHandle {
|
||||
width: 6px;
|
||||
background-color: var(--SmartThemeBorderColor);
|
||||
border: 2px solid var(--SmartThemeBlurTintColor);
|
||||
transition: border-color 200ms, background-color 200ms;
|
||||
cursor: w-resize;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--resizeHandle:hover {
|
||||
background-color: var(--SmartThemeQuoteColor);
|
||||
border-color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor.qr--isExecuting #qr--qrOptions {
|
||||
width: var(--width, auto);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
|
@ -260,20 +498,114 @@
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5em;
|
||||
padding: 1px;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label {
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label {
|
||||
flex: 1 1 1px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label > .qr--labelText {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label > .qr--labelHint {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label > input {
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label.qr--fit,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label.qr--fit {
|
||||
flex: 0 0 auto;
|
||||
justify-content: center;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--inputGroup,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--inputGroup {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.5em;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--inputGroup input,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--inputGroup input {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--labelText,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--labelText {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--labelHint,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--labelHint {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label input,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label input {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList {
|
||||
background-color: var(--stcdx--bgColor);
|
||||
border: 1px solid var(--SmartThemeBorderColor);
|
||||
backdrop-filter: blur(var(--SmartThemeBlurStrength));
|
||||
border-radius: 10px;
|
||||
font-size: smaller;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
overflow: auto;
|
||||
margin: 0;
|
||||
padding: 0.5em;
|
||||
max-height: 50vh;
|
||||
list-style: none;
|
||||
z-index: 40000;
|
||||
max-width: 100%;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--modal-switcherItem,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--modal-switcherItem {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
text-align: left;
|
||||
opacity: 0.75;
|
||||
transition: 200ms;
|
||||
cursor: pointer;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--modal-switcherItem:hover,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--modal-switcherItem:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--modal-switcherItem.qr--current,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--modal-switcherItem.qr--current {
|
||||
opacity: 1;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--modal-switcherItem.qr--current .qr--label,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--modal-switcherItem.qr--current .qr--label,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--modal-switcherItem.qr--current .qr--id,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--modal-switcherItem.qr--current .qr--id {
|
||||
font-weight: bold;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--label,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--label .menu_button,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--label .menu_button {
|
||||
display: inline-block;
|
||||
height: min-content;
|
||||
width: min-content;
|
||||
margin: 0 0.5em 0 0;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--id,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--id {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--id:before,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--id:before {
|
||||
content: "[";
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--id:after,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--id:after {
|
||||
content: "]";
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > label .qr--modal-switcherList .qr--message,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--labels > .label .qr--modal-switcherList .qr--message {
|
||||
height: 1lh;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--modal-messageContainer {
|
||||
flex: 1 1 auto;
|
||||
|
@ -283,8 +615,9 @@
|
|||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--modal-messageContainer > .qr--modal-editorSettings {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
gap: 1em;
|
||||
column-gap: 1em;
|
||||
color: var(--grey70);
|
||||
font-size: smaller;
|
||||
align-items: baseline;
|
||||
|
@ -308,6 +641,11 @@
|
|||
background-color: var(--ac-style-color-background);
|
||||
color: var(--ac-style-color-text);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--modal-messageContainer > #qr--modal-messageHolder.qr--noSyntax > #qr--modal-message::-webkit-scrollbar,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--modal-messageContainer > #qr--modal-messageHolder.qr--noSyntax > #qr--modal-message::-webkit-scrollbar-thumb {
|
||||
visibility: visible;
|
||||
cursor: unset;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor > #qr--main > .qr--modal-messageContainer > #qr--modal-messageHolder.qr--noSyntax > #qr--modal-message::selection {
|
||||
color: unset;
|
||||
background-color: rgba(108 171 251 / 0.25);
|
||||
|
@ -357,11 +695,15 @@
|
|||
font-family: var(--monoFontFamily);
|
||||
padding: 0.75em;
|
||||
margin: 0;
|
||||
border: none;
|
||||
resize: none;
|
||||
line-height: 1.2;
|
||||
border: 1px solid var(--SmartThemeBorderColor);
|
||||
border-radius: 5px;
|
||||
position: relative;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-icon {
|
||||
height: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-executeButtons {
|
||||
display: flex;
|
||||
|
@ -410,6 +752,46 @@
|
|||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-executeButtons #qr--modal-stop {
|
||||
border-color: #d78872;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons {
|
||||
display: none;
|
||||
gap: 1em;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton {
|
||||
aspect-ratio: 1.25 / 1;
|
||||
width: 2.25em;
|
||||
position: relative;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton:not(.fa-solid) {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton:not(.fa-solid):after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 3px;
|
||||
background-color: var(--SmartThemeBodyColor);
|
||||
mask-size: contain;
|
||||
mask-position: center;
|
||||
mask-repeat: no-repeat;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton#qr--modal-resume:after {
|
||||
mask-image: url('/img/step-resume.svg');
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton#qr--modal-step:after {
|
||||
mask-image: url('/img/step-over.svg');
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton#qr--modal-stepInto:after {
|
||||
mask-image: url('/img/step-into.svg');
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton#qr--modal-stepOut:after {
|
||||
mask-image: url('/img/step-out.svg');
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugButtons .qr--modal-debugButton#qr--modal-maximize {
|
||||
display: none;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-send_textarea {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-executeProgress {
|
||||
--prog: 0;
|
||||
--progColor: #92befc;
|
||||
|
@ -417,6 +799,7 @@
|
|||
--progSuccessColor: #51a351;
|
||||
--progErrorColor: #bd362f;
|
||||
--progAbortedColor: #d78872;
|
||||
flex: 0 0 auto;
|
||||
height: 0.5em;
|
||||
background-color: var(--black50a);
|
||||
position: relative;
|
||||
|
@ -469,6 +852,7 @@
|
|||
overflow: auto;
|
||||
min-width: 100%;
|
||||
width: 0;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-executeResult.qr--hasResult {
|
||||
display: block;
|
||||
|
@ -476,6 +860,150 @@
|
|||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-executeResult:before {
|
||||
content: 'Result: ';
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState {
|
||||
display: none;
|
||||
text-align: left;
|
||||
font-size: smaller;
|
||||
font-family: var(--monoFontFamily);
|
||||
color: white;
|
||||
padding: 0.5em 0;
|
||||
overflow: auto;
|
||||
min-width: 100%;
|
||||
width: 0;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState.qr--active {
|
||||
display: block;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope {
|
||||
display: grid;
|
||||
grid-template-columns: 0fr 1fr 1fr;
|
||||
column-gap: 0em;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--title {
|
||||
grid-column: 1 / 4;
|
||||
font-weight: bold;
|
||||
font-family: var(--mainFontFamily);
|
||||
background-color: var(--black50a);
|
||||
padding: 0.25em;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe {
|
||||
display: contents;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var:nth-child(2n + 1) .qr--key,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro:nth-child(2n + 1) .qr--key,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe:nth-child(2n + 1) .qr--key,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var:nth-child(2n + 1) .qr--val,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro:nth-child(2n + 1) .qr--val,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe:nth-child(2n + 1) .qr--val {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.25);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var:nth-child(2n + 1) .qr--val:nth-child(2n),
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro:nth-child(2n + 1) .qr--val:nth-child(2n),
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe:nth-child(2n + 1) .qr--val:nth-child(2n) {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.125);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var:nth-child(2n + 1) .qr--val:hover,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro:nth-child(2n + 1) .qr--val:hover,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe:nth-child(2n + 1) .qr--val:hover {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.5);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var:nth-child(2n) .qr--val:nth-child(2n),
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro:nth-child(2n) .qr--val:nth-child(2n),
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe:nth-child(2n) .qr--val:nth-child(2n) {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.0625);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var:nth-child(2n) .qr--val:hover,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro:nth-child(2n) .qr--val:hover,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe:nth-child(2n) .qr--val:hover {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.5);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var.qr--isHidden .qr--key,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro.qr--isHidden .qr--key,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe.qr--isHidden .qr--key,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var.qr--isHidden .qr--val,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro.qr--isHidden .qr--val,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe.qr--isHidden .qr--val {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var .qr--val,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro .qr--val,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe .qr--val {
|
||||
grid-column: 2 / 4;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var .qr--val.qr--singleCol,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro .qr--val.qr--singleCol,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe .qr--val.qr--singleCol {
|
||||
grid-column: unset;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var .qr--val.qr--simple:before,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro .qr--val.qr--simple:before,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe .qr--val.qr--simple:before,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var .qr--val.qr--simple:after,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro .qr--val.qr--simple:after,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe .qr--val.qr--simple:after {
|
||||
content: '"';
|
||||
color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--var .qr--val.qr--unresolved:after,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro .qr--val.qr--unresolved:after,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe .qr--val.qr--unresolved:after {
|
||||
content: '-UNRESOLVED-';
|
||||
font-style: italic;
|
||||
color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--key {
|
||||
margin-left: 0.5em;
|
||||
padding-right: 1em;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--key:after {
|
||||
content: ": ";
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe > .qr--key:before,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro > .qr--key:before {
|
||||
content: "{{";
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--pipe > .qr--key:after,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--macro > .qr--key:after {
|
||||
content: "}}: ";
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--scope {
|
||||
display: contents;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--scope .qr--pipe .qr--key,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--scope .qr--scope .qr--pipe .qr--val {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--stack {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 0fr;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--stack .qr--title {
|
||||
grid-column: 1 / 3;
|
||||
font-weight: bold;
|
||||
font-family: var(--mainFontFamily);
|
||||
background-color: var(--black50a);
|
||||
padding: 0.25em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--stack .qr--item {
|
||||
display: contents;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--stack .qr--item:nth-child(2n + 1) .qr--name,
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--stack .qr--item:nth-child(2n + 1) .qr--source {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.25);
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--stack .qr--item .qr--name {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
.popup:has(#qr--modalEditor) .popup-content > #qr--modalEditor #qr--modal-debugState .qr--stack .qr--item .qr--source {
|
||||
opacity: 0.5;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@keyframes qr--progressPulse {
|
||||
0%,
|
||||
100% {
|
||||
|
@ -485,9 +1013,63 @@
|
|||
background-color: var(--progFlashColor);
|
||||
}
|
||||
}
|
||||
@keyframes qr--debugPulse {
|
||||
0%,
|
||||
100% {
|
||||
border-color: #51a351;
|
||||
}
|
||||
50% {
|
||||
border-color: #92befc;
|
||||
}
|
||||
}
|
||||
.popup.qr--hide {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
.popup.qr--hide::backdrop {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
.popup.qr--hide::backdrop {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
.popup:has(.qr--transferModal) .popup-button-ok {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
white-space: pre;
|
||||
font-weight: normal;
|
||||
box-shadow: 0 0 0;
|
||||
transition: 200ms;
|
||||
}
|
||||
.popup:has(.qr--transferModal) .popup-button-ok:after {
|
||||
content: 'Transfer';
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
font-weight: bold;
|
||||
}
|
||||
.popup:has(.qr--transferModal) .qr--copy {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
white-space: pre;
|
||||
font-weight: normal;
|
||||
box-shadow: 0 0 0;
|
||||
transition: 200ms;
|
||||
}
|
||||
.popup:has(.qr--transferModal) .qr--copy:after {
|
||||
content: 'Copy';
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
font-weight: bold;
|
||||
}
|
||||
.popup:has(.qr--transferModal):has(.qr--transferSelect:focus) .popup-button-ok {
|
||||
font-weight: bold;
|
||||
box-shadow: 0 0 10px;
|
||||
}
|
||||
.popup:has(.qr--transferModal):has(.qr--transferSelect:focus).qr--isCopy .popup-button-ok {
|
||||
font-weight: normal;
|
||||
box-shadow: 0 0 0;
|
||||
}
|
||||
.popup:has(.qr--transferModal):has(.qr--transferSelect:focus).qr--isCopy .qr--copy {
|
||||
font-weight: bold;
|
||||
box-shadow: 0 0 10px;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
@keyframes qr--success {
|
||||
0%, 100% {
|
||||
color: var(--SmartThemeBodyColor);
|
||||
}
|
||||
25%, 75% {
|
||||
color: rgb(81, 163, 81);
|
||||
}
|
||||
}
|
||||
&.qr--success {
|
||||
animation-name: qr--success;
|
||||
animation-duration: 3s;
|
||||
animation-timing-function: linear;
|
||||
animation-delay: 0s;
|
||||
animation-iteration-count: 1;
|
||||
}
|
||||
#qr--bar {
|
||||
outline: none;
|
||||
margin: 0;
|
||||
|
@ -50,6 +65,18 @@
|
|||
#qr--bar,
|
||||
#qr--popout>.qr--body {
|
||||
>.qr--buttons {
|
||||
--qr--color: transparent;
|
||||
&.qr--color {
|
||||
background-color: var(--qr--color);
|
||||
}
|
||||
&.qr--borderColor {
|
||||
background-color: transparent;
|
||||
border-left: 5px solid var(--qr--color);
|
||||
border-right: 5px solid var(--qr--color);
|
||||
}
|
||||
&:has(.qr--buttons.qr--color) {
|
||||
margin: 5px;
|
||||
}
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
|
@ -60,6 +87,25 @@
|
|||
|
||||
>.qr--buttons {
|
||||
display: contents;
|
||||
&.qr--color {
|
||||
.qr--button:before {
|
||||
content: '';
|
||||
background-color: var(--qr--color);
|
||||
position: absolute;
|
||||
inset: -5px;
|
||||
z-index: -1;
|
||||
}
|
||||
&.qr--borderColor {
|
||||
.qr--button:before {
|
||||
display: none;
|
||||
}
|
||||
&:before, &:after {
|
||||
content: '';
|
||||
width: 5px;
|
||||
background-color: var(--qr--color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.qr--button {
|
||||
|
@ -75,10 +121,17 @@
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
filter: brightness(1.2);
|
||||
background-color: rgb(30% 30% 30%);
|
||||
}
|
||||
|
||||
.qr--hidden {
|
||||
display: none;
|
||||
}
|
||||
.qr--button-icon {
|
||||
margin: 0 0.5em;
|
||||
}
|
||||
|
||||
>.qr--button-expander {
|
||||
|
@ -211,14 +264,41 @@
|
|||
.qr--set-qrListContents> {
|
||||
padding: 0 0.5em;
|
||||
|
||||
>.qr--set-item {
|
||||
>.qr--set-item .qr--set-itemAdder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
opacity: 0;
|
||||
transition: 100ms;
|
||||
margin: -2px 0 -11px 0;
|
||||
position: relative;
|
||||
.qr--actions {
|
||||
display: flex;
|
||||
gap: 0.25em;
|
||||
flex: 0 0 auto;
|
||||
.qr--action {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
&:before, &:after {
|
||||
content: "";
|
||||
display: block;
|
||||
flex: 1 1 auto;
|
||||
border: 1px solid;
|
||||
margin: 0 1em;
|
||||
height: 0;
|
||||
}
|
||||
&:hover, &:focus-within {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
>.qr--set-item .qr--content {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5em;
|
||||
align-items: baseline;
|
||||
padding: 0.25em 0;
|
||||
|
||||
> :nth-child(1) {
|
||||
> :nth-child(2) {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
|
@ -235,13 +315,29 @@
|
|||
}
|
||||
|
||||
> :nth-child(5) {
|
||||
flex: 0 0 auto;
|
||||
flex: 0 1 auto;
|
||||
display: flex;
|
||||
gap: 0.25em;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
>.drag-handle {
|
||||
padding: 0.75em;
|
||||
}
|
||||
|
||||
.qr--set-itemLabelContainer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
.qr--set-itemIcon:not(.fa-solid) {
|
||||
display: none;
|
||||
}
|
||||
.qr--set-itemLabel {
|
||||
min-width: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.qr--set-itemLabel,
|
||||
.qr--action {
|
||||
margin: 0;
|
||||
|
@ -251,6 +347,8 @@
|
|||
font-size: smaller;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,6 +368,7 @@
|
|||
#qr--qrOptions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-right: 1px;
|
||||
|
||||
>#qr--ctxEditor {
|
||||
.qr--ctxItem {
|
||||
|
@ -279,6 +378,15 @@
|
|||
align-items: baseline;
|
||||
}
|
||||
}
|
||||
>#qr--autoExec {
|
||||
.checkbox_label {
|
||||
text-wrap: nowrap;
|
||||
|
||||
.fa-fw {
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -297,8 +405,8 @@
|
|||
}
|
||||
|
||||
>#qr--main>.qr--modal-messageContainer>#qr--modal-messageHolder {
|
||||
min-height: 50svh;
|
||||
height: 50svh;
|
||||
min-height: 50dvh;
|
||||
height: 50dvh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,6 +414,78 @@
|
|||
.popup:has(#qr--modalEditor) {
|
||||
aspect-ratio: unset;
|
||||
|
||||
&:has(.qr--isExecuting.qr--minimized) {
|
||||
min-width: unset;
|
||||
min-height: unset;
|
||||
height: auto !important;
|
||||
width: min-content !important;
|
||||
position: absolute;
|
||||
right: 1em;
|
||||
top: 1em;
|
||||
left: unset;
|
||||
bottom: unset;
|
||||
margin: unset;
|
||||
padding: 0;
|
||||
&::backdrop {
|
||||
backdrop-filter: unset;
|
||||
background-color: transparent;
|
||||
}
|
||||
.popup-body {
|
||||
flex: 0 0 auto;
|
||||
height: min-content;
|
||||
width: min-content;
|
||||
}
|
||||
.popup-content {
|
||||
flex: 0 0 auto;
|
||||
margin-top: 0;
|
||||
|
||||
> #qr--modalEditor {
|
||||
max-height: 50vh;
|
||||
> #qr--main,
|
||||
> #qr--resizeHandle,
|
||||
> #qr--qrOptions > h3,
|
||||
> #qr--qrOptions > #qr--modal-executeButtons,
|
||||
> #qr--qrOptions > #qr--modal-executeProgress
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
#qr--qrOptions {
|
||||
width: auto;
|
||||
}
|
||||
#qr--modal-debugButtons .qr--modal-debugButton#qr--modal-maximize {
|
||||
display: flex;
|
||||
}
|
||||
#qr--modal-debugButtons .qr--modal-debugButton#qr--modal-minimize {
|
||||
display: none;
|
||||
}
|
||||
#qr--modal-debugState {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&:has(.qr--isExecuting) {
|
||||
.popup-controls {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.qr--highlight {
|
||||
position: absolute;
|
||||
z-index: 50000;
|
||||
pointer-events: none;
|
||||
background-color: rgb(47 150 180 / 0.5);
|
||||
&.qr--unresolved {
|
||||
background-color: rgb(255 255 0 / 0.5);
|
||||
}
|
||||
}
|
||||
.qr--highlight-secondary {
|
||||
position: absolute;
|
||||
z-index: 50000;
|
||||
pointer-events: none;
|
||||
border: 3px solid red;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -317,140 +497,262 @@
|
|||
gap: 1em;
|
||||
overflow: hidden;
|
||||
|
||||
>#qr--main {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
>.qr--labels {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5em;
|
||||
|
||||
>label {
|
||||
flex: 1 1 1px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
>.qr--labelText {
|
||||
flex: 1 1 auto;
|
||||
&.qr--isExecuting {
|
||||
#qr--main > h3:first-child,
|
||||
#qr--main > .qr--labels,
|
||||
#qr--main > .qr--modal-messageContainer > .qr--modal-editorSettings,
|
||||
#qr--qrOptions > h3:first-child,
|
||||
#qr--qrOptions > #qr--ctxEditor,
|
||||
#qr--qrOptions > .qr--ctxEditorActions,
|
||||
#qr--qrOptions > .qr--ctxEditorActions + h3,
|
||||
#qr--qrOptions > .qr--ctxEditorActions + h3 + div
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
#qr--main > .qr--modal-messageContainer > #qr--modal-messageHolder > #qr--modal-message {
|
||||
visibility: hidden;
|
||||
}
|
||||
#qr--modal-debugButtons {
|
||||
display: flex;
|
||||
.menu_button:not(#qr--modal-minimize, #qr--modal-maximize) {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
transition: 200ms;
|
||||
border-color: transparent;
|
||||
}
|
||||
}
|
||||
&.qr--isPaused #qr--modal-debugButtons {
|
||||
.menu_button:not(#qr--modal-minimize, #qr--modal-maximize) {
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
pointer-events: all;
|
||||
&#qr--modal-resume {
|
||||
animation-name: qr--debugPulse;
|
||||
animation-duration: 1500ms;
|
||||
animation-timing-function: ease-in-out;
|
||||
animation-delay: 0s;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
|
||||
>.qr--labelHint {
|
||||
flex: 1 1 auto;
|
||||
&#qr--modal-resume {
|
||||
border-color: rgb(81, 163, 81);
|
||||
}
|
||||
|
||||
>input {
|
||||
flex: 0 0 auto;
|
||||
&#qr--modal-step {
|
||||
border-color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
&#qr--modal-stepInto {
|
||||
border-color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
&#qr--modal-stepOut {
|
||||
border-color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
#qr--resizeHandle {
|
||||
width: 6px;
|
||||
background-color: var(--SmartThemeBorderColor);
|
||||
border: 2px solid var(--SmartThemeBlurTintColor);
|
||||
transition: border-color 200ms, background-color 200ms;
|
||||
cursor: w-resize;
|
||||
&:hover {
|
||||
background-color: var(--SmartThemeQuoteColor);
|
||||
border-color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
}
|
||||
#qr--qrOptions {
|
||||
width: var(--width, auto);
|
||||
}
|
||||
}
|
||||
|
||||
>.qr--modal-messageContainer {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
>.qr--modal-editorSettings {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 1em;
|
||||
color: var(--grey70);
|
||||
font-size: smaller;
|
||||
align-items: baseline;
|
||||
|
||||
>.checkbox_label {
|
||||
white-space: nowrap;
|
||||
|
||||
>input {
|
||||
font-size: inherit;
|
||||
> #qr--main {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
> .qr--labels {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5em;
|
||||
padding: 1px;
|
||||
> label, > .label {
|
||||
flex: 1 1 1px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
&.qr--fit {
|
||||
flex: 0 0 auto;
|
||||
justify-content: center;
|
||||
}
|
||||
.qr--inputGroup {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.5em;
|
||||
input {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
>#qr--modal-messageHolder {
|
||||
flex: 1 1 auto;
|
||||
display: grid;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
|
||||
&.qr--noSyntax {
|
||||
>#qr--modal-messageSyntax {
|
||||
display: none;
|
||||
}
|
||||
|
||||
>#qr--modal-message {
|
||||
background-color: var(--ac-style-color-background);
|
||||
color: var(--ac-style-color-text);
|
||||
|
||||
&::selection {
|
||||
color: unset;
|
||||
background-color: rgba(108 171 251 / 0.25);
|
||||
|
||||
@supports (color: rgb(from white r g b / 0.25)) {
|
||||
background-color: rgb(from var(--ac-style-color-matchedText) r g b / 0.25);
|
||||
.qr--labelText {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.qr--labelHint {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
input {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.qr--modal-switcherList {
|
||||
background-color: var(--stcdx--bgColor);
|
||||
border: 1px solid var(--SmartThemeBorderColor);
|
||||
backdrop-filter: blur(var(--SmartThemeBlurStrength));
|
||||
border-radius: 10px;
|
||||
font-size: smaller;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
overflow: auto;
|
||||
margin: 0;
|
||||
padding: 0.5em;
|
||||
max-height: 50vh;
|
||||
list-style: none;
|
||||
z-index: 40000;
|
||||
max-width: 100%;
|
||||
.qr--modal-switcherItem {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
text-align: left;
|
||||
opacity: 0.75;
|
||||
transition: 200ms;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
&.qr--current {
|
||||
opacity: 1;
|
||||
.qr--label, .qr--id {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
>#qr--modal-messageSyntax {
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
min-width: 100%;
|
||||
width: 0;
|
||||
|
||||
>#qr--modal-messageSyntaxInner {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
>#qr--modal-message {
|
||||
background-color: transparent;
|
||||
color: transparent;
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
caret-color: var(--ac-style-color-text);
|
||||
overflow: auto;
|
||||
|
||||
&::-webkit-scrollbar,
|
||||
&::-webkit-scrollbar-thumb {
|
||||
visibility: hidden;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&::selection {
|
||||
color: transparent;
|
||||
background-color: rgba(108 171 251 / 0.25);
|
||||
|
||||
@supports (color: rgb(from white r g b / 0.25)) {
|
||||
background-color: rgb(from var(--ac-style-color-matchedText) r g b / 0.25);
|
||||
.qr--label {
|
||||
white-space: nowrap;
|
||||
.menu_button {
|
||||
display: inline-block;
|
||||
height: min-content;
|
||||
width: min-content;
|
||||
margin: 0 0.5em 0 0;
|
||||
}
|
||||
}
|
||||
.qr--id {
|
||||
opacity: 0.5;
|
||||
&:before { content: "["; }
|
||||
&:after { content: "]"; }
|
||||
}
|
||||
.qr--message {
|
||||
height: 1lh;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
#qr--modal-message,
|
||||
#qr--modal-messageSyntaxInner {
|
||||
font-family: var(--monoFontFamily);
|
||||
padding: 0.75em;
|
||||
margin: 0;
|
||||
border: none;
|
||||
resize: none;
|
||||
line-height: 1.2;
|
||||
border: 1px solid var(--SmartThemeBorderColor);
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
> .qr--modal-messageContainer {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
> .qr--modal-editorSettings {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
column-gap: 1em;
|
||||
color: var(--grey70);
|
||||
font-size: smaller;
|
||||
align-items: baseline;
|
||||
> .checkbox_label {
|
||||
white-space: nowrap;
|
||||
> input {
|
||||
font-size: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
> #qr--modal-messageHolder {
|
||||
flex: 1 1 auto;
|
||||
display: grid;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
&.qr--noSyntax {
|
||||
> #qr--modal-messageSyntax {
|
||||
display: none;
|
||||
}
|
||||
> #qr--modal-message {
|
||||
background-color: var(--ac-style-color-background);
|
||||
color: var(--ac-style-color-text);
|
||||
&::-webkit-scrollbar, &::-webkit-scrollbar-thumb {
|
||||
visibility: visible;
|
||||
cursor: unset;
|
||||
}
|
||||
&::selection {
|
||||
color: unset;
|
||||
background-color: rgba(108 171 251 / 0.25);
|
||||
@supports (color: rgb(from white r g b / 0.25)) {
|
||||
background-color: rgb(from var(--ac-style-color-matchedText) r g b / 0.25);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
> #qr--modal-messageSyntax {
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
min-width: 100%;
|
||||
width: 0;
|
||||
> #qr--modal-messageSyntaxInner {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
> #qr--modal-message {
|
||||
background-color: transparent;
|
||||
color: transparent;
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
caret-color: var(--ac-style-color-text);
|
||||
overflow: auto;
|
||||
&::-webkit-scrollbar, &::-webkit-scrollbar-thumb {
|
||||
visibility: hidden;
|
||||
cursor: default;
|
||||
}
|
||||
&::selection {
|
||||
color: transparent;
|
||||
background-color: rgba(108 171 251 / 0.25);
|
||||
@supports (color: rgb(from white r g b / 0.25)) {
|
||||
background-color: rgb(from var(--ac-style-color-matchedText) r g b / 0.25);
|
||||
}
|
||||
}
|
||||
}
|
||||
#qr--modal-message, #qr--modal-messageSyntaxInner {
|
||||
font-family: var(--monoFontFamily);
|
||||
padding: 0.75em;
|
||||
margin: 0;
|
||||
resize: none;
|
||||
line-height: 1.2;
|
||||
border: 1px solid var(--SmartThemeBorderColor);
|
||||
border-radius: 5px;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#qr--modal-icon {
|
||||
height: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
|
||||
#qr--modal-executeButtons {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
|
@ -510,6 +812,47 @@
|
|||
border-color: rgb(215, 136, 114);
|
||||
}
|
||||
}
|
||||
#qr--modal-debugButtons {
|
||||
display: none;
|
||||
gap: 1em;
|
||||
.qr--modal-debugButton {
|
||||
aspect-ratio: 1.25 / 1;
|
||||
width: 2.25em;
|
||||
position: relative;
|
||||
&:not(.fa-solid) {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 3px;
|
||||
background-color: var(--SmartThemeBodyColor);
|
||||
mask-size: contain;
|
||||
mask-position: center;
|
||||
mask-repeat: no-repeat;
|
||||
}
|
||||
}
|
||||
&#qr--modal-resume:after {
|
||||
mask-image: url('/img/step-resume.svg');
|
||||
}
|
||||
&#qr--modal-step:after {
|
||||
mask-image: url('/img/step-over.svg');
|
||||
}
|
||||
&#qr--modal-stepInto:after {
|
||||
mask-image: url('/img/step-into.svg');
|
||||
}
|
||||
&#qr--modal-stepOut:after {
|
||||
mask-image: url('/img/step-out.svg');
|
||||
}
|
||||
&#qr--modal-maximize {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#qr--modal-send_textarea {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
#qr--modal-executeProgress {
|
||||
--prog: 0;
|
||||
|
@ -518,6 +861,7 @@
|
|||
--progSuccessColor: rgb(81, 163, 81);
|
||||
--progErrorColor: rgb(189, 54, 47);
|
||||
--progAbortedColor: rgb(215, 136, 114);
|
||||
flex: 0 0 auto;
|
||||
height: 0.5em;
|
||||
background-color: var(--black50a);
|
||||
position: relative;
|
||||
|
@ -588,6 +932,135 @@
|
|||
overflow: auto;
|
||||
min-width: 100%;
|
||||
width: 0;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
#qr--modal-debugState {
|
||||
display: none;
|
||||
&.qr--active {
|
||||
display: block;
|
||||
}
|
||||
text-align: left;
|
||||
font-size: smaller;
|
||||
font-family: var(--monoFontFamily);
|
||||
// background-color: rgb(146, 190, 252);
|
||||
color: white;
|
||||
padding: 0.5em 0;
|
||||
overflow: auto;
|
||||
min-width: 100%;
|
||||
width: 0;
|
||||
white-space: pre-wrap;
|
||||
|
||||
.qr--scope {
|
||||
display: grid;
|
||||
grid-template-columns: 0fr 1fr 1fr;
|
||||
column-gap: 0em;
|
||||
.qr--title {
|
||||
grid-column: 1 / 4;
|
||||
font-weight: bold;
|
||||
font-family: var(--mainFontFamily);
|
||||
background-color: var(--black50a);
|
||||
padding: 0.25em;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
.qr--var, .qr--macro, .qr--pipe {
|
||||
display: contents;
|
||||
&:nth-child(2n + 1) {
|
||||
.qr--key, .qr--val {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.25);
|
||||
}
|
||||
.qr--val {
|
||||
&:nth-child(2n) {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.125);
|
||||
}
|
||||
&:hover {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
&:nth-child(2n) {
|
||||
.qr--val {
|
||||
&:nth-child(2n) {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.0625);
|
||||
}
|
||||
&:hover {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
&.qr--isHidden {
|
||||
.qr--key, .qr--val {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
.qr--val {
|
||||
grid-column: 2 / 4;
|
||||
&.qr--singleCol {
|
||||
grid-column: unset;
|
||||
}
|
||||
&.qr--simple {
|
||||
&:before, &:after {
|
||||
content: '"';
|
||||
color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
}
|
||||
&.qr--unresolved {
|
||||
&:after {
|
||||
content: '-UNRESOLVED-';
|
||||
font-style: italic;
|
||||
color: var(--SmartThemeQuoteColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.qr--key {
|
||||
margin-left: 0.5em;
|
||||
padding-right: 1em;
|
||||
&:after { content: ": "; }
|
||||
}
|
||||
.qr--pipe, .qr--macro {
|
||||
> .qr--key {
|
||||
&:before { content: "{{"; }
|
||||
&:after { content: "}}: "; }
|
||||
}
|
||||
}
|
||||
.qr--scope {
|
||||
display: contents;
|
||||
.qr--pipe {
|
||||
.qr--key, .qr--val {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.qr--stack {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 0fr;
|
||||
.qr--title {
|
||||
grid-column: 1 / 3;
|
||||
font-weight: bold;
|
||||
font-family: var(--mainFontFamily);
|
||||
background-color: var(--black50a);
|
||||
padding: 0.25em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
.qr--item {
|
||||
display: contents;
|
||||
&:nth-child(2n + 1) {
|
||||
.qr--name, .qr--source {
|
||||
background-color: rgb(from var(--SmartThemeEmColor) r g b / 0.25);
|
||||
}
|
||||
}
|
||||
.qr--name {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
.qr--source {
|
||||
opacity: 0.5;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -605,10 +1078,75 @@
|
|||
}
|
||||
}
|
||||
|
||||
@keyframes qr--debugPulse {
|
||||
0%,
|
||||
100% {
|
||||
border-color: rgb(81, 163, 81);
|
||||
}
|
||||
|
||||
50% {
|
||||
border-color: rgb(146, 190, 252);
|
||||
}
|
||||
}
|
||||
|
||||
.popup.qr--hide {
|
||||
opacity: 0 !important;
|
||||
opacity: 0 !important;
|
||||
&::backdrop {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.popup.qr--hide::backdrop {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.popup:has(.qr--transferModal) {
|
||||
.popup-button-ok {
|
||||
&:after {
|
||||
content: 'Transfer';
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
font-weight: bold;
|
||||
}
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
white-space: pre;
|
||||
font-weight: normal;
|
||||
box-shadow: 0 0 0;
|
||||
transition: 200ms;
|
||||
}
|
||||
.qr--copy {
|
||||
&:after {
|
||||
content: 'Copy';
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
font-weight: bold;
|
||||
}
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
white-space: pre;
|
||||
font-weight: normal;
|
||||
box-shadow: 0 0 0;
|
||||
transition: 200ms;
|
||||
}
|
||||
&:has(.qr--transferSelect:focus) {
|
||||
.popup-button-ok {
|
||||
font-weight: bold;
|
||||
box-shadow: 0 0 10px;
|
||||
}
|
||||
&.qr--isCopy {
|
||||
.popup-button-ok {
|
||||
font-weight: normal;
|
||||
box-shadow: 0 0 0;
|
||||
}
|
||||
.qr--copy {
|
||||
font-weight: bold;
|
||||
box-shadow: 0 0 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,12 +54,7 @@
|
|||
<small data-i18n="Replace With">Replace With</small>
|
||||
</label>
|
||||
<div>
|
||||
<textarea
|
||||
class="regex_replace_string text_pole wide100p textarea_compact"
|
||||
data-i18n="[placeholder]ext_regex_replace_string_placeholder"
|
||||
placeholder="Use {{match}} to include the matched text from the Find Regex or $1, $2, etc. for capture groups."
|
||||
rows="2"
|
||||
></textarea>
|
||||
<textarea class="regex_replace_string text_pole wide100p textarea_compact" data-i18n="[placeholder]ext_regex_replace_string_placeholder" placeholder="Use {{match}} to include the matched text from the Find Regex or $1, $2, etc. for capture groups." rows="2"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex1">
|
||||
|
@ -67,11 +62,7 @@
|
|||
<small data-i18n="Trim Out">Trim Out</small>
|
||||
</label>
|
||||
<div>
|
||||
<textarea
|
||||
class="regex_trim_strings text_pole wide100p textarea_compact" data-i18n="[placeholder]ext_regex_trim_placeholder"
|
||||
placeholder="Globally trims any unwanted parts from a regex match before replacement. Separate each element by an enter."
|
||||
rows="3"
|
||||
></textarea>
|
||||
<textarea class="regex_trim_strings text_pole wide100p textarea_compact" data-i18n="[placeholder]ext_regex_trim_placeholder" placeholder="Globally trims any unwanted parts from a regex match before replacement. Separate each element by an enter." rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -126,17 +117,6 @@
|
|||
<input type="checkbox" name="disabled" />
|
||||
<span data-i18n="Disabled">Disabled</span>
|
||||
</label>
|
||||
<label class="checkbox flex-container" title="Chat history won't change, only the message rendered in the UI.">
|
||||
<input type="checkbox" name="only_format_display" />
|
||||
<span data-i18n="Only Format Display">Only Format Display</span>
|
||||
</label>
|
||||
<label class="checkbox flex-container" data-i18n="[title]ext_regex_only_format_prompt_desc" title="Chat history won't change, only the prompt as the request is sent (on generation).">
|
||||
<input type="checkbox" name="only_format_prompt"/>
|
||||
<span>
|
||||
<span data-i18n="Only Format Prompt (?)">Only Format Prompt</span>
|
||||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||
</span>
|
||||
</label>
|
||||
<label class="checkbox flex-container">
|
||||
<input type="checkbox" name="run_on_edit" />
|
||||
<span data-i18n="Run On Edit">Run On Edit</span>
|
||||
|
@ -148,6 +128,19 @@
|
|||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||
</span>
|
||||
</label>
|
||||
<span>
|
||||
<small data-i18n="ext_regex_other_options" data-i18n="Ephemerality">Ephemerality</small>
|
||||
<span class="fa-solid fa-circle-question note-link-span" title="By default, regex scripts alter the chat file directly and irreversibly. Enabling either (or both) of the options below will prevent chat file alteration, while still altering the specified item(s)."></span>
|
||||
</span>
|
||||
<label class="checkbox flex-container" title="Chat history file contents won't change, but regex will be applied to the messages displayed in the Chat UI.">
|
||||
<input type="checkbox" name="only_format_display" />
|
||||
<span data-i18n="Only Format Display">Alter Chat Display</span>
|
||||
</label>
|
||||
<label class="checkbox flex-container" data-i18n="[title]ext_regex_only_format_prompt_desc" title="Chat history file contents won't change, but regex will be applied to the outgoing prompt before it is sent to the LLM.">
|
||||
<input type="checkbox" name="only_format_prompt" />
|
||||
<span data-i18n="Only Format Prompt (?)">Alter Outgoing Prompt</span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { getRequestHeaders } from '../../script.js';
|
||||
import { extension_settings } from '../extensions.js';
|
||||
import { extension_settings, openThirdPartyExtensionMenu } from '../extensions.js';
|
||||
import { oai_settings } from '../openai.js';
|
||||
import { SECRET_KEYS, secret_state } from '../secrets.js';
|
||||
import { textgen_types, textgenerationwebui_settings } from '../textgen-settings.js';
|
||||
|
@ -136,6 +136,10 @@ function throwIfInvalidModel(useReverseProxy) {
|
|||
throw new Error('Anthropic (Claude) API key is not set.');
|
||||
}
|
||||
|
||||
if (extension_settings.caption.multimodal_api === 'zerooneai' && !secret_state[SECRET_KEYS.ZEROONEAI]) {
|
||||
throw new Error('01.AI API key is not set.');
|
||||
}
|
||||
|
||||
if (extension_settings.caption.multimodal_api === 'google' && !secret_state[SECRET_KEYS.MAKERSUITE] && !useReverseProxy) {
|
||||
throw new Error('MakerSuite API key is not set.');
|
||||
}
|
||||
|
@ -172,3 +176,86 @@ function throwIfInvalidModel(useReverseProxy) {
|
|||
throw new Error('Custom API URL is not set.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the WebLLM extension is installed and supported.
|
||||
* @returns {boolean} Whether the extension is installed and supported
|
||||
*/
|
||||
export function isWebLlmSupported() {
|
||||
if (!('gpu' in navigator)) {
|
||||
const warningKey = 'webllm_browser_warning_shown';
|
||||
if (!sessionStorage.getItem(warningKey)) {
|
||||
toastr.error('Your browser does not support the WebGPU API. Please use a different browser.', 'WebLLM', {
|
||||
preventDuplicates: true,
|
||||
timeOut: 0,
|
||||
extendedTimeOut: 0,
|
||||
});
|
||||
sessionStorage.setItem(warningKey, '1');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!('llm' in SillyTavern)) {
|
||||
const warningKey = 'webllm_extension_warning_shown';
|
||||
if (!sessionStorage.getItem(warningKey)) {
|
||||
toastr.error('WebLLM extension is not installed. Click here to install it.', 'WebLLM', {
|
||||
timeOut: 0,
|
||||
extendedTimeOut: 0,
|
||||
preventDuplicates: true,
|
||||
onclick: () => openThirdPartyExtensionMenu('https://github.com/SillyTavern/Extension-WebLLM'),
|
||||
});
|
||||
sessionStorage.setItem(warningKey, '1');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates text in response to a chat prompt using WebLLM.
|
||||
* @param {any[]} messages Messages to use for generating
|
||||
* @param {object} params Additional parameters
|
||||
* @returns {Promise<string>} Generated response
|
||||
*/
|
||||
export async function generateWebLlmChatPrompt(messages, params = {}) {
|
||||
if (!isWebLlmSupported()) {
|
||||
throw new Error('WebLLM extension is not installed.');
|
||||
}
|
||||
|
||||
console.debug('WebLLM chat completion request:', messages, params);
|
||||
const engine = SillyTavern.llm;
|
||||
const response = await engine.generateChatPrompt(messages, params);
|
||||
console.debug('WebLLM chat completion response:', response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts the number of tokens in the provided text using WebLLM's default model.
|
||||
* @param {string} text Text to count tokens in
|
||||
* @returns {Promise<number>} Number of tokens in the text
|
||||
*/
|
||||
export async function countWebLlmTokens(text) {
|
||||
if (!isWebLlmSupported()) {
|
||||
throw new Error('WebLLM extension is not installed.');
|
||||
}
|
||||
|
||||
const engine = SillyTavern.llm;
|
||||
const response = await engine.countTokens(text);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size of the context in the WebLLM's default model.
|
||||
* @returns {Promise<number>} Size of the context in the WebLLM model
|
||||
*/
|
||||
export async function getWebLlmContextSize() {
|
||||
if (!isWebLlmSupported()) {
|
||||
throw new Error('WebLLM extension is not installed.');
|
||||
}
|
||||
|
||||
const engine = SillyTavern.llm;
|
||||
await engine.loadModel();
|
||||
const model = await engine.getCurrentModelInfo();
|
||||
return model?.context_size;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<div id="sd_gen" class="list-group-item flex-container flexGap5">
|
||||
<div class="fa-solid fa-paintbrush extensionsMenuExtensionButton" title="Trigger Stable Diffusion" data-i18n="[title]Trigger Stable Diffusion" /></div>
|
||||
Generate Image
|
||||
<div class="fa-solid fa-paintbrush extensionsMenuExtensionButton" title="Trigger Stable Diffusion" data-i18n="[title]Trigger Stable Diffusion"></div>
|
||||
<span>Generate Image</span>
|
||||
</div>
|
||||
<div id="sd_stop_gen" class="list-group-item flex-container flexGap5">
|
||||
<div class="fa-solid fa-circle-stop extensionsMenuExtensionButton" title="Abort current image generation task" data-i18n="[title]Abort current image generation task"></div>
|
||||
<span>Stop Image Generation</span>
|
||||
</div>
|
||||
|
|
|
@ -30,13 +30,14 @@ import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
|||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||
import { debounce_timeout } from '../../constants.js';
|
||||
import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';
|
||||
import { POPUP_TYPE, Popup, callGenericPopup } from '../../popup.js';
|
||||
import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from '../../popup.js';
|
||||
export { MODULE_NAME };
|
||||
|
||||
const MODULE_NAME = 'sd';
|
||||
const UPDATE_INTERVAL = 1000;
|
||||
// This is a 1x1 transparent PNG
|
||||
const PNG_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
||||
const CUSTOM_STOP_EVENT = 'sd_stop_generation';
|
||||
|
||||
const sources = {
|
||||
extras: 'extras',
|
||||
|
@ -50,6 +51,7 @@ const sources = {
|
|||
drawthings: 'drawthings',
|
||||
pollinations: 'pollinations',
|
||||
stability: 'stability',
|
||||
blockentropy: 'blockentropy',
|
||||
};
|
||||
|
||||
const initiators = {
|
||||
|
@ -57,6 +59,7 @@ const initiators = {
|
|||
action: 'action',
|
||||
interactive: 'interactive',
|
||||
wand: 'wand',
|
||||
swipe: 'swipe',
|
||||
};
|
||||
|
||||
const generationMode = {
|
||||
|
@ -718,29 +721,29 @@ function onChatChanged() {
|
|||
adjustElementScrollHeight();
|
||||
}
|
||||
|
||||
function adjustElementScrollHeight() {
|
||||
async function adjustElementScrollHeight() {
|
||||
if (!$('.sd_settings').is(':visible')) {
|
||||
return;
|
||||
}
|
||||
|
||||
resetScrollHeight($('#sd_prompt_prefix'));
|
||||
resetScrollHeight($('#sd_negative_prompt'));
|
||||
resetScrollHeight($('#sd_character_prompt'));
|
||||
resetScrollHeight($('#sd_character_negative_prompt'));
|
||||
await resetScrollHeight($('#sd_prompt_prefix'));
|
||||
await resetScrollHeight($('#sd_negative_prompt'));
|
||||
await resetScrollHeight($('#sd_character_prompt'));
|
||||
await resetScrollHeight($('#sd_character_negative_prompt'));
|
||||
}
|
||||
|
||||
function onCharacterPromptInput() {
|
||||
async function onCharacterPromptInput() {
|
||||
const key = getCharaFilename(this_chid);
|
||||
extension_settings.sd.character_prompts[key] = $('#sd_character_prompt').val();
|
||||
resetScrollHeight($(this));
|
||||
await resetScrollHeight($(this));
|
||||
saveSettingsDebounced();
|
||||
writePromptFieldsDebounced(this_chid);
|
||||
}
|
||||
|
||||
function onCharacterNegativePromptInput() {
|
||||
async function onCharacterNegativePromptInput() {
|
||||
const key = getCharaFilename(this_chid);
|
||||
extension_settings.sd.character_negative_prompts[key] = $('#sd_character_negative_prompt').val();
|
||||
resetScrollHeight($(this));
|
||||
await resetScrollHeight($(this));
|
||||
saveSettingsDebounced();
|
||||
writePromptFieldsDebounced(this_chid);
|
||||
}
|
||||
|
@ -849,15 +852,15 @@ function onStepsInput() {
|
|||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
function onPromptPrefixInput() {
|
||||
async function onPromptPrefixInput() {
|
||||
extension_settings.sd.prompt_prefix = $('#sd_prompt_prefix').val();
|
||||
resetScrollHeight($(this));
|
||||
await resetScrollHeight($(this));
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
function onNegativePromptInput() {
|
||||
async function onNegativePromptInput() {
|
||||
extension_settings.sd.negative_prompt = $('#sd_negative_prompt').val();
|
||||
resetScrollHeight($(this));
|
||||
await resetScrollHeight($(this));
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
|
@ -1095,7 +1098,18 @@ function onComfyWorkflowChange() {
|
|||
|
||||
async function onStabilityKeyClick() {
|
||||
const popupText = 'Stability AI API Key:';
|
||||
const key = await callGenericPopup(popupText, POPUP_TYPE.INPUT);
|
||||
const key = await callGenericPopup(popupText, POPUP_TYPE.INPUT, '', {
|
||||
customButtons: [{
|
||||
text: 'Remove Key',
|
||||
appendAtEnd: true,
|
||||
result: POPUP_RESULT.NEGATIVE,
|
||||
action: async () => {
|
||||
await writeSecret(SECRET_KEYS.STABILITY, '');
|
||||
toastr.success('API Key removed');
|
||||
await loadSettingOptions();
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
if (!key) {
|
||||
return;
|
||||
|
@ -1221,7 +1235,7 @@ async function onModelChange() {
|
|||
extension_settings.sd.model = $('#sd_model').find(':selected').val();
|
||||
saveSettingsDebounced();
|
||||
|
||||
const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai, sources.pollinations, sources.stability];
|
||||
const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai, sources.pollinations, sources.stability, sources.blockentropy];
|
||||
|
||||
if (cloudSources.includes(extension_settings.sd.source)) {
|
||||
return;
|
||||
|
@ -1433,6 +1447,9 @@ async function loadSamplers() {
|
|||
case sources.stability:
|
||||
samplers = ['N/A'];
|
||||
break;
|
||||
case sources.blockentropy:
|
||||
samplers = ['N/A'];
|
||||
break;
|
||||
}
|
||||
|
||||
for (const sampler of samplers) {
|
||||
|
@ -1619,6 +1636,9 @@ async function loadModels() {
|
|||
case sources.stability:
|
||||
models = await loadStabilityModels();
|
||||
break;
|
||||
case sources.blockentropy:
|
||||
models = await loadBlockEntropyModels();
|
||||
break;
|
||||
}
|
||||
|
||||
for (const model of models) {
|
||||
|
@ -1648,49 +1668,13 @@ async function loadStabilityModels() {
|
|||
async function loadPollinationsModels() {
|
||||
return [
|
||||
{
|
||||
value: 'pixart',
|
||||
text: 'PixArt-αlpha',
|
||||
},
|
||||
{
|
||||
value: 'playground',
|
||||
text: 'Playground v2',
|
||||
},
|
||||
{
|
||||
value: 'dalle3xl',
|
||||
text: 'DALL•E 3 XL',
|
||||
},
|
||||
{
|
||||
value: 'formulaxl',
|
||||
text: 'FormulaXL',
|
||||
},
|
||||
{
|
||||
value: 'dreamshaper',
|
||||
text: 'DreamShaper',
|
||||
},
|
||||
{
|
||||
value: 'deliberate',
|
||||
text: 'Deliberate',
|
||||
},
|
||||
{
|
||||
value: 'dpo',
|
||||
text: 'SDXL-DPO',
|
||||
},
|
||||
{
|
||||
value: 'swizz8',
|
||||
text: 'Swizz8',
|
||||
},
|
||||
{
|
||||
value: 'juggernaut',
|
||||
text: 'Juggernaut',
|
||||
value: 'flux',
|
||||
text: 'FLUX.1 [schnell]',
|
||||
},
|
||||
{
|
||||
value: 'turbo',
|
||||
text: 'SDXL Turbo',
|
||||
},
|
||||
{
|
||||
value: 'realvis',
|
||||
text: 'Realistic Vision',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -1713,6 +1697,26 @@ async function loadTogetherAIModels() {
|
|||
return [];
|
||||
}
|
||||
|
||||
async function loadBlockEntropyModels() {
|
||||
if (!secret_state[SECRET_KEYS.BLOCKENTROPY]) {
|
||||
console.debug('Block Entropy API key is not set.');
|
||||
return [];
|
||||
}
|
||||
|
||||
const result = await fetch('/api/sd/blockentropy/models', {
|
||||
method: 'POST',
|
||||
headers: getRequestHeaders(),
|
||||
});
|
||||
console.log(result);
|
||||
if (result.ok) {
|
||||
const data = await result.json();
|
||||
console.log(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
async function loadHordeModels() {
|
||||
const result = await fetch('/api/horde/sd-models', {
|
||||
method: 'POST',
|
||||
|
@ -1979,6 +1983,9 @@ async function loadSchedulers() {
|
|||
case sources.stability:
|
||||
schedulers = ['N/A'];
|
||||
break;
|
||||
case sources.blockentropy:
|
||||
schedulers = ['N/A'];
|
||||
break;
|
||||
}
|
||||
|
||||
for (const scheduler of schedulers) {
|
||||
|
@ -2055,6 +2062,9 @@ async function loadVaes() {
|
|||
case sources.stability:
|
||||
vaes = ['N/A'];
|
||||
break;
|
||||
case sources.blockentropy:
|
||||
vaes = ['N/A'];
|
||||
break;
|
||||
}
|
||||
|
||||
for (const vae of vaes) {
|
||||
|
@ -2266,9 +2276,9 @@ async function generatePicture(initiator, args, trigger, message, callback) {
|
|||
const quietPrompt = getQuietPrompt(generationType, trigger);
|
||||
const context = getContext();
|
||||
|
||||
// if context.characterId is not null, then we get context.characters[context.characterId].avatar, else we get groupId and context.groups[groupId].id
|
||||
// sadly, groups is not an array, but is a dict with keys being index numbers, so we have to filter it
|
||||
const characterName = context.characterId ? context.characters[context.characterId].name : context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString();
|
||||
const characterName = context.groupId
|
||||
? context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString()
|
||||
: context.characters[context.characterId]?.name;
|
||||
|
||||
if (generationType == generationMode.BACKGROUND) {
|
||||
const callbackOriginal = callback;
|
||||
|
@ -2290,6 +2300,7 @@ async function generatePicture(initiator, args, trigger, message, callback) {
|
|||
|
||||
const dimensions = setTypeSpecificDimensions(generationType);
|
||||
const abortController = new AbortController();
|
||||
const stopButton = document.getElementById('sd_stop_gen');
|
||||
let negativePromptPrefix = args?.negative || '';
|
||||
let imagePath = '';
|
||||
|
||||
|
@ -2300,9 +2311,8 @@ async function generatePicture(initiator, args, trigger, message, callback) {
|
|||
const prompt = await getPrompt(generationType, message, trigger, quietPrompt, combineNegatives);
|
||||
console.log('Processed image prompt:', prompt);
|
||||
|
||||
eventSource.once(event_types.GENERATION_STOPPED, stopListener);
|
||||
context.deactivateSendButtons();
|
||||
hideSwipeButtons();
|
||||
$(stopButton).show();
|
||||
eventSource.once(CUSTOM_STOP_EVENT, stopListener);
|
||||
|
||||
if (typeof args?._abortController?.addEventListener === 'function') {
|
||||
args._abortController.addEventListener('abort', stopListener);
|
||||
|
@ -2311,13 +2321,13 @@ async function generatePicture(initiator, args, trigger, message, callback) {
|
|||
imagePath = await sendGenerationRequest(generationType, prompt, negativePromptPrefix, characterName, callback, initiator, abortController.signal);
|
||||
} catch (err) {
|
||||
console.trace(err);
|
||||
throw new Error('SD prompt text generation failed.');
|
||||
toastr.error('SD prompt text generation failed. Reason: ' + err, 'Image Generation');
|
||||
throw new Error('SD prompt text generation failed. Reason: ' + err);
|
||||
}
|
||||
finally {
|
||||
$(stopButton).hide();
|
||||
restoreOriginalDimensions(dimensions);
|
||||
eventSource.removeListener(event_types.GENERATION_STOPPED, stopListener);
|
||||
context.activateSendButtons();
|
||||
showSwipeButtons();
|
||||
eventSource.removeListener(CUSTOM_STOP_EVENT, stopListener);
|
||||
}
|
||||
|
||||
return imagePath;
|
||||
|
@ -2583,6 +2593,9 @@ async function sendGenerationRequest(generationType, prompt, additionalNegativeP
|
|||
case sources.stability:
|
||||
result = await generateStabilityImage(prefixedPrompt, negativePrompt, signal);
|
||||
break;
|
||||
case sources.blockentropy:
|
||||
result = await generateBlockEntropyImage(prefixedPrompt, negativePrompt, signal);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!result.data) {
|
||||
|
@ -2638,6 +2651,40 @@ async function generateTogetherAIImage(prompt, negativePrompt, signal) {
|
|||
}
|
||||
}
|
||||
|
||||
async function generateBlockEntropyImage(prompt, negativePrompt, signal) {
|
||||
const result = await fetch('/api/sd/blockentropy/generate', {
|
||||
method: 'POST',
|
||||
headers: getRequestHeaders(),
|
||||
signal: signal,
|
||||
body: JSON.stringify({
|
||||
prompt: prompt,
|
||||
negative_prompt: negativePrompt,
|
||||
model: extension_settings.sd.model,
|
||||
steps: extension_settings.sd.steps,
|
||||
width: extension_settings.sd.width,
|
||||
height: extension_settings.sd.height,
|
||||
seed: extension_settings.sd.seed >= 0 ? extension_settings.sd.seed : undefined,
|
||||
}),
|
||||
});
|
||||
|
||||
if (result.ok) {
|
||||
const data = await result.json();
|
||||
|
||||
// Default format is 'jpg'
|
||||
let format = 'jpg';
|
||||
|
||||
// Check if a format is specified in the result
|
||||
if (data.format) {
|
||||
format = data.format.toLowerCase();
|
||||
}
|
||||
|
||||
return { format: format, data: data.images[0] };
|
||||
} else {
|
||||
const text = await result.text();
|
||||
throw new Error(text);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an image using the Pollinations API.
|
||||
* @param {string} prompt - The main instruction used to guide the image generation.
|
||||
|
@ -3347,11 +3394,15 @@ async function sendMessage(prompt, image, generationType, additionalNegativePref
|
|||
generationType: generationType,
|
||||
negative: additionalNegativePrefix,
|
||||
inline_image: false,
|
||||
image_swipes: [image],
|
||||
},
|
||||
};
|
||||
context.chat.push(message);
|
||||
const messageId = context.chat.length - 1;
|
||||
await eventSource.emit(event_types.MESSAGE_RECEIVED, messageId);
|
||||
context.addOneMessage(message);
|
||||
context.saveChat();
|
||||
await eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, messageId);
|
||||
await context.saveChat();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3395,7 +3446,7 @@ async function addSDGenButtons() {
|
|||
$(document).on('click touchend', function (e) {
|
||||
const target = $(e.target);
|
||||
if (target.is(dropdown) || target.closest(dropdown).length) return;
|
||||
if (target.is(button) && !dropdown.is(':visible') && $('#send_but').is(':visible')) {
|
||||
if ((target.is(button) || target.closest(button).length) && !dropdown.is(':visible')) {
|
||||
e.preventDefault();
|
||||
|
||||
dropdown.fadeIn(animation_duration);
|
||||
|
@ -3425,6 +3476,10 @@ async function addSDGenButtons() {
|
|||
generatePicture(initiators.wand, {}, param);
|
||||
}
|
||||
});
|
||||
|
||||
const stopGenButton = $('#sd_stop_gen');
|
||||
stopGenButton.hide();
|
||||
stopGenButton.on('click', () => eventSource.emit(CUSTOM_STOP_EVENT));
|
||||
}
|
||||
|
||||
function isValidState() {
|
||||
|
@ -3451,6 +3506,8 @@ function isValidState() {
|
|||
return true;
|
||||
case sources.stability:
|
||||
return secret_state[SECRET_KEYS.STABILITY];
|
||||
case sources.blockentropy:
|
||||
return secret_state[SECRET_KEYS.BLOCKENTROPY];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3480,7 +3537,9 @@ async function sdMessageButton(e) {
|
|||
const $mes = $icon.closest('.mes');
|
||||
const message_id = $mes.attr('mesid');
|
||||
const message = context.chat[message_id];
|
||||
const characterFileName = context.characterId ? context.characters[context.characterId].name : context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString();
|
||||
const characterFileName = context.groupId
|
||||
? context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString()
|
||||
: context.characters[context.characterId]?.name;
|
||||
const messageText = message?.mes;
|
||||
const hasSavedImage = message?.extra?.image && message?.extra?.title;
|
||||
const hasSavedNegative = message?.extra?.negative;
|
||||
|
@ -3524,10 +3583,23 @@ async function sdMessageButton(e) {
|
|||
|
||||
function saveGeneratedImage(prompt, image, generationType, negative) {
|
||||
// Some message sources may not create the extra object
|
||||
if (typeof message.extra !== 'object') {
|
||||
if (typeof message.extra !== 'object' || message.extra === null) {
|
||||
message.extra = {};
|
||||
}
|
||||
|
||||
// Add image to the swipe list if it's not already there
|
||||
if (!Array.isArray(message.extra.image_swipes)) {
|
||||
message.extra.image_swipes = [];
|
||||
}
|
||||
|
||||
const swipes = message.extra.image_swipes;
|
||||
|
||||
if (message.extra.image && !swipes.includes(message.extra.image)) {
|
||||
swipes.push(message.extra.image);
|
||||
}
|
||||
|
||||
swipes.push(image);
|
||||
|
||||
// If already contains an image and it's not inline - leave it as is
|
||||
message.extra.inline_image = message.extra.image && !message.extra.inline_image ? false : true;
|
||||
message.extra.image = image;
|
||||
|
@ -3566,6 +3638,99 @@ async function writePromptFields(characterId) {
|
|||
await writeExtensionField(characterId, 'sd_character_prompt', promptObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches an image to the next or previous one in the swipe list.
|
||||
* @param {object} args Event arguments
|
||||
* @param {any} args.message Message object
|
||||
* @param {JQuery<HTMLElement>} args.element Message element
|
||||
* @param {string} args.direction Swipe direction
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function onImageSwiped({ message, element, direction }) {
|
||||
const context = getContext();
|
||||
const animationClass = 'fa-fade';
|
||||
const messageImg = element.find('.mes_img');
|
||||
|
||||
// Current image is already animating
|
||||
if (messageImg.hasClass(animationClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const swipes = message?.extra?.image_swipes;
|
||||
|
||||
if (!Array.isArray(swipes)) {
|
||||
console.warn('No image swipes found in the message');
|
||||
return;
|
||||
}
|
||||
|
||||
const currentIndex = swipes.indexOf(message.extra.image);
|
||||
|
||||
if (currentIndex === -1) {
|
||||
console.warn('Current image not found in the swipes');
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch to previous image or wrap around if at the beginning
|
||||
if (direction === 'left') {
|
||||
const newIndex = currentIndex === 0 ? swipes.length - 1 : currentIndex - 1;
|
||||
message.extra.image = swipes[newIndex];
|
||||
|
||||
// Update the image in the message
|
||||
appendMediaToMessage(message, element, false);
|
||||
}
|
||||
|
||||
// Switch to next image or generate a new one if at the end
|
||||
if (direction === 'right') {
|
||||
const newIndex = currentIndex === swipes.length - 1 ? swipes.length : currentIndex + 1;
|
||||
|
||||
if (newIndex === swipes.length) {
|
||||
const abortController = new AbortController();
|
||||
const swipeControls = element.find('.mes_img_swipes');
|
||||
const stopButton = document.getElementById('sd_stop_gen');
|
||||
const stopListener = () => abortController.abort('Aborted by user');
|
||||
const generationType = message?.extra?.generationType ?? generationMode.FREE;
|
||||
const dimensions = setTypeSpecificDimensions(generationType);
|
||||
const originalSeed = extension_settings.sd.seed;
|
||||
extension_settings.sd.seed = Math.round(Math.random() * Number.MAX_SAFE_INTEGER);
|
||||
let imagePath = '';
|
||||
|
||||
try {
|
||||
$(stopButton).show();
|
||||
eventSource.once(CUSTOM_STOP_EVENT, stopListener);
|
||||
const callback = () => { };
|
||||
const hasNegative = message.extra.negative;
|
||||
const prompt = await refinePrompt(message.extra.title, false, false);
|
||||
const negativePromptPrefix = hasNegative ? await refinePrompt(message.extra.negative, false, true) : '';
|
||||
const characterName = context.groupId
|
||||
? context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString()
|
||||
: context.characters[context.characterId]?.name;
|
||||
|
||||
messageImg.addClass(animationClass);
|
||||
swipeControls.hide();
|
||||
imagePath = await sendGenerationRequest(generationType, prompt, negativePromptPrefix, characterName, callback, initiators.swipe, abortController.signal);
|
||||
} finally {
|
||||
$(stopButton).hide();
|
||||
messageImg.removeClass(animationClass);
|
||||
swipeControls.show();
|
||||
eventSource.removeListener(CUSTOM_STOP_EVENT, stopListener);
|
||||
restoreOriginalDimensions(dimensions);
|
||||
extension_settings.sd.seed = originalSeed;
|
||||
}
|
||||
|
||||
if (!imagePath) {
|
||||
return;
|
||||
}
|
||||
|
||||
swipes.push(imagePath);
|
||||
}
|
||||
|
||||
message.extra.image = swipes[newIndex];
|
||||
appendMediaToMessage(message, element, false);
|
||||
}
|
||||
|
||||
await context.saveChat();
|
||||
}
|
||||
|
||||
jQuery(async () => {
|
||||
await addSDGenButtons();
|
||||
|
||||
|
@ -3704,6 +3869,8 @@ jQuery(async () => {
|
|||
}
|
||||
});
|
||||
|
||||
eventSource.on(event_types.IMAGE_SWIPED, onImageSwiped);
|
||||
|
||||
eventSource.on(event_types.CHAT_CHANGED, onChatChanged);
|
||||
|
||||
await loadSettings();
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
</label>
|
||||
<label for="sd_source" data-i18n="Source">Source</label>
|
||||
<select id="sd_source">
|
||||
<option value="blockentropy">Block Entropy</option>
|
||||
<option value="comfy">ComfyUI</option>
|
||||
<option value="drawthings">DrawThings HTTP API</option>
|
||||
<option value="extras">Extras API (local / remote)</option>
|
||||
|
@ -378,7 +379,7 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div data-sd-source="novel,togetherai,pollinations,comfy,drawthings,vlad,auto,horde,extras,stability" class="marginTop5">
|
||||
<div data-sd-source="novel,togetherai,pollinations,comfy,drawthings,vlad,auto,horde,extras,stability,blockentropy" class="marginTop5">
|
||||
<label for="sd_seed">
|
||||
<span data-i18n="Seed">Seed</span>
|
||||
<small data-i18n="(-1 for random)">(-1 for random)</small>
|
||||
|
|
|
@ -59,8 +59,8 @@ async function doTokenCounter() {
|
|||
$('#tokenized_chunks_display').text('—');
|
||||
}
|
||||
|
||||
resetScrollHeight($('#token_counter_textarea'));
|
||||
resetScrollHeight($('#token_counter_ids'));
|
||||
await resetScrollHeight($('#token_counter_textarea'));
|
||||
await resetScrollHeight($('#token_counter_ids'));
|
||||
}, debounce_timeout.relaxed);
|
||||
dialog.find('#token_counter_textarea').on('input', () => countDebounced());
|
||||
|
||||
|
@ -134,7 +134,8 @@ jQuery(() => {
|
|||
</div>`;
|
||||
$('#token_counter_wand_container').append(buttonHtml);
|
||||
$('#token_counter').on('click', doTokenCounter);
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'count',
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'count',
|
||||
callback: async () => String(await doCount()),
|
||||
returns: 'number of tokens',
|
||||
helpString: 'Counts the number of tokens in the current chat.',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<div id="translate_chat" class="list-group-item flex-container flexGap5">
|
||||
<div class="fa-solid fa-language extensionsMenuExtensionButton" /></div>
|
||||
<div class="fa-solid fa-language extensionsMenuExtensionButton"></div>
|
||||
<span data-i18n="ext_translate_btn_chat">Translate Chat</span>
|
||||
</div>
|
||||
<div id="translate_input_message" class="list-group-item flex-container flexGap5">
|
||||
<div class="fa-solid fa-keyboard extensionsMenuExtensionButton" /></div>
|
||||
<div class="fa-solid fa-keyboard extensionsMenuExtensionButton"></div>
|
||||
<span data-i18n="ext_translate_btn_input">Translate Input</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
updateMessageBlock,
|
||||
} from '../../../script.js';
|
||||
import { extension_settings, getContext, renderExtensionTemplateAsync } from '../../extensions.js';
|
||||
import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||
import { POPUP_RESULT, POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||
import { findSecret, secret_state, writeSecret } from '../../secrets.js';
|
||||
import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||
|
@ -621,7 +621,18 @@ jQuery(async () => {
|
|||
const secretKey = extension_settings.translate.provider + '_url';
|
||||
const savedUrl = secret_state[secretKey] ? await findSecret(secretKey) : '';
|
||||
|
||||
const url = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedUrl);
|
||||
const url = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedUrl,{
|
||||
customButtons: [{
|
||||
text: 'Remove URL',
|
||||
appendAtEnd: true,
|
||||
result: POPUP_RESULT.NEGATIVE,
|
||||
action: async () => {
|
||||
await writeSecret(secretKey, '');
|
||||
toastr.success('API URL removed');
|
||||
$('#translate_url_button').toggleClass('success', !!secret_state[secretKey]);
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
if (url == false || url == '') {
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { getRequestHeaders } from '../../../script.js';
|
||||
import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||
import { POPUP_RESULT, POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||
import { SECRET_KEYS, findSecret, secret_state, writeSecret } from '../../secrets.js';
|
||||
import { getPreviewString, saveTtsProviderSettings } from './index.js';
|
||||
export { AzureTtsProvider };
|
||||
|
@ -70,7 +70,19 @@ class AzureTtsProvider {
|
|||
const popupText = 'Azure TTS API Key';
|
||||
const savedKey = secret_state[SECRET_KEYS.AZURE_TTS] ? await findSecret(SECRET_KEYS.AZURE_TTS) : '';
|
||||
|
||||
const key = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedKey);
|
||||
const key = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedKey, {
|
||||
customButtons: [{
|
||||
text: 'Remove Key',
|
||||
appendAtEnd: true,
|
||||
result: POPUP_RESULT.NEGATIVE,
|
||||
action: async () => {
|
||||
await writeSecret(SECRET_KEYS.AZURE_TTS, '');
|
||||
$('#azure_tts_key').toggleClass('success', secret_state[SECRET_KEYS.AZURE_TTS]);
|
||||
toastr.success('API Key removed');
|
||||
await this.onRefreshClick();
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
if (key == false || key == '') {
|
||||
return;
|
||||
|
|
|
@ -9,6 +9,7 @@ import { SystemTtsProvider } from './system.js';
|
|||
import { NovelTtsProvider } from './novel.js';
|
||||
import { power_user } from '../../power-user.js';
|
||||
import { OpenAITtsProvider } from './openai.js';
|
||||
import { OpenAICompatibleTtsProvider } from './openai-compatible.js';
|
||||
import { XTTSTtsProvider } from './xtts.js';
|
||||
import { VITSTtsProvider } from './vits.js';
|
||||
import { GSVITtsProvider } from './gsvi.js';
|
||||
|
@ -82,20 +83,21 @@ export function getPreviewString(lang) {
|
|||
}
|
||||
|
||||
const ttsProviders = {
|
||||
ElevenLabs: ElevenLabsTtsProvider,
|
||||
Silero: SileroTtsProvider,
|
||||
XTTSv2: XTTSTtsProvider,
|
||||
VITS: VITSTtsProvider,
|
||||
GSVI: GSVITtsProvider,
|
||||
SBVits2: SBVits2TtsProvider,
|
||||
System: SystemTtsProvider,
|
||||
AllTalk: AllTalkTtsProvider,
|
||||
Azure: AzureTtsProvider,
|
||||
Coqui: CoquiTtsProvider,
|
||||
Edge: EdgeTtsProvider,
|
||||
ElevenLabs: ElevenLabsTtsProvider,
|
||||
GSVI: GSVITtsProvider,
|
||||
Novel: NovelTtsProvider,
|
||||
OpenAI: OpenAITtsProvider,
|
||||
AllTalk: AllTalkTtsProvider,
|
||||
'OpenAI Compatible': OpenAICompatibleTtsProvider,
|
||||
SBVits2: SBVits2TtsProvider,
|
||||
Silero: SileroTtsProvider,
|
||||
SpeechT5: SpeechT5TtsProvider,
|
||||
Azure: AzureTtsProvider,
|
||||
System: SystemTtsProvider,
|
||||
VITS: VITSTtsProvider,
|
||||
XTTSv2: XTTSTtsProvider,
|
||||
};
|
||||
let ttsProvider;
|
||||
let ttsProviderName;
|
||||
|
|
|
@ -0,0 +1,193 @@
|
|||
import { getRequestHeaders } from '../../../script.js';
|
||||
import { callGenericPopup, POPUP_RESULT, POPUP_TYPE } from '../../popup.js';
|
||||
import { findSecret, SECRET_KEYS, secret_state, writeSecret } from '../../secrets.js';
|
||||
import { getPreviewString, saveTtsProviderSettings } from './index.js';
|
||||
|
||||
export { OpenAICompatibleTtsProvider };
|
||||
|
||||
class OpenAICompatibleTtsProvider {
|
||||
settings;
|
||||
voices = [];
|
||||
separator = ' . ';
|
||||
|
||||
audioElement = document.createElement('audio');
|
||||
|
||||
defaultSettings = {
|
||||
voiceMap: {},
|
||||
model: 'tts-1',
|
||||
speed: 1,
|
||||
available_voices: ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'],
|
||||
provider_endpoint: 'http://127.0.0.1:8000/v1/audio/speech',
|
||||
};
|
||||
|
||||
get settingsHtml() {
|
||||
let html = `
|
||||
<label for="openai_compatible_tts_endpoint">Provider Endpoint:</label>
|
||||
<div class="flex-container alignItemsCenter">
|
||||
<div class="flex1">
|
||||
<input id="openai_compatible_tts_endpoint" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.provider_endpoint}"/>
|
||||
</div>
|
||||
<div id="openai_compatible_tts_key" class="menu_button menu_button_icon">
|
||||
<i class="fa-solid fa-key"></i>
|
||||
<span>API Key</span>
|
||||
</div>
|
||||
</div>
|
||||
<label for="openai_compatible_model">Model:</label>
|
||||
<input id="openai_compatible_model" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.model}"/>
|
||||
<label for="openai_compatible_tts_voices">Available Voices (comma separated):</label>
|
||||
<input id="openai_compatible_tts_voices" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.available_voices.join()}"/>
|
||||
<label for="openai_compatible_tts_speed">Speed: <span id="openai_compatible_tts_speed_output"></span></label>
|
||||
<input type="range" id="openai_compatible_tts_speed" value="1" min="0.25" max="4" step="0.05">`;
|
||||
return html;
|
||||
}
|
||||
|
||||
async loadSettings(settings) {
|
||||
// Populate Provider UI given input settings
|
||||
if (Object.keys(settings).length == 0) {
|
||||
console.info('Using default TTS Provider settings');
|
||||
}
|
||||
|
||||
// Only accept keys defined in defaultSettings
|
||||
this.settings = this.defaultSettings;
|
||||
|
||||
for (const key in settings) {
|
||||
if (key in this.settings) {
|
||||
this.settings[key] = settings[key];
|
||||
} else {
|
||||
throw `Invalid setting passed to TTS Provider: ${key}`;
|
||||
}
|
||||
}
|
||||
|
||||
$('#openai_compatible_tts_endpoint').val(this.settings.provider_endpoint);
|
||||
$('#openai_compatible_tts_endpoint').on('input', () => { this.onSettingsChange(); });
|
||||
|
||||
$('#openai_compatible_model').val(this.defaultSettings.model);
|
||||
$('#openai_compatible_model').on('input', () => { this.onSettingsChange(); });
|
||||
|
||||
$('#openai_compatible_tts_voices').val(this.settings.available_voices.join());
|
||||
$('#openai_compatible_tts_voices').on('input', () => { this.onSettingsChange(); });
|
||||
|
||||
$('#openai_compatible_tts_speed').val(this.settings.speed);
|
||||
$('#openai_compatible_tts_speed').on('input', () => {
|
||||
this.onSettingsChange();
|
||||
});
|
||||
|
||||
$('#openai_compatible_tts_speed_output').text(this.settings.speed);
|
||||
|
||||
$('#openai_compatible_tts_key').toggleClass('success', secret_state[SECRET_KEYS.CUSTOM_OPENAI_TTS]);
|
||||
$('#openai_compatible_tts_key').on('click', async () => {
|
||||
const popupText = 'OpenAI-compatible TTS API Key';
|
||||
const savedKey = secret_state[SECRET_KEYS.CUSTOM_OPENAI_TTS] ? await findSecret(SECRET_KEYS.CUSTOM_OPENAI_TTS) : '';
|
||||
|
||||
const key = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedKey, {
|
||||
customButtons: [{
|
||||
text: 'Remove Key',
|
||||
appendAtEnd: true,
|
||||
result: POPUP_RESULT.NEGATIVE,
|
||||
action: async () => {
|
||||
await writeSecret(SECRET_KEYS.CUSTOM_OPENAI_TTS, '');
|
||||
$('#openai_compatible_tts_key').toggleClass('success', secret_state[SECRET_KEYS.CUSTOM_OPENAI_TTS]);
|
||||
toastr.success('API Key removed');
|
||||
await this.onRefreshClick();
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
if (key == false || key == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
await writeSecret(SECRET_KEYS.CUSTOM_OPENAI_TTS, String(key));
|
||||
|
||||
toastr.success('API Key saved');
|
||||
$('#openai_compatible_tts_key').toggleClass('success', secret_state[SECRET_KEYS.CUSTOM_OPENAI_TTS]);
|
||||
await this.onRefreshClick();
|
||||
});
|
||||
|
||||
await this.checkReady();
|
||||
|
||||
console.debug('OpenAI Compatible TTS: Settings loaded');
|
||||
}
|
||||
|
||||
onSettingsChange() {
|
||||
// Update dynamically
|
||||
this.settings.provider_endpoint = String($('#openai_compatible_tts_endpoint').val());
|
||||
this.settings.model = String($('#openai_compatible_model').val());
|
||||
this.settings.available_voices = String($('#openai_compatible_tts_voices').val()).split(',');
|
||||
this.settings.speed = Number($('#openai_compatible_tts_speed').val());
|
||||
$('#openai_compatible_tts_speed_output').text(this.settings.speed);
|
||||
saveTtsProviderSettings();
|
||||
}
|
||||
|
||||
async checkReady() {
|
||||
await this.fetchTtsVoiceObjects();
|
||||
}
|
||||
|
||||
async onRefreshClick() {
|
||||
return;
|
||||
}
|
||||
|
||||
async getVoice(voiceName) {
|
||||
if (this.voices.length == 0) {
|
||||
this.voices = await this.fetchTtsVoiceObjects();
|
||||
}
|
||||
const match = this.voices.filter(
|
||||
oaicVoice => oaicVoice.name == voiceName,
|
||||
)[0];
|
||||
if (!match) {
|
||||
throw `TTS Voice name ${voiceName} not found`;
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
async generateTts(text, voiceId) {
|
||||
const response = await this.fetchTtsGeneration(text, voiceId);
|
||||
return response;
|
||||
}
|
||||
|
||||
async fetchTtsVoiceObjects() {
|
||||
return this.settings.available_voices.map(v => {
|
||||
return { name: v, voice_id: v, lang: 'en-US' };
|
||||
});
|
||||
}
|
||||
|
||||
async previewTtsVoice(voiceId) {
|
||||
this.audioElement.pause();
|
||||
this.audioElement.currentTime = 0;
|
||||
|
||||
const text = getPreviewString('en-US');
|
||||
const response = await this.fetchTtsGeneration(text, voiceId);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
|
||||
const audio = await response.blob();
|
||||
const url = URL.createObjectURL(audio);
|
||||
this.audioElement.src = url;
|
||||
this.audioElement.play();
|
||||
this.audioElement.onended = () => URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
async fetchTtsGeneration(inputText, voiceId) {
|
||||
console.info(`Generating new TTS for voice_id ${voiceId}`);
|
||||
const response = await fetch('/api/openai/custom/generate-voice', {
|
||||
method: 'POST',
|
||||
headers: getRequestHeaders(),
|
||||
body: JSON.stringify({
|
||||
provider_endpoint: this.settings.provider_endpoint,
|
||||
model: this.settings.model,
|
||||
input: inputText,
|
||||
voice: voiceId,
|
||||
response_format: 'mp3',
|
||||
speed: this.settings.speed,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
toastr.error(response.statusText, 'TTS Generation Failed');
|
||||
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
|
@ -97,9 +97,9 @@ class SystemTtsProvider {
|
|||
|
||||
return `<p>Uses the voices provided by your operating system</p>
|
||||
<label for="system_tts_rate">Rate: <span id="system_tts_rate_output"></span></label>
|
||||
<input id="system_tts_rate" type="range" value="${this.defaultSettings.rate}" min="0.5" max="2" step="0.1" />
|
||||
<input id="system_tts_rate" type="range" value="${this.defaultSettings.rate}" min="0.1" max="2" step="0.01" />
|
||||
<label for="system_tts_pitch">Pitch: <span id="system_tts_pitch_output"></span></label>
|
||||
<input id="system_tts_pitch" type="range" value="${this.defaultSettings.pitch}" min="0" max="2" step="0.1" />`;
|
||||
<input id="system_tts_pitch" type="range" value="${this.defaultSettings.pitch}" min="0" max="2" step="0.01" />`;
|
||||
}
|
||||
|
||||
onSettingsChange() {
|
||||
|
@ -124,7 +124,7 @@ class SystemTtsProvider {
|
|||
if (hasEnabledVoice) {
|
||||
return;
|
||||
}
|
||||
const utterance = new SpeechSynthesisUtterance('hi');
|
||||
const utterance = new SpeechSynthesisUtterance(' . ');
|
||||
utterance.volume = 0;
|
||||
speechSynthesis.speak(utterance);
|
||||
hasEnabledVoice = true;
|
||||
|
@ -147,7 +147,7 @@ class SystemTtsProvider {
|
|||
|
||||
// Trigger updates
|
||||
$('#system_tts_rate').on('input', () => { this.onSettingsChange(); });
|
||||
$('#system_tts_rate').on('input', () => { this.onSettingsChange(); });
|
||||
$('#system_tts_pitch').on('input', () => { this.onSettingsChange(); });
|
||||
|
||||
$('#system_tts_pitch_output').text(this.settings.pitch);
|
||||
$('#system_tts_rate_output').text(this.settings.rate);
|
||||
|
@ -198,8 +198,8 @@ class SystemTtsProvider {
|
|||
const text = getPreviewString(voice.lang);
|
||||
const utterance = new SpeechSynthesisUtterance(text);
|
||||
utterance.voice = voice;
|
||||
utterance.rate = 1;
|
||||
utterance.pitch = 1;
|
||||
utterance.rate = this.settings.rate || 1;
|
||||
utterance.pitch = this.settings.pitch || 1;
|
||||
speechSynthesis.speak(utterance);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,13 @@ import { textgen_types, textgenerationwebui_settings } from '../../textgen-setti
|
|||
import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
|
||||
import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||
import { callGenericPopup, POPUP_RESULT, POPUP_TYPE } from '../../popup.js';
|
||||
import { generateWebLlmChatPrompt, isWebLlmSupported } from '../shared.js';
|
||||
|
||||
/**
|
||||
* @typedef {object} HashedMessage
|
||||
* @property {string} text - The hashed message text
|
||||
*/
|
||||
|
||||
const MODULE_NAME = 'vectors';
|
||||
|
||||
|
@ -191,6 +198,11 @@ function splitByChunks(items) {
|
|||
return chunkedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summarizes messages using the Extras API method.
|
||||
* @param {HashedMessage[]} hashedMessages Array of hashed messages
|
||||
* @returns {Promise<HashedMessage[]>} Summarized messages
|
||||
*/
|
||||
async function summarizeExtra(hashedMessages) {
|
||||
for (const element of hashedMessages) {
|
||||
try {
|
||||
|
@ -222,6 +234,11 @@ async function summarizeExtra(hashedMessages) {
|
|||
return hashedMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summarizes messages using the main API method.
|
||||
* @param {HashedMessage[]} hashedMessages Array of hashed messages
|
||||
* @returns {Promise<HashedMessage[]>} Summarized messages
|
||||
*/
|
||||
async function summarizeMain(hashedMessages) {
|
||||
for (const element of hashedMessages) {
|
||||
element.text = await generateRaw(element.text, '', false, false, settings.summary_prompt);
|
||||
|
@ -230,12 +247,39 @@ async function summarizeMain(hashedMessages) {
|
|||
return hashedMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summarizes messages using WebLLM.
|
||||
* @param {HashedMessage[]} hashedMessages Array of hashed messages
|
||||
* @returns {Promise<HashedMessage[]>} Summarized messages
|
||||
*/
|
||||
async function summarizeWebLLM(hashedMessages) {
|
||||
if (!isWebLlmSupported()) {
|
||||
console.warn('Vectors: WebLLM is not supported');
|
||||
return hashedMessages;
|
||||
}
|
||||
|
||||
for (const element of hashedMessages) {
|
||||
const messages = [{ role:'system', content: settings.summary_prompt }, { role:'user', content: element.text }];
|
||||
element.text = await generateWebLlmChatPrompt(messages);
|
||||
}
|
||||
|
||||
return hashedMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summarizes messages using the chosen method.
|
||||
* @param {HashedMessage[]} hashedMessages Array of hashed messages
|
||||
* @param {string} endpoint Type of endpoint to use
|
||||
* @returns {Promise<HashedMessage[]>} Summarized messages
|
||||
*/
|
||||
async function summarize(hashedMessages, endpoint = 'main') {
|
||||
switch (endpoint) {
|
||||
case 'main':
|
||||
return await summarizeMain(hashedMessages);
|
||||
case 'extras':
|
||||
return await summarizeExtra(hashedMessages);
|
||||
case 'webllm':
|
||||
return await summarizeWebLLM(hashedMessages);
|
||||
default:
|
||||
console.error('Unsupported endpoint', endpoint);
|
||||
}
|
||||
|
@ -357,7 +401,7 @@ async function processFiles(chat) {
|
|||
const dataBankCollectionIds = await ingestDataBankAttachments();
|
||||
|
||||
if (dataBankCollectionIds.length) {
|
||||
const queryText = await getQueryText(chat);
|
||||
const queryText = await getQueryText(chat, 'file');
|
||||
await injectDataBankChunks(queryText, dataBankCollectionIds);
|
||||
}
|
||||
|
||||
|
@ -391,7 +435,7 @@ async function processFiles(chat) {
|
|||
await vectorizeFile(fileText, fileName, collectionId, settings.chunk_size, settings.overlap_percent);
|
||||
}
|
||||
|
||||
const queryText = await getQueryText(chat);
|
||||
const queryText = await getQueryText(chat, 'file');
|
||||
const fileChunks = await retrieveFileChunks(queryText, collectionId);
|
||||
|
||||
message.mes = `${fileChunks}\n\n${message.mes}`;
|
||||
|
@ -552,7 +596,7 @@ async function rearrangeChat(chat) {
|
|||
return;
|
||||
}
|
||||
|
||||
const queryText = await getQueryText(chat);
|
||||
const queryText = await getQueryText(chat, 'chat');
|
||||
|
||||
if (queryText.length === 0) {
|
||||
console.debug('Vectors: No text to query');
|
||||
|
@ -639,15 +683,16 @@ const onChatEvent = debounce(async () => await moduleWorker.update(), debounce_t
|
|||
/**
|
||||
* Gets the text to query from the chat
|
||||
* @param {object[]} chat Chat messages
|
||||
* @param {'file'|'chat'|'world-info'} initiator Initiator of the query
|
||||
* @returns {Promise<string>} Text to query
|
||||
*/
|
||||
async function getQueryText(chat) {
|
||||
async function getQueryText(chat, initiator) {
|
||||
let queryText = '';
|
||||
let i = 0;
|
||||
|
||||
let hashedMessages = chat.map(x => ({ text: String(substituteParams(x.mes)) }));
|
||||
|
||||
if (settings.summarize && settings.summarize_sent) {
|
||||
if (initiator === 'chat' && settings.enabled_chats && settings.summarize && settings.summarize_sent) {
|
||||
hashedMessages = await summarize(hashedMessages, settings.summary_source);
|
||||
}
|
||||
|
||||
|
@ -1235,7 +1280,7 @@ async function activateWorldInfo(chat) {
|
|||
}
|
||||
|
||||
// Perform a multi-query
|
||||
const queryText = await getQueryText(chat);
|
||||
const queryText = await getQueryText(chat, 'world-info');
|
||||
|
||||
if (queryText.length === 0) {
|
||||
console.debug('Vectors: No text to query for WI');
|
||||
|
@ -1299,11 +1344,30 @@ jQuery(async () => {
|
|||
saveSettingsDebounced();
|
||||
toggleSettings();
|
||||
});
|
||||
$('#api_key_nomicai').on('change', () => {
|
||||
const nomicKey = String($('#api_key_nomicai').val()).trim();
|
||||
if (nomicKey.length) {
|
||||
writeSecret(SECRET_KEYS.NOMICAI, nomicKey);
|
||||
$('#api_key_nomicai').on('click', async () => {
|
||||
const popupText = 'NomicAI API Key:';
|
||||
const key = await callGenericPopup(popupText, POPUP_TYPE.INPUT, '', {
|
||||
customButtons: [{
|
||||
text: 'Remove Key',
|
||||
appendAtEnd: true,
|
||||
result: POPUP_RESULT.NEGATIVE,
|
||||
action: async () => {
|
||||
await writeSecret(SECRET_KEYS.NOMICAI, '');
|
||||
toastr.success('API Key removed');
|
||||
$('#api_key_nomicai').toggleClass('success', !!secret_state[SECRET_KEYS.NOMICAI]);
|
||||
saveSettingsDebounced();
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
if (!key) {
|
||||
return;
|
||||
}
|
||||
|
||||
await writeSecret(SECRET_KEYS.NOMICAI, String(key));
|
||||
$('#api_key_nomicai').toggleClass('success', !!secret_state[SECRET_KEYS.NOMICAI]);
|
||||
|
||||
toastr.success('API Key saved');
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
$('#vectors_togetherai_model').val(settings.togetherai_model).on('change', () => {
|
||||
|
@ -1531,9 +1595,7 @@ jQuery(async () => {
|
|||
$('#dialogue_popup_input').val(presetModel);
|
||||
});
|
||||
|
||||
const validSecret = !!secret_state[SECRET_KEYS.NOMICAI];
|
||||
const placeholder = validSecret ? '✔️ Key saved' : '❌ Missing key';
|
||||
$('#api_key_nomicai').attr('placeholder', placeholder);
|
||||
$('#api_key_nomicai').toggleClass('success', !!secret_state[SECRET_KEYS.NOMICAI]);
|
||||
|
||||
toggleSettings();
|
||||
eventSource.on(event_types.MESSAGE_DELETED, onChatEvent);
|
||||
|
|
|
@ -103,17 +103,13 @@
|
|||
</span>
|
||||
</small>
|
||||
|
||||
<div class="flex-container flexFlowColumn" id="nomicai_apiKey">
|
||||
<label for="api_key_nomicai">
|
||||
<div class="flex-container alignItemsCenter" id="nomicai_apiKey">
|
||||
<label for="api_key_nomicai" class="flex1">
|
||||
<span data-i18n="NomicAI API Key">NomicAI API Key</span>
|
||||
</label>
|
||||
<div class="flex-container">
|
||||
<input id="api_key_nomicai" name="api_key_nomicai" class="text_pole flex1 wide100p" maxlength="500" size="35" type="text" autocomplete="off">
|
||||
<div title="Clear your API key" class="menu_button fa-solid fa-circle-xmark clear-api-key" data-key="api_key_nomicai">
|
||||
</div>
|
||||
</div>
|
||||
<div data-for="api_key_nomicai" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you reload the page.">
|
||||
For privacy reasons, your API key will be hidden after you reload the page.
|
||||
<div id="api_key_nomicai" class="menu_button menu_button_icon">
|
||||
<i class="fa-solid fa-key"></i>
|
||||
<span data-i18n="Click to set">Click to set</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -378,10 +374,11 @@
|
|||
<select id="vectors_summary_source" class="text_pole">
|
||||
<option value="main" data-i18n="Main API">Main API</option>
|
||||
<option value="extras" data-i18n="Extras API">Extras API</option>
|
||||
<option value="webllm" data-i18n="WebLLM Extension">WebLLM Extension</option>
|
||||
</select>
|
||||
|
||||
<label for="vectors_summary_prompt" title="Summary Prompt:">Summary Prompt:</label>
|
||||
<small data-i18n="Only used when Main API is selected.">Only used when Main API is selected.</small>
|
||||
<small data-i18n="Only used when Main API or WebLLM Extension is selected.">Only used when Main API or WebLLM Extension is selected.</small>
|
||||
<textarea id="vectors_summary_prompt" class="text_pole textarea_compact" rows="6" placeholder="This prompt will be sent to AI to request the summary generation."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -34,6 +34,8 @@ const controls = [
|
|||
{ id: 'instruct_names_force_groups', property: 'names_force_groups', isCheckbox: true },
|
||||
{ id: 'instruct_first_output_sequence', property: 'first_output_sequence', isCheckbox: false },
|
||||
{ id: 'instruct_last_output_sequence', property: 'last_output_sequence', isCheckbox: false },
|
||||
{ id: 'instruct_first_input_sequence', property: 'first_input_sequence', isCheckbox: false },
|
||||
{ id: 'instruct_last_input_sequence', property: 'last_input_sequence', isCheckbox: false },
|
||||
{ id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },
|
||||
{ id: 'instruct_bind_to_context', property: 'bind_to_context', isCheckbox: true },
|
||||
{ id: 'instruct_skip_examples', property: 'skip_examples', isCheckbox: true },
|
||||
|
@ -58,6 +60,8 @@ function migrateInstructModeSettings(settings) {
|
|||
system_suffix: '',
|
||||
user_alignment_message: '',
|
||||
last_system_sequence: '',
|
||||
first_input_sequence: '',
|
||||
last_input_sequence: '',
|
||||
names_force_groups: true,
|
||||
skip_examples: false,
|
||||
system_same_as_user: false,
|
||||
|
@ -90,11 +94,11 @@ export function loadInstructMode(data) {
|
|||
$element.val(power_user.instruct[control.property]);
|
||||
}
|
||||
|
||||
$element.on('input', function () {
|
||||
$element.on('input', async function () {
|
||||
power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this).val();
|
||||
saveSettingsDebounced();
|
||||
if (!control.isCheckbox) {
|
||||
resetScrollHeight($element);
|
||||
await resetScrollHeight($element);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -253,7 +257,15 @@ export function getInstructStoppingSequences() {
|
|||
const system_sequence = power_user.instruct.system_sequence?.replace(/{{name}}/gi, 'System') || '';
|
||||
const last_system_sequence = power_user.instruct.last_system_sequence?.replace(/{{name}}/gi, 'System') || '';
|
||||
|
||||
const combined_sequence = `${stop_sequence}\n${input_sequence}\n${output_sequence}\n${first_output_sequence}\n${last_output_sequence}\n${system_sequence}\n${last_system_sequence}`;
|
||||
const combined_sequence = [
|
||||
stop_sequence,
|
||||
input_sequence,
|
||||
output_sequence,
|
||||
first_output_sequence,
|
||||
last_output_sequence,
|
||||
system_sequence,
|
||||
last_system_sequence,
|
||||
].join('\n');
|
||||
|
||||
combined_sequence.split('\n').filter((line, index, self) => self.indexOf(line) === index).forEach(addInstructSequence);
|
||||
}
|
||||
|
@ -301,6 +313,14 @@ export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvata
|
|||
}
|
||||
|
||||
if (isUser) {
|
||||
if (forceOutputSequence === force_output_sequence.FIRST) {
|
||||
return power_user.instruct.first_input_sequence || power_user.instruct.input_sequence;
|
||||
}
|
||||
|
||||
if (forceOutputSequence === force_output_sequence.LAST) {
|
||||
return power_user.instruct.last_input_sequence || power_user.instruct.input_sequence;
|
||||
}
|
||||
|
||||
return power_user.instruct.input_sequence;
|
||||
}
|
||||
|
||||
|
@ -552,6 +572,8 @@ export function replaceInstructMacros(input, env) {
|
|||
'instructStop': power_user.instruct.stop_sequence,
|
||||
'instructUserFiller': power_user.instruct.user_alignment_message,
|
||||
'instructSystemInstructionPrefix': power_user.instruct.last_system_sequence,
|
||||
'instructFirstInput|instructFirstUserPrefix': power_user.instruct.first_input_sequence || power_user.instruct.input_sequence,
|
||||
'instructLastInput|instructLastUserPrefix': power_user.instruct.last_input_sequence || power_user.instruct.input_sequence,
|
||||
};
|
||||
|
||||
for (const [placeholder, value] of Object.entries(instructMacros)) {
|
||||
|
|
|
@ -120,6 +120,7 @@ const default_bias_presets = {
|
|||
const max_2k = 2047;
|
||||
const max_4k = 4095;
|
||||
const max_8k = 8191;
|
||||
const max_12k = 12287;
|
||||
const max_16k = 16383;
|
||||
const max_32k = 32767;
|
||||
const max_64k = 65535;
|
||||
|
@ -127,6 +128,7 @@ const max_128k = 128 * 1000;
|
|||
const max_200k = 200 * 1000;
|
||||
const max_256k = 256 * 1000;
|
||||
const max_1mil = 1000 * 1000;
|
||||
const max_2mil = 2000 * 1000;
|
||||
const scale_max = 8191;
|
||||
const claude_max = 9000; // We have a proper tokenizer, so theoretically could be larger (up to 9k)
|
||||
const claude_100k_max = 99000;
|
||||
|
@ -185,10 +187,12 @@ export const chat_completion_sources = {
|
|||
PERPLEXITY: 'perplexity',
|
||||
GROQ: 'groq',
|
||||
ZEROONEAI: '01ai',
|
||||
BLOCKENTROPY: 'blockentropy',
|
||||
};
|
||||
|
||||
const character_names_behavior = {
|
||||
NONE: 0,
|
||||
NONE: -1,
|
||||
DEFAULT: 0,
|
||||
COMPLETION: 1,
|
||||
CONTENT: 2,
|
||||
};
|
||||
|
@ -236,7 +240,7 @@ const default_settings = {
|
|||
top_p_openai: 1.0,
|
||||
top_k_openai: 0,
|
||||
min_p_openai: 0,
|
||||
top_a_openai: 1,
|
||||
top_a_openai: 0,
|
||||
repetition_penalty_openai: 1,
|
||||
stream_openai: false,
|
||||
websearch_cohere: false,
|
||||
|
@ -257,15 +261,16 @@ const default_settings = {
|
|||
group_nudge_prompt: default_group_nudge_prompt,
|
||||
scenario_format: default_scenario_format,
|
||||
personality_format: default_personality_format,
|
||||
openai_model: 'gpt-3.5-turbo',
|
||||
claude_model: 'claude-2.1',
|
||||
google_model: 'gemini-pro',
|
||||
openai_model: 'gpt-4-turbo',
|
||||
claude_model: 'claude-3-5-sonnet-20240620',
|
||||
google_model: 'gemini-1.5-pro',
|
||||
ai21_model: 'j2-ultra',
|
||||
mistralai_model: 'mistral-medium-latest',
|
||||
cohere_model: 'command-r',
|
||||
perplexity_model: 'llama-3-70b-instruct',
|
||||
groq_model: 'llama3-70b-8192',
|
||||
mistralai_model: 'mistral-large-latest',
|
||||
cohere_model: 'command-r-plus',
|
||||
perplexity_model: 'llama-3.1-70b-instruct',
|
||||
groq_model: 'llama-3.1-70b-versatile',
|
||||
zerooneai_model: 'yi-large',
|
||||
blockentropy_model: 'be-70b-base-llama3.1',
|
||||
custom_model: '',
|
||||
custom_url: '',
|
||||
custom_include_body: '',
|
||||
|
@ -300,7 +305,7 @@ const default_settings = {
|
|||
bypass_status_check: false,
|
||||
continue_prefill: false,
|
||||
function_calling: false,
|
||||
names_behavior: character_names_behavior.NONE,
|
||||
names_behavior: character_names_behavior.DEFAULT,
|
||||
continue_postfix: continue_postfix_types.SPACE,
|
||||
custom_prompt_post_processing: custom_prompt_post_processing_types.NONE,
|
||||
seed: -1,
|
||||
|
@ -316,7 +321,7 @@ const oai_settings = {
|
|||
top_p_openai: 1.0,
|
||||
top_k_openai: 0,
|
||||
min_p_openai: 0,
|
||||
top_a_openai: 1,
|
||||
top_a_openai: 0,
|
||||
repetition_penalty_openai: 1,
|
||||
stream_openai: false,
|
||||
websearch_cohere: false,
|
||||
|
@ -337,15 +342,16 @@ const oai_settings = {
|
|||
group_nudge_prompt: default_group_nudge_prompt,
|
||||
scenario_format: default_scenario_format,
|
||||
personality_format: default_personality_format,
|
||||
openai_model: 'gpt-3.5-turbo',
|
||||
claude_model: 'claude-2.1',
|
||||
google_model: 'gemini-pro',
|
||||
openai_model: 'gpt-4-turbo',
|
||||
claude_model: 'claude-3-5-sonnet-20240620',
|
||||
google_model: 'gemini-1.5-pro',
|
||||
ai21_model: 'j2-ultra',
|
||||
mistralai_model: 'mistral-medium-latest',
|
||||
cohere_model: 'command-r',
|
||||
perplexity_model: 'llama-3-70b-instruct',
|
||||
groq_model: 'llama3-70b-8192',
|
||||
mistralai_model: 'mistral-large-latest',
|
||||
cohere_model: 'command-r-plus',
|
||||
perplexity_model: 'llama-3.1-70b-instruct',
|
||||
groq_model: 'llama-3.1-70b-versatile',
|
||||
zerooneai_model: 'yi-large',
|
||||
blockentropy_model: 'be-70b-base-llama3.1',
|
||||
custom_model: '',
|
||||
custom_url: '',
|
||||
custom_include_body: '',
|
||||
|
@ -380,7 +386,7 @@ const oai_settings = {
|
|||
bypass_status_check: false,
|
||||
continue_prefill: false,
|
||||
function_calling: false,
|
||||
names_behavior: character_names_behavior.NONE,
|
||||
names_behavior: character_names_behavior.DEFAULT,
|
||||
continue_postfix: continue_postfix_types.SPACE,
|
||||
custom_prompt_post_processing: custom_prompt_post_processing_types.NONE,
|
||||
seed: -1,
|
||||
|
@ -554,6 +560,8 @@ function setOpenAIMessages(chat) {
|
|||
// for groups or sendas command - prepend a character's name
|
||||
switch (oai_settings.names_behavior) {
|
||||
case character_names_behavior.NONE:
|
||||
break;
|
||||
case character_names_behavior.DEFAULT:
|
||||
if (selected_group || (chat[j].force_avatar && chat[j].name !== name1 && chat[j].extra?.type !== system_message_types.NARRATOR)) {
|
||||
content = `${chat[j].name}: ${content}`;
|
||||
}
|
||||
|
@ -563,8 +571,9 @@ function setOpenAIMessages(chat) {
|
|||
content = `${chat[j].name}: ${content}`;
|
||||
}
|
||||
break;
|
||||
case character_names_behavior.COMPLETION:
|
||||
break;
|
||||
default:
|
||||
// No action for character_names_behavior.COMPLETION
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -799,7 +808,8 @@ async function populateChatHistory(messages, prompts, chatCompletion, type = nul
|
|||
|
||||
// Reserve budget for group nudge
|
||||
let groupNudgeMessage = null;
|
||||
if (selected_group) {
|
||||
const noGroupNudgeTypes = ['impersonate'];
|
||||
if (selected_group && prompts.has('groupNudge') && !noGroupNudgeTypes.includes(type)) {
|
||||
groupNudgeMessage = Message.fromPrompt(prompts.get('groupNudge'));
|
||||
chatCompletion.reserveBudget(groupNudgeMessage);
|
||||
}
|
||||
|
@ -1537,6 +1547,8 @@ function getChatCompletionModel() {
|
|||
return oai_settings.groq_model;
|
||||
case chat_completion_sources.ZEROONEAI:
|
||||
return oai_settings.zerooneai_model;
|
||||
case chat_completion_sources.BLOCKENTROPY:
|
||||
return oai_settings.blockentropy_model;
|
||||
default:
|
||||
throw new Error(`Unknown chat completion source: ${oai_settings.chat_completion_source}`);
|
||||
}
|
||||
|
@ -1650,6 +1662,23 @@ function saveModelList(data) {
|
|||
|
||||
$('#model_01ai_select').val(oai_settings.zerooneai_model).trigger('change');
|
||||
}
|
||||
|
||||
if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) {
|
||||
$('#model_blockentropy_select').empty();
|
||||
model_list.forEach((model) => {
|
||||
$('#model_blockentropy_select').append(
|
||||
$('<option>', {
|
||||
value: model.id,
|
||||
text: model.id,
|
||||
}));
|
||||
});
|
||||
|
||||
if (!oai_settings.blockentropy_model && model_list.length > 0) {
|
||||
oai_settings.blockentropy_model = model_list[0].id;
|
||||
}
|
||||
|
||||
$('#model_blockentropy_select').val(oai_settings.blockentropy_model).trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
function appendOpenRouterOptions(model_list, groupModels = false, sort = false) {
|
||||
|
@ -3010,6 +3039,7 @@ function loadOpenAISettings(data, settings) {
|
|||
oai_settings.cohere_model = settings.cohere_model ?? default_settings.cohere_model;
|
||||
oai_settings.perplexity_model = settings.perplexity_model ?? default_settings.perplexity_model;
|
||||
oai_settings.groq_model = settings.groq_model ?? default_settings.groq_model;
|
||||
oai_settings.blockentropy_model = settings.blockentropy_model ?? default_settings.blockentropy_model;
|
||||
oai_settings.zerooneai_model = settings.zerooneai_model ?? default_settings.zerooneai_model;
|
||||
oai_settings.custom_model = settings.custom_model ?? default_settings.custom_model;
|
||||
oai_settings.custom_url = settings.custom_url ?? default_settings.custom_url;
|
||||
|
@ -3043,6 +3073,7 @@ function loadOpenAISettings(data, settings) {
|
|||
oai_settings.names_behavior = settings.names_behavior ?? default_settings.names_behavior;
|
||||
oai_settings.continue_postfix = settings.continue_postfix ?? default_settings.continue_postfix;
|
||||
oai_settings.function_calling = settings.function_calling ?? default_settings.function_calling;
|
||||
oai_settings.openrouter_providers = settings.openrouter_providers ?? default_settings.openrouter_providers;
|
||||
|
||||
// Migrate from old settings
|
||||
if (settings.names_in_completion === true) {
|
||||
|
@ -3088,6 +3119,7 @@ function loadOpenAISettings(data, settings) {
|
|||
$('#model_groq_select').val(oai_settings.groq_model);
|
||||
$(`#model_groq_select option[value="${oai_settings.groq_model}"`).attr('selected', true);
|
||||
$('#model_01ai_select').val(oai_settings.zerooneai_model);
|
||||
$('#model_blockentropy_select').val(oai_settings.blockentropy_model);
|
||||
$('#custom_model_id').val(oai_settings.custom_model);
|
||||
$('#custom_api_url_text').val(oai_settings.custom_url);
|
||||
$('#openai_max_context').val(oai_settings.openai_max_context);
|
||||
|
@ -3189,6 +3221,9 @@ function setNamesBehaviorControls() {
|
|||
case character_names_behavior.NONE:
|
||||
$('#character_names_none').prop('checked', true);
|
||||
break;
|
||||
case character_names_behavior.DEFAULT:
|
||||
$('#character_names_default').prop('checked', true);
|
||||
break;
|
||||
case character_names_behavior.COMPLETION:
|
||||
$('#character_names_completion').prop('checked', true);
|
||||
break;
|
||||
|
@ -3346,6 +3381,7 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) {
|
|||
perplexity_model: settings.perplexity_model,
|
||||
groq_model: settings.groq_model,
|
||||
zerooneai_model: settings.zerooneai_model,
|
||||
blockentropy_model: settings.blockentropy_model,
|
||||
custom_model: settings.custom_model,
|
||||
custom_url: settings.custom_url,
|
||||
custom_include_body: settings.custom_include_body,
|
||||
|
@ -3588,6 +3624,8 @@ async function onPresetImportFileChange(e) {
|
|||
}
|
||||
}
|
||||
|
||||
await eventSource.emit(event_types.OAI_PRESET_IMPORT_READY, { data: presetBody, presetName: name });
|
||||
|
||||
const savePresetSettings = await fetch(`/api/presets/save-openai?name=${name}`, {
|
||||
method: 'POST',
|
||||
headers: getRequestHeaders(),
|
||||
|
@ -3643,6 +3681,7 @@ async function onExportPresetClick() {
|
|||
sensitiveFields.forEach(field => delete preset[field]);
|
||||
}
|
||||
|
||||
await eventSource.emit(event_types.OAI_PRESET_EXPORT_READY, preset);
|
||||
const presetJsonString = JSON.stringify(preset, null, 4);
|
||||
const presetFileName = `${oai_settings.preset_settings_openai}.json`;
|
||||
download(presetJsonString, presetFileName, 'application/json');
|
||||
|
@ -3783,6 +3822,7 @@ function onSettingsPresetChange() {
|
|||
perplexity_model: ['#model_perplexity_select', 'perplexity_model', false],
|
||||
groq_model: ['#model_groq_select', 'groq_model', false],
|
||||
zerooneai_model: ['#model_01ai_select', 'zerooneai_model', false],
|
||||
blockentropy_model: ['#model_blockentropy_select', 'blockentropy_model', false],
|
||||
custom_model: ['#custom_model_id', 'custom_model', false],
|
||||
custom_url: ['#custom_api_url_text', 'custom_url', false],
|
||||
custom_include_body: ['#custom_include_body', 'custom_include_body', false],
|
||||
|
@ -3881,7 +3921,7 @@ function getMaxContextOpenAI(value) {
|
|||
if (oai_settings.max_context_unlocked) {
|
||||
return unlocked_max;
|
||||
}
|
||||
else if (value.includes('gpt-4-turbo') || value.includes('gpt-4o') || value.includes('gpt-4-1106') || value.includes('gpt-4-0125') || value.includes('gpt-4-vision')) {
|
||||
else if (value.includes('chatgpt-4o-latest') || value.includes('gpt-4-turbo') || value.includes('gpt-4o') || value.includes('gpt-4-1106') || value.includes('gpt-4-0125') || value.includes('gpt-4-vision')) {
|
||||
return max_128k;
|
||||
}
|
||||
else if (value.includes('gpt-3.5-turbo-1106')) {
|
||||
|
@ -4030,6 +4070,12 @@ async function onModelChange() {
|
|||
oai_settings.zerooneai_model = value;
|
||||
}
|
||||
|
||||
if (value && $(this).is('#model_blockentropy_select')) {
|
||||
console.log('Block Entropy model changed to', value);
|
||||
oai_settings.blockentropy_model = value;
|
||||
$('#blockentropy_model_id').val(value).trigger('input');
|
||||
}
|
||||
|
||||
if (value && $(this).is('#model_custom_select')) {
|
||||
console.log('Custom model changed to', value);
|
||||
oai_settings.custom_model = value;
|
||||
|
@ -4049,18 +4095,26 @@ async function onModelChange() {
|
|||
|
||||
if (oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) {
|
||||
if (oai_settings.max_context_unlocked) {
|
||||
$('#openai_max_context').attr('max', max_2mil);
|
||||
} else if (value.includes('gemini-1.5-pro')) {
|
||||
$('#openai_max_context').attr('max', max_2mil);
|
||||
} else if (value.includes('gemini-1.5-flash')) {
|
||||
$('#openai_max_context').attr('max', max_1mil);
|
||||
} else if (value === 'gemini-1.5-pro-latest' || value.includes('gemini-1.5-flash')) {
|
||||
$('#openai_max_context').attr('max', max_1mil);
|
||||
} else if (value === 'gemini-ultra' || value === 'gemini-1.0-pro-latest' || value === 'gemini-pro' || value === 'gemini-1.0-ultra-latest') {
|
||||
$('#openai_max_context').attr('max', max_32k);
|
||||
} else if (value === 'gemini-1.0-pro-vision-latest' || value === 'gemini-pro-vision') {
|
||||
} else if (value.includes('gemini-1.0-pro-vision') || value === 'gemini-pro-vision') {
|
||||
$('#openai_max_context').attr('max', max_16k);
|
||||
} else {
|
||||
} else if (value.includes('gemini-1.0-pro') || value === 'gemini-pro') {
|
||||
$('#openai_max_context').attr('max', max_32k);
|
||||
} else if (value === 'text-bison-001') {
|
||||
$('#openai_max_context').attr('max', max_8k);
|
||||
// The ultra endpoints are possibly dead:
|
||||
} else if (value.includes('gemini-1.0-ultra') || value === 'gemini-ultra') {
|
||||
$('#openai_max_context').attr('max', max_32k);
|
||||
} else {
|
||||
$('#openai_max_context').attr('max', max_4k);
|
||||
}
|
||||
oai_settings.temp_openai = Math.min(claude_max_temp, oai_settings.temp_openai);
|
||||
$('#temp_openai').attr('max', claude_max_temp).val(oai_settings.temp_openai).trigger('input');
|
||||
let makersuite_max_temp = (value.includes('vision') || value.includes('ultra')) ? 1.0 : 2.0;
|
||||
oai_settings.temp_openai = Math.min(makersuite_max_temp, oai_settings.temp_openai);
|
||||
$('#temp_openai').attr('max', makersuite_max_temp).val(oai_settings.temp_openai).trigger('input');
|
||||
oai_settings.openai_max_context = Math.min(Number($('#openai_max_context').attr('max')), oai_settings.openai_max_context);
|
||||
$('#openai_max_context').val(oai_settings.openai_max_context).trigger('input');
|
||||
}
|
||||
|
@ -4149,6 +4203,8 @@ async function onModelChange() {
|
|||
$('#openai_max_context').attr('max', unlocked_max);
|
||||
} else if (oai_settings.mistralai_model.includes('codestral-mamba')) {
|
||||
$('#openai_max_context').attr('max', max_256k);
|
||||
} else if (['mistral-large-2407', 'mistral-large-latest'].includes(oai_settings.mistralai_model)) {
|
||||
$('#openai_max_context').attr('max', max_128k);
|
||||
} else if (oai_settings.mistralai_model.includes('mistral-nemo')) {
|
||||
$('#openai_max_context').attr('max', max_128k);
|
||||
} else if (oai_settings.mistralai_model.includes('mixtral-8x22b')) {
|
||||
|
@ -4192,6 +4248,11 @@ async function onModelChange() {
|
|||
if (oai_settings.max_context_unlocked) {
|
||||
$('#openai_max_context').attr('max', unlocked_max);
|
||||
}
|
||||
else if (oai_settings.perplexity_model.includes('llama-3.1')) {
|
||||
const isOnline = oai_settings.perplexity_model.includes('online');
|
||||
const contextSize = isOnline ? 128 * 1024 - 4000 : 128 * 1024;
|
||||
$('#openai_max_context').attr('max', contextSize);
|
||||
}
|
||||
else if (['llama-3-sonar-small-32k-chat', 'llama-3-sonar-large-32k-chat'].includes(oai_settings.perplexity_model)) {
|
||||
$('#openai_max_context').attr('max', max_32k);
|
||||
}
|
||||
|
@ -4283,9 +4344,42 @@ async function onModelChange() {
|
|||
if (oai_settings.chat_completion_source === chat_completion_sources.ZEROONEAI) {
|
||||
if (oai_settings.max_context_unlocked) {
|
||||
$('#openai_max_context').attr('max', unlocked_max);
|
||||
} else {
|
||||
}
|
||||
else if (['yi-large'].includes(oai_settings.zerooneai_model)) {
|
||||
$('#openai_max_context').attr('max', max_32k);
|
||||
}
|
||||
else if (['yi-vision'].includes(oai_settings.zerooneai_model)) {
|
||||
$('#openai_max_context').attr('max', max_16k);
|
||||
}
|
||||
else if (['yi-large-turbo'].includes(oai_settings.zerooneai_model)) {
|
||||
$('#openai_max_context').attr('max', max_4k);
|
||||
}
|
||||
else {
|
||||
$('#openai_max_context').attr('max', max_16k);
|
||||
}
|
||||
|
||||
oai_settings.openai_max_context = Math.min(oai_settings.openai_max_context, Number($('#openai_max_context').attr('max')));
|
||||
$('#openai_max_context').val(oai_settings.openai_max_context).trigger('input');
|
||||
|
||||
oai_settings.temp_openai = Math.min(oai_max_temp, oai_settings.temp_openai);
|
||||
$('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input');
|
||||
}
|
||||
if (oai_settings.chat_completion_source === chat_completion_sources.BLOCKENTROPY) {
|
||||
if (oai_settings.max_context_unlocked) {
|
||||
$('#openai_max_context').attr('max', unlocked_max);
|
||||
}
|
||||
else if (oai_settings.blockentropy_model.includes('llama3.1')) {
|
||||
$('#openai_max_context').attr('max', max_16k);
|
||||
}
|
||||
else if (oai_settings.blockentropy_model.includes('72b')) {
|
||||
$('#openai_max_context').attr('max', max_16k);
|
||||
}
|
||||
else if (oai_settings.blockentropy_model.includes('120b')) {
|
||||
$('#openai_max_context').attr('max', max_12k);
|
||||
}
|
||||
else {
|
||||
$('#openai_max_context').attr('max', max_8k);
|
||||
}
|
||||
|
||||
oai_settings.openai_max_context = Math.min(oai_settings.openai_max_context, Number($('#openai_max_context').attr('max')));
|
||||
$('#openai_max_context').val(oai_settings.openai_max_context).trigger('input');
|
||||
|
@ -4500,6 +4594,18 @@ async function onConnectButtonClick(e) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) {
|
||||
const api_key_blockentropy = String($('#api_key_blockentropy').val()).trim();
|
||||
|
||||
if (api_key_blockentropy.length) {
|
||||
await writeSecret(SECRET_KEYS.BLOCKENTROPY, api_key_blockentropy);
|
||||
}
|
||||
|
||||
if (!secret_state[SECRET_KEYS.BLOCKENTROPY]) {
|
||||
console.log('No secret key saved for Block Entropy');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
startStatusLoading();
|
||||
saveSettingsDebounced();
|
||||
|
@ -4551,6 +4657,9 @@ function toggleChatCompletionForms() {
|
|||
else if (oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) {
|
||||
$('#model_custom_select').trigger('change');
|
||||
}
|
||||
else if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) {
|
||||
$('#model_blockentropy_select').trigger('change');
|
||||
}
|
||||
$('[data-source]').each(function () {
|
||||
const validSources = $(this).data('source').split(',');
|
||||
$(this).toggle(validSources.includes(oai_settings.chat_completion_source));
|
||||
|
@ -4640,16 +4749,22 @@ export function isImageInliningSupported() {
|
|||
// gultra just isn't being offered as multimodal, thanks google.
|
||||
const visionSupportedModels = [
|
||||
'gpt-4-vision',
|
||||
'gemini-1.5-flash-latest',
|
||||
'gemini-1.5-flash',
|
||||
'gemini-1.5-flash-latest',
|
||||
'gemini-1.5-flash-001',
|
||||
'gemini-1.0-pro-vision-latest',
|
||||
'gemini-1.5-pro',
|
||||
'gemini-1.5-pro-latest',
|
||||
'gemini-1.5-pro-001',
|
||||
'gemini-1.5-pro-exp-0801',
|
||||
'gemini-pro-vision',
|
||||
'claude-3',
|
||||
'claude-3-5',
|
||||
'gpt-4-turbo',
|
||||
'gpt-4o',
|
||||
'gpt-4o-mini',
|
||||
'chatgpt-4o-latest',
|
||||
'yi-vision',
|
||||
];
|
||||
|
||||
switch (oai_settings.chat_completion_source) {
|
||||
|
@ -4663,6 +4778,8 @@ export function isImageInliningSupported() {
|
|||
return !oai_settings.openrouter_force_instruct;
|
||||
case chat_completion_sources.CUSTOM:
|
||||
return true;
|
||||
case chat_completion_sources.ZEROONEAI:
|
||||
return visionSupportedModels.some(model => oai_settings.zerooneai_model.includes(model));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -5182,6 +5299,12 @@ $(document).ready(async function () {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#character_names_default').on('input', function () {
|
||||
oai_settings.names_behavior = character_names_behavior.DEFAULT;
|
||||
setNamesBehaviorControls();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#character_names_completion').on('input', function () {
|
||||
oai_settings.names_behavior = character_names_behavior.COMPLETION;
|
||||
setNamesBehaviorControls();
|
||||
|
@ -5267,6 +5390,7 @@ $(document).ready(async function () {
|
|||
$('#model_perplexity_select').on('change', onModelChange);
|
||||
$('#model_groq_select').on('change', onModelChange);
|
||||
$('#model_01ai_select').on('change', onModelChange);
|
||||
$('#model_blockentropy_select').on('change', onModelChange);
|
||||
$('#model_custom_select').on('change', onModelChange);
|
||||
$('#settings_preset_openai').on('change', onSettingsPresetChange);
|
||||
$('#new_oai_preset').on('click', onNewPresetClick);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {
|
||||
callPopup,
|
||||
characters,
|
||||
chat,
|
||||
chat_metadata,
|
||||
|
@ -22,7 +21,7 @@ import { PAGINATION_TEMPLATE, debounce, delay, download, ensureImageFormatSuppor
|
|||
import { debounce_timeout } from './constants.js';
|
||||
import { FILTER_TYPES, FilterHelper } from './filters.js';
|
||||
import { selected_group } from './group-chats.js';
|
||||
import { POPUP_TYPE, Popup } from './popup.js';
|
||||
import { POPUP_RESULT, POPUP_TYPE, Popup } from './popup.js';
|
||||
|
||||
let savePersonasPage = 0;
|
||||
const GRID_STORAGE_KEY = 'Personas_GridView';
|
||||
|
@ -332,15 +331,14 @@ async function changeUserAvatar(e) {
|
|||
* @returns {Promise} Promise that resolves when the persona is set
|
||||
*/
|
||||
export async function createPersona(avatarId) {
|
||||
const personaName = await callPopup('<h3>Enter a name for this persona:</h3>Cancel if you\'re just uploading an avatar.', 'input', '');
|
||||
const personaName = await Popup.show.input('Enter a name for this persona:', 'Cancel if you\'re just uploading an avatar.', '');
|
||||
|
||||
if (!personaName) {
|
||||
console.debug('User cancelled creating a persona');
|
||||
return;
|
||||
}
|
||||
|
||||
await delay(500);
|
||||
const personaDescription = await callPopup('<h3>Enter a description for this persona:</h3>You can always add or change it later.', 'input', '', { rows: 4 });
|
||||
const personaDescription = await Popup.show.input('Enter a description for this persona:', 'You can always add or change it later.', '', { rows: 4 });
|
||||
|
||||
initPersona(avatarId, personaName, personaDescription);
|
||||
if (power_user.persona_show_notifications) {
|
||||
|
@ -349,7 +347,7 @@ export async function createPersona(avatarId) {
|
|||
}
|
||||
|
||||
async function createDummyPersona() {
|
||||
const personaName = await callPopup('<h3>Enter a name for this persona:</h3>', 'input', '');
|
||||
const personaName = await Popup.show.input('Enter a name for this persona:', null);
|
||||
|
||||
if (!personaName) {
|
||||
console.debug('User cancelled creating dummy persona');
|
||||
|
@ -508,15 +506,20 @@ async function bindUserNameToPersona(e) {
|
|||
return;
|
||||
}
|
||||
|
||||
let personaUnbind = false;
|
||||
const existingPersona = power_user.personas[avatarId];
|
||||
const personaName = await callPopup('<h3>Enter a name for this persona:</h3>(If empty name is provided, this will unbind the name from this avatar)', 'input', existingPersona || '');
|
||||
const personaName = await Popup.show.input(
|
||||
'Enter a name for this persona:',
|
||||
'(If empty name is provided, this will unbind the name from this avatar)',
|
||||
existingPersona || '',
|
||||
{ onClose: (p) => { personaUnbind = p.value === '' && p.result === POPUP_RESULT.AFFIRMATIVE; } });
|
||||
|
||||
// If the user clicked cancel, don't do anything
|
||||
if (personaName === false) {
|
||||
if (personaName === null && !personaUnbind) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (personaName.length > 0) {
|
||||
if (personaName && personaName.length > 0) {
|
||||
// If the user clicked ok and entered a name, bind the name to the persona
|
||||
console.log(`Binding persona ${avatarId} to name ${personaName}`);
|
||||
power_user.personas[avatarId] = personaName;
|
||||
|
@ -643,7 +646,12 @@ async function lockPersona() {
|
|||
);
|
||||
}
|
||||
power_user.personas[user_avatar] = name1;
|
||||
power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.IN_PROMPT };
|
||||
power_user.persona_descriptions[user_avatar] = {
|
||||
description: '',
|
||||
position: persona_description_positions.IN_PROMPT,
|
||||
depth: DEFAULT_DEPTH,
|
||||
role: DEFAULT_ROLE,
|
||||
};
|
||||
}
|
||||
|
||||
chat_metadata['persona'] = user_avatar;
|
||||
|
@ -672,7 +680,7 @@ async function deleteUserAvatar(e) {
|
|||
return;
|
||||
}
|
||||
|
||||
const confirm = await callPopup('<h3>Are you sure you want to delete this avatar?</h3>All information associated with its linked persona will be lost.', 'confirm');
|
||||
const confirm = await Popup.show.confirm('Are you sure you want to delete this avatar?', 'All information associated with its linked persona will be lost.');
|
||||
|
||||
if (!confirm) {
|
||||
console.debug('User cancelled deleting avatar');
|
||||
|
@ -806,7 +814,7 @@ async function setDefaultPersona(e) {
|
|||
const personaName = power_user.personas[avatarId];
|
||||
|
||||
if (avatarId === currentDefault) {
|
||||
const confirm = await callPopup('Are you sure you want to remove the default persona?', 'confirm');
|
||||
const confirm = await Popup.show.confirm('Are you sure you want to remove the default persona?', personaName);
|
||||
|
||||
if (!confirm) {
|
||||
console.debug('User cancelled removing default persona');
|
||||
|
@ -819,8 +827,7 @@ async function setDefaultPersona(e) {
|
|||
}
|
||||
delete power_user.default_persona;
|
||||
} else {
|
||||
const confirm = await callPopup(`<h3>Are you sure you want to set "${personaName}" as the default persona?</h3>
|
||||
This name and avatar will be used for all new chats, as well as existing chats where the user persona is not locked.`, 'confirm');
|
||||
const confirm = await Popup.show.confirm(`Are you sure you want to set "${personaName}" as the default persona?`, 'This name and avatar will be used for all new chats, as well as existing chats where the user persona is not locked.');
|
||||
|
||||
if (!confirm) {
|
||||
console.debug('User cancelled setting default persona');
|
||||
|
@ -978,7 +985,7 @@ async function onPersonasRestoreInput(e) {
|
|||
}
|
||||
|
||||
async function syncUserNameToPersona() {
|
||||
const confirmation = await callPopup(`<h3>Are you sure?</h3>All user-sent messages in this chat will be attributed to ${name1}.`, 'confirm');
|
||||
const confirmation = await Popup.show.confirm('Are you sure?', `All user-sent messages in this chat will be attributed to ${name1}.`);
|
||||
|
||||
if (!confirmation) {
|
||||
return;
|
||||
|
@ -1001,6 +1008,42 @@ export function retriggerFirstMessageOnEmptyChat() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates a persona.
|
||||
* @param {string} avatarId
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function duplicatePersona(avatarId) {
|
||||
const personaName = power_user.personas[avatarId];
|
||||
|
||||
if (!personaName) {
|
||||
toastr.warning('Chosen avatar is not a persona');
|
||||
return;
|
||||
}
|
||||
|
||||
const confirm = await Popup.show.confirm('Are you sure you want to duplicate this persona?', personaName);
|
||||
|
||||
if (!confirm) {
|
||||
console.debug('User cancelled duplicating persona');
|
||||
return;
|
||||
}
|
||||
|
||||
const newAvatarId = `${Date.now()}-${personaName.replace(/[^a-zA-Z0-9]/g, '')}.png`;
|
||||
const descriptor = power_user.persona_descriptions[avatarId];
|
||||
|
||||
power_user.personas[newAvatarId] = personaName;
|
||||
power_user.persona_descriptions[newAvatarId] = {
|
||||
description: descriptor?.description ?? '',
|
||||
position: descriptor?.position ?? persona_description_positions.IN_PROMPT,
|
||||
depth: descriptor?.depth ?? DEFAULT_DEPTH,
|
||||
role: descriptor?.role ?? DEFAULT_ROLE,
|
||||
};
|
||||
|
||||
await uploadUserAvatar(getUserAvatar(avatarId), newAvatarId);
|
||||
await getUserAvatars(true, newAvatarId);
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
export function initPersonas() {
|
||||
$(document).on('click', '.bind_user_name', bindUserNameToPersona);
|
||||
$(document).on('click', '.set_default_persona', setDefaultPersona);
|
||||
|
@ -1059,6 +1102,18 @@ export function initPersonas() {
|
|||
$('#avatar_upload_file').trigger('click');
|
||||
});
|
||||
|
||||
$(document).on('click', '#user_avatar_block .duplicate_persona', function (e) {
|
||||
e.stopPropagation();
|
||||
const avatarId = $(this).closest('.avatar-container').find('.avatar').attr('imgfile');
|
||||
|
||||
if (!avatarId) {
|
||||
console.log('no imgfile');
|
||||
return;
|
||||
}
|
||||
|
||||
duplicatePersona(avatarId);
|
||||
});
|
||||
|
||||
$(document).on('click', '#user_avatar_block .set_persona_image', function (e) {
|
||||
e.stopPropagation();
|
||||
const avatarId = $(this).closest('.avatar-container').find('.avatar').attr('imgfile');
|
||||
|
|
|
@ -73,8 +73,8 @@ const showPopupHelper = {
|
|||
/**
|
||||
* Asynchronously displays an input popup with the given header and text, and returns the user's input.
|
||||
*
|
||||
* @param {string} header - The header text for the popup.
|
||||
* @param {string} text - The main text for the popup.
|
||||
* @param {string?} header - The header text for the popup.
|
||||
* @param {string?} text - The main text for the popup.
|
||||
* @param {string} [defaultValue=''] - The default value for the input field.
|
||||
* @param {PopupOptions} [popupOptions={}] - Options for the popup.
|
||||
* @return {Promise<string?>} A Promise that resolves with the user's input.
|
||||
|
@ -101,6 +101,21 @@ const showPopupHelper = {
|
|||
if (typeof result === 'string' || typeof result === 'boolean') throw new Error(`Invalid popup result. CONFIRM popups only support numbers, or null. Result: ${result}`);
|
||||
return result;
|
||||
},
|
||||
/**
|
||||
* Asynchronously displays a text popup with the given header and text, returning the clicked result button value.
|
||||
*
|
||||
* @param {string?} header - The header text for the popup.
|
||||
* @param {string?} text - The main text for the popup.
|
||||
* @param {PopupOptions} [popupOptions={}] - Options for the popup.
|
||||
* @return {Promise<POPUP_RESULT>} A Promise that resolves with the result of the user's interaction.
|
||||
*/
|
||||
text: async (header, text, popupOptions = {}) => {
|
||||
const content = PopupUtils.BuildTextWithHeader(header, text);
|
||||
const popup = new Popup(content, POPUP_TYPE.TEXT, null, popupOptions);
|
||||
const result = await popup.show();
|
||||
if (typeof result === 'string' || typeof result === 'boolean') throw new Error(`Invalid popup result. TEXT popups only support numbers, or null. Result: ${result}`);
|
||||
return result;
|
||||
},
|
||||
};
|
||||
|
||||
export class Popup {
|
||||
|
@ -511,6 +526,15 @@ export class Popup {
|
|||
|
||||
return this.#promise;
|
||||
}
|
||||
async completeAffirmative() {
|
||||
return await this.complete(POPUP_RESULT.AFFIRMATIVE);
|
||||
}
|
||||
async completeNegative() {
|
||||
return await this.complete(POPUP_RESULT.NEGATIVE);
|
||||
}
|
||||
async completeCancelled() {
|
||||
return await this.complete(POPUP_RESULT.CANCELLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the popup, using the internal resolver to return the value to the original show promise
|
||||
|
@ -591,15 +615,15 @@ class PopupUtils {
|
|||
/**
|
||||
* Builds popup content with header and text below
|
||||
*
|
||||
* @param {string} header - The header to be added to the text
|
||||
* @param {string} text - The main text content
|
||||
* @param {string?} header - The header to be added to the text
|
||||
* @param {string?} text - The main text content
|
||||
*/
|
||||
static BuildTextWithHeader(header, text) {
|
||||
if (!header) {
|
||||
return text;
|
||||
}
|
||||
return `<h3>${header}</h3>
|
||||
${text}`;
|
||||
${text ?? ''}`; // Convert no text to empty string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ import { FILTER_TYPES } from './filters.js';
|
|||
import { PARSER_FLAG, SlashCommandParser } from './slash-commands/SlashCommandParser.js';
|
||||
import { SlashCommand } from './slash-commands/SlashCommand.js';
|
||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js';
|
||||
import { AUTOCOMPLETE_WIDTH } from './autocomplete/AutoComplete.js';
|
||||
import { AUTOCOMPLETE_SELECT_KEY, AUTOCOMPLETE_WIDTH } from './autocomplete/AutoComplete.js';
|
||||
import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
|
||||
import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||
import { POPUP_TYPE, callGenericPopup } from './popup.js';
|
||||
|
@ -197,6 +197,7 @@ let power_user = {
|
|||
prefer_character_prompt: true,
|
||||
prefer_character_jailbreak: true,
|
||||
quick_continue: false,
|
||||
quick_impersonate: false,
|
||||
continue_on_send: false,
|
||||
trim_spaces: true,
|
||||
relaxed_api_urls: false,
|
||||
|
@ -242,6 +243,7 @@ let power_user = {
|
|||
example_separator: defaultExampleSeparator,
|
||||
use_stop_strings: true,
|
||||
allow_jailbreak: false,
|
||||
names_as_stop_strings: true,
|
||||
},
|
||||
|
||||
personas: {},
|
||||
|
@ -276,6 +278,7 @@ let power_user = {
|
|||
left: AUTOCOMPLETE_WIDTH.CHAT,
|
||||
right: AUTOCOMPLETE_WIDTH.CHAT,
|
||||
},
|
||||
select: AUTOCOMPLETE_SELECT_KEY.TAB + AUTOCOMPLETE_SELECT_KEY.ENTER,
|
||||
},
|
||||
parser: {
|
||||
/**@type {Object.<PARSER_FLAG,boolean>} */
|
||||
|
@ -347,6 +350,7 @@ const contextControls = [
|
|||
{ id: 'context_chat_start', property: 'chat_start', isCheckbox: false, isGlobalSetting: false },
|
||||
{ id: 'context_use_stop_strings', property: 'use_stop_strings', isCheckbox: true, isGlobalSetting: false, defaultValue: false },
|
||||
{ id: 'context_allow_jailbreak', property: 'allow_jailbreak', isCheckbox: true, isGlobalSetting: false, defaultValue: false },
|
||||
{ id: 'context_names_as_stop_strings', property: 'names_as_stop_strings', isCheckbox: true, isGlobalSetting: false, defaultValue: true },
|
||||
|
||||
// Existing power user settings
|
||||
{ id: 'always-force-name2-checkbox', property: 'always_force_name2', isCheckbox: true, isGlobalSetting: true, defaultValue: true },
|
||||
|
@ -1026,6 +1030,12 @@ function switchMovingUI() {
|
|||
if (power_user.movingUIState) {
|
||||
loadMovingUIState();
|
||||
}
|
||||
} else {
|
||||
if (Object.keys(power_user.movingUIState).length !== 0) {
|
||||
power_user.movingUIState = {};
|
||||
resetMovablePanels();
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1470,7 +1480,7 @@ function getExampleMessagesBehavior() {
|
|||
return 'normal';
|
||||
}
|
||||
|
||||
function loadPowerUserSettings(settings, data) {
|
||||
async function loadPowerUserSettings(settings, data) {
|
||||
const defaultStscript = JSON.parse(JSON.stringify(power_user.stscript));
|
||||
// Load from settings.json
|
||||
if (settings.power_user !== undefined) {
|
||||
|
@ -1492,6 +1502,9 @@ function loadPowerUserSettings(settings, data) {
|
|||
if (power_user.stscript.autocomplete.style === undefined) {
|
||||
power_user.stscript.autocomplete.style = power_user.stscript.autocomplete_style || defaultStscript.autocomplete.style;
|
||||
}
|
||||
if (power_user.stscript.autocomplete.select === undefined) {
|
||||
power_user.stscript.autocomplete.select = defaultStscript.autocomplete.select;
|
||||
}
|
||||
}
|
||||
if (power_user.stscript.parser === undefined) {
|
||||
power_user.stscript.parser = defaultStscript.parser;
|
||||
|
@ -1586,7 +1599,9 @@ function loadPowerUserSettings(settings, data) {
|
|||
$('#trim_spaces').prop('checked', power_user.trim_spaces);
|
||||
$('#continue_on_send').prop('checked', power_user.continue_on_send);
|
||||
$('#quick_continue').prop('checked', power_user.quick_continue);
|
||||
$('#quick_impersonate').prop('checked', power_user.quick_continue);
|
||||
$('#mes_continue').css('display', power_user.quick_continue ? '' : 'none');
|
||||
$('#mes_impersonate').css('display', power_user.quick_impersonate ? '' : 'none');
|
||||
$('#gestures-checkbox').prop('checked', power_user.gestures);
|
||||
$('#auto_swipe').prop('checked', power_user.auto_swipe);
|
||||
$('#auto_swipe_minimum_length').val(power_user.auto_swipe_minimum_length);
|
||||
|
@ -1656,6 +1671,7 @@ function loadPowerUserSettings(settings, data) {
|
|||
$('#stscript_matching').val(power_user.stscript.matching ?? 'fuzzy');
|
||||
$('#stscript_autocomplete_style').val(power_user.stscript.autocomplete.style ?? 'theme');
|
||||
document.body.setAttribute('data-stscript-style', power_user.stscript.autocomplete.style);
|
||||
$('#stscript_autocomplete_select').val(power_user.stscript.autocomplete.select ?? (AUTOCOMPLETE_SELECT_KEY.TAB + AUTOCOMPLETE_SELECT_KEY.ENTER));
|
||||
$('#stscript_parser_flag_strict_escaping').prop('checked', power_user.stscript.parser.flags[PARSER_FLAG.STRICT_ESCAPING] ?? false);
|
||||
$('#stscript_parser_flag_replace_getvar').prop('checked', power_user.stscript.parser.flags[PARSER_FLAG.REPLACE_GETVAR] ?? false);
|
||||
$('#stscript_autocomplete_font_scale').val(power_user.stscript.autocomplete.font.scale ?? defaultStscript.autocomplete.font.scale);
|
||||
|
@ -1724,7 +1740,7 @@ function loadPowerUserSettings(settings, data) {
|
|||
switchCompactInputArea();
|
||||
reloadMarkdownProcessor(power_user.render_formulas);
|
||||
loadInstructMode(data);
|
||||
loadContextSettings();
|
||||
await loadContextSettings();
|
||||
loadMaxContextUnlocked();
|
||||
switchWaifuMode();
|
||||
switchSpoilerMode();
|
||||
|
@ -1856,7 +1872,7 @@ function getContextSettings() {
|
|||
|
||||
// TODO: Maybe add a refresh button to reset settings to preset
|
||||
// TODO: Add "global state" if a preset doesn't set the power_user checkboxes
|
||||
function loadContextSettings() {
|
||||
async function loadContextSettings() {
|
||||
contextControls.forEach(control => {
|
||||
const $element = $(`#${control.id}`);
|
||||
|
||||
|
@ -1876,7 +1892,7 @@ function loadContextSettings() {
|
|||
|
||||
// If the setting already exists, no need to duplicate it
|
||||
// TODO: Maybe check the power_user object for the setting instead of a flag?
|
||||
$element.on('input', function () {
|
||||
$element.on('input', async function () {
|
||||
const value = control.isCheckbox ? !!$(this).prop('checked') : $(this).val();
|
||||
if (control.isGlobalSetting) {
|
||||
power_user[control.property] = value;
|
||||
|
@ -1886,7 +1902,7 @@ function loadContextSettings() {
|
|||
|
||||
saveSettingsDebounced();
|
||||
if (!control.isCheckbox) {
|
||||
resetScrollHeight($element);
|
||||
await resetScrollHeight($element);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -2175,7 +2191,7 @@ function validateStoryString(storyString, params) {
|
|||
validateMissingField('personality');
|
||||
validateMissingField('persona');
|
||||
validateMissingField('scenario');
|
||||
validateMissingField('system');
|
||||
// validateMissingField('system');
|
||||
validateMissingField('wiBefore', 'loreBefore');
|
||||
validateMissingField('wiAfter', 'loreAfter');
|
||||
|
||||
|
@ -2968,7 +2984,13 @@ function setAvgBG() {
|
|||
return '';
|
||||
}
|
||||
|
||||
async function setThemeCallback(_, text) {
|
||||
async function setThemeCallback(_, themeName) {
|
||||
if (!themeName) {
|
||||
// allow reporting of the theme name if called without args
|
||||
// for use in ST Scripts via pipe
|
||||
return power_user.theme;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
const fuse = new Fuse(themes, {
|
||||
keys: [
|
||||
|
@ -2976,12 +2998,12 @@ async function setThemeCallback(_, text) {
|
|||
],
|
||||
});
|
||||
|
||||
const results = fuse.search(text);
|
||||
console.debug('Theme fuzzy search results for ' + text, results);
|
||||
const results = fuse.search(themeName);
|
||||
console.debug('Theme fuzzy search results for ' + themeName, results);
|
||||
const theme = results[0]?.item;
|
||||
|
||||
if (!theme) {
|
||||
toastr.warning(`Could not find theme with name: ${text}`);
|
||||
toastr.warning(`Could not find theme with name: ${themeName}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3288,8 +3310,8 @@ $(document).ready(() => {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#customCSS').on('change', () => {
|
||||
power_user.custom_css = $('#customCSS').val();
|
||||
$('#customCSS').on('input', () => {
|
||||
power_user.custom_css = String($('#customCSS').val());
|
||||
localStorage.setItem(storage_keys.custom_css, power_user.custom_css);
|
||||
saveSettingsDebounced();
|
||||
applyCustomCSS();
|
||||
|
@ -3328,10 +3350,11 @@ $(document).ready(() => {
|
|||
|
||||
});
|
||||
|
||||
$('#chat_width_slider').on('input', function (e) {
|
||||
$('#chat_width_slider').on('input', function (e, data) {
|
||||
const applyMode = data?.forced ? 'forced' : 'normal';
|
||||
power_user.chat_width = Number(e.target.value);
|
||||
localStorage.setItem(storage_keys.chat_width, power_user.chat_width);
|
||||
applyChatWidth();
|
||||
applyChatWidth(applyMode);
|
||||
setHotswapsDebounced();
|
||||
});
|
||||
|
||||
|
@ -3357,11 +3380,12 @@ $(document).ready(() => {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('input[name="font_scale"]').on('input', async function (e) {
|
||||
$('input[name="font_scale"]').on('input', async function (e, data) {
|
||||
const applyMode = data?.forced ? 'forced' : 'normal';
|
||||
power_user.font_scale = Number(e.target.value);
|
||||
$('#font_scale_counter').val(power_user.font_scale);
|
||||
localStorage.setItem(storage_keys.font_scale, power_user.font_scale);
|
||||
await applyFontScale();
|
||||
await applyFontScale(applyMode);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
|
@ -3724,6 +3748,13 @@ $(document).ready(() => {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#quick_impersonate').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.quick_impersonate = value;
|
||||
$('#mes_impersonate').css('display', value ? '' : 'none');
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#trim_spaces').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.trim_spaces = value;
|
||||
|
@ -3838,6 +3869,12 @@ $(document).ready(() => {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#stscript_autocomplete_select').on('change', function () {
|
||||
const value = $(this).find(':selected').val();
|
||||
power_user.stscript.autocomplete.select = parseInt(String(value));
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#stscript_autocomplete_font_scale').on('input', function () {
|
||||
const value = $(this).val();
|
||||
$('#stscript_autocomplete_font_scale_counter').val(value);
|
||||
|
@ -4006,6 +4043,7 @@ $(document).ready(() => {
|
|||
),
|
||||
],
|
||||
helpString: 'Enter message deletion mode, and auto-deletes last N messages if numeric argument is provided.',
|
||||
returns: 'The text of the deleted messages.',
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'cut',
|
||||
|
@ -4054,13 +4092,30 @@ $(document).ready(() => {
|
|||
callback: setThemeCallback,
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
description: 'name',
|
||||
description: 'theme name',
|
||||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
isRequired: true,
|
||||
enumProvider: () => themes.map(theme => new SlashCommandEnumValue(theme.name)),
|
||||
}),
|
||||
],
|
||||
helpString: 'sets a UI theme by name',
|
||||
helpString: `
|
||||
<div>
|
||||
Sets a UI theme by name.
|
||||
</div>
|
||||
<div>
|
||||
If no theme name is is provided, this will return the currently active theme.
|
||||
</div>
|
||||
<div>
|
||||
<strong>Example:</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<pre><code>/theme Cappuccino</code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<pre><code>/theme</code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'movingui',
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import {
|
||||
main_api,
|
||||
saveSettingsDebounced,
|
||||
novelai_setting_names,
|
||||
callPopup,
|
||||
settings,
|
||||
} from '../script.js';
|
||||
import { power_user } from './power-user.js';
|
||||
//import { BIAS_CACHE, displayLogitBias, getLogitBiasListResult } from './logit-bias.js';
|
||||
|
@ -20,132 +18,6 @@ const forcedOffColoring = 'filter: sepia(1) hue-rotate(308deg) contrast(0.7) sat
|
|||
|
||||
let userDisabledSamplers, userShownSamplers;
|
||||
|
||||
/*
|
||||
|
||||
for reference purposes:
|
||||
|
||||
//NAI
|
||||
const nai_settings = {
|
||||
temperature: 1.5,
|
||||
repetition_penalty: 2.25,
|
||||
repetition_penalty_range: 2048,
|
||||
repetition_penalty_slope: 0.09,
|
||||
repetition_penalty_frequency: 0,
|
||||
repetition_penalty_presence: 0.005,
|
||||
tail_free_sampling: 0.975,
|
||||
top_k: 10,
|
||||
top_p: 0.75,
|
||||
top_a: 0.08,
|
||||
typical_p: 0.975,
|
||||
min_length: 1,
|
||||
model_novel: 'clio-v1',
|
||||
preset_settings_novel: 'Talker-Chat-Clio',
|
||||
streaming_novel: false,
|
||||
preamble: default_preamble,
|
||||
prefix: '',
|
||||
cfg_uc: '',
|
||||
banned_tokens: '',
|
||||
order: default_order,
|
||||
logit_bias: [],
|
||||
};
|
||||
|
||||
// TG Types
|
||||
export const textgen_types = {
|
||||
OOBA: 'ooba',
|
||||
MANCER: 'mancer',
|
||||
VLLM: 'vllm',
|
||||
APHRODITE: 'aphrodite',
|
||||
TABBY: 'tabby',
|
||||
KOBOLDCPP: 'koboldcpp',
|
||||
TOGETHERAI: 'togetherai',
|
||||
LLAMACPP: 'llamacpp',
|
||||
OLLAMA: 'ollama',
|
||||
INFERMATICAI: 'infermaticai',
|
||||
DREAMGEN: 'dreamgen',
|
||||
OPENROUTER: 'openrouter',
|
||||
};
|
||||
|
||||
//KAI and TextGen
|
||||
const setting_names = [
|
||||
'temp',
|
||||
'temperature_last',
|
||||
'rep_pen',
|
||||
'rep_pen_range',
|
||||
'no_repeat_ngram_size',
|
||||
'top_k',
|
||||
'top_p',
|
||||
'top_a',
|
||||
'tfs',
|
||||
'epsilon_cutoff',
|
||||
'eta_cutoff',
|
||||
'typical_p',
|
||||
'min_p',
|
||||
'penalty_alpha',
|
||||
'num_beams',
|
||||
'length_penalty',
|
||||
'min_length',
|
||||
'dynatemp',
|
||||
'min_temp',
|
||||
'max_temp',
|
||||
'dynatemp_exponent',
|
||||
'smoothing_factor',
|
||||
'smoothing_curve',
|
||||
'max_tokens_second',
|
||||
'encoder_rep_pen',
|
||||
'freq_pen',
|
||||
'presence_pen',
|
||||
'do_sample',
|
||||
'early_stopping',
|
||||
'seed',
|
||||
'add_bos_token',
|
||||
'ban_eos_token',
|
||||
'skip_special_tokens',
|
||||
'streaming',
|
||||
'mirostat_mode',
|
||||
'mirostat_tau',
|
||||
'mirostat_eta',
|
||||
'guidance_scale',
|
||||
'negative_prompt',
|
||||
'grammar_string',
|
||||
'json_schema',
|
||||
'banned_tokens',
|
||||
'legacy_api',
|
||||
//'n_aphrodite',
|
||||
//'best_of_aphrodite',
|
||||
'ignore_eos_token',
|
||||
'spaces_between_special_tokens',
|
||||
//'logits_processors_aphrodite',
|
||||
//'log_probs_aphrodite',
|
||||
//'prompt_log_probs_aphrodite'
|
||||
'sampler_order',
|
||||
'sampler_priority',
|
||||
'samplers',
|
||||
'n',
|
||||
'logit_bias',
|
||||
'custom_model',
|
||||
'bypass_status_check',
|
||||
];
|
||||
|
||||
//OAI settings
|
||||
|
||||
const default_settings = {
|
||||
preset_settings_openai: 'Default',
|
||||
temp_openai: 1.0,
|
||||
freq_pen_openai: 0,
|
||||
pres_pen_openai: 0,
|
||||
count_pen: 0.0,
|
||||
top_p_openai: 1.0,
|
||||
top_k_openai: 0,
|
||||
min_p_openai: 0,
|
||||
top_a_openai: 1,
|
||||
repetition_penalty_openai: 1,
|
||||
stream_openai: false,
|
||||
//...
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
// Goal 1: show popup with all samplers for active API
|
||||
async function showSamplerSelectPopup() {
|
||||
const popup = $('#dialogue_popup');
|
||||
|
@ -158,12 +30,12 @@ async function showSamplerSelectPopup() {
|
|||
<div class="flex-container justifyCenter">
|
||||
<h3>Sampler Select</h3>
|
||||
<div class="flex-container alignItemsBaseline">
|
||||
<div id="resetSelectedSamplers" class="menu_button menu_button_icon tag_view_create" title="Reset custom sampler selection">
|
||||
<div id="resetSelectedSamplers" class="menu_button menu_button_icon" title="Reset custom sampler selection">
|
||||
<i class="fa-solid fa-recycle"></i>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="flex-container alignItemsBaseline">
|
||||
<div class="menu_button menu_button_icon tag_view_create" title="Create a new sampler">
|
||||
<div class="menu_button menu_button_icon" title="Create a new sampler">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
<span data-i18n="Create">Create</span>
|
||||
</div>
|
||||
|
@ -190,6 +62,15 @@ async function showSamplerSelectPopup() {
|
|||
power_user.selectSamplers.forceHidden = [];
|
||||
await validateDisabledSamplers(true);
|
||||
});
|
||||
|
||||
$('#textgen_type').on('change', async function () {
|
||||
console.log('changed TG Type, resetting custom samplers'); //unfortunate, but necessary unless we save custom samplers for each TGTytpe
|
||||
userDisabledSamplers = [];
|
||||
userShownSamplers = [];
|
||||
power_user.selectSamplers.forceShown = [];
|
||||
power_user.selectSamplers.forceHidden = [];
|
||||
await validateDisabledSamplers();
|
||||
});
|
||||
}
|
||||
|
||||
function setSamplerListListeners() {
|
||||
|
@ -221,6 +102,11 @@ function setSamplerListListeners() {
|
|||
targetDisplayType = 'block';
|
||||
}
|
||||
|
||||
if (samplerName === 'dry_multiplier') {
|
||||
relatedDOMElement = $('#dryBlock');
|
||||
targetDisplayType = 'block';
|
||||
}
|
||||
|
||||
if (samplerName === 'dynatemp') {
|
||||
relatedDOMElement = $('#dynatemp_block_ooba');
|
||||
targetDisplayType = 'block';
|
||||
|
@ -231,9 +117,30 @@ function setSamplerListListeners() {
|
|||
targetDisplayType = 'block';
|
||||
}
|
||||
|
||||
if (samplerName === 'sampler_order') {
|
||||
relatedDOMElement = $('#sampler_order_block');
|
||||
targetDisplayType = 'flex';
|
||||
if (samplerName === 'sampler_order') { //this is for kcpp sampler order
|
||||
relatedDOMElement = $('#sampler_order_block_kcpp');
|
||||
}
|
||||
|
||||
if (samplerName === 'samplers') { //this is for lcpp sampler order
|
||||
relatedDOMElement = $('#sampler_order_block_lcpp');
|
||||
}
|
||||
|
||||
if (samplerName === 'sampler_priority') { //this is for ooba's sampler priority
|
||||
relatedDOMElement = $('#sampler_priority_block_ooba');
|
||||
}
|
||||
|
||||
if (samplerName === 'penalty_alpha') { //contrastive search only has one sampler, does it need its own block?
|
||||
relatedDOMElement = $('#contrastiveSearchBlock');
|
||||
}
|
||||
|
||||
if (samplerName === 'num_beams') { // num_beams is the killswitch for Beam Search
|
||||
relatedDOMElement = $('#beamSearchBlock');
|
||||
targetDisplayType = 'block';
|
||||
}
|
||||
|
||||
if (samplerName === 'smoothing_factor') { // num_beams is the killswitch for Beam Search
|
||||
relatedDOMElement = $('#smoothingBlock');
|
||||
targetDisplayType = 'block';
|
||||
}
|
||||
|
||||
// Get the current state of the custom data attribute
|
||||
|
@ -301,7 +208,7 @@ async function listSamplers(main_api, arrayOnly = false) {
|
|||
let availableSamplers;
|
||||
if (main_api === 'textgenerationwebui') {
|
||||
availableSamplers = TGsamplerNames;
|
||||
const valuesToRemove = new Set(['streaming', 'seed', 'bypass_status_check', 'custom_model', 'legacy_api', 'samplers']);
|
||||
const valuesToRemove = new Set(['streaming', 'bypass_status_check', 'custom_model', 'legacy_api']);
|
||||
availableSamplers = availableSamplers.filter(sampler => !valuesToRemove.has(sampler));
|
||||
availableSamplers.sort();
|
||||
}
|
||||
|
@ -312,8 +219,70 @@ async function listSamplers(main_api, arrayOnly = false) {
|
|||
}
|
||||
|
||||
const samplersListHTML = availableSamplers.reduce((html, sampler) => {
|
||||
let customColor;
|
||||
const targetDOMelement = $(`#${sampler}_${main_api}`);
|
||||
let customColor, displayname;
|
||||
let targetDOMelement = $(`#${sampler}_${main_api}`);
|
||||
|
||||
if (sampler === 'sampler_order') { //this is for kcpp sampler order
|
||||
targetDOMelement = $('#sampler_order_block_kcpp');
|
||||
displayname = 'KCPP Sampler Order Block';
|
||||
}
|
||||
|
||||
if (sampler === 'samplers') { //this is for lcpp sampler order
|
||||
targetDOMelement = $('#sampler_order_block_lcpp');
|
||||
displayname = 'LCPP Sampler Order Block';
|
||||
}
|
||||
|
||||
if (sampler === 'sampler_priority') { //this is for ooba's sampler priority
|
||||
targetDOMelement = $('#sampler_priority_block_ooba');
|
||||
displayname = 'Ooba Sampler Priority Block';
|
||||
}
|
||||
|
||||
if (sampler === 'penalty_alpha') { //contrastive search only has one sampler, does it need its own block?
|
||||
targetDOMelement = $('#contrastiveSearchBlock');
|
||||
displayname = 'Contrast Search Block';
|
||||
}
|
||||
|
||||
if (sampler === 'num_beams') { // num_beams is the killswitch for Beam Search
|
||||
targetDOMelement = $('#beamSearchBlock');
|
||||
displayname = 'Beam Search Block';
|
||||
}
|
||||
|
||||
if (sampler === 'smoothing_factor') { // num_beams is the killswitch for Beam Search
|
||||
targetDOMelement = $('#smoothingBlock');
|
||||
displayname = 'Smoothing Block';
|
||||
}
|
||||
|
||||
if (sampler === 'dry_multiplier') {
|
||||
targetDOMelement = $('#dryBlock');
|
||||
displayname = 'DRY Rep Pen Block';
|
||||
}
|
||||
|
||||
if (sampler === 'dynatemp') {
|
||||
targetDOMelement = $('#dynatemp_block_ooba');
|
||||
displayname = 'DynaTemp Block';
|
||||
}
|
||||
|
||||
if (sampler === 'json_schema') {
|
||||
targetDOMelement = $('#json_schema_block');
|
||||
displayname = 'JSON Schema Block';
|
||||
}
|
||||
|
||||
if (sampler === 'grammar_string') {
|
||||
targetDOMelement = $('#grammar_block_ooba');
|
||||
displayname = 'Grammar Block';
|
||||
}
|
||||
|
||||
if (sampler === 'guidance_scale') {
|
||||
targetDOMelement = $('#cfg_block_ooba');
|
||||
displayname = 'CFG Block';
|
||||
}
|
||||
|
||||
if (sampler === 'mirostat_mode') {
|
||||
targetDOMelement = $('#mirostat_block_ooba');
|
||||
displayname = 'Mirostat Block';
|
||||
}
|
||||
|
||||
|
||||
|
||||
const isInForceHiddenArray = userDisabledSamplers.includes(sampler);
|
||||
const isInForceShownArray = userShownSamplers.includes(sampler);
|
||||
|
@ -335,11 +304,12 @@ async function listSamplers(main_api, arrayOnly = false) {
|
|||
}
|
||||
else { return isVisibleInDOM; }
|
||||
};
|
||||
console.log(sampler, isInDefaultState(), isInForceHiddenArray, shouldBeChecked());
|
||||
console.log(sampler, targetDOMelement.prop('id'), isInDefaultState(), isInForceShownArray, isInForceHiddenArray, shouldBeChecked());
|
||||
if (displayname === undefined) { displayname = sampler; }
|
||||
return html + `
|
||||
<div class="sampler_view_list_item wide50p flex-container">
|
||||
<input type="checkbox" name="${sampler}_checkbox" ${shouldBeChecked() ? 'checked' : ''}>
|
||||
<small class="sampler_name" style="${customColor}">${sampler}</small>
|
||||
<small class="sampler_name" style="${customColor}">${displayname}</small>
|
||||
</div>
|
||||
`;
|
||||
}, '');
|
||||
|
@ -391,8 +361,33 @@ export async function validateDisabledSamplers(redraw = false) {
|
|||
targetDisplayType = 'block';
|
||||
}
|
||||
|
||||
if (sampler === 'sampler_order') {
|
||||
relatedDOMElement = $('#sampler_order_block');
|
||||
if (sampler === 'sampler_order') { //this is for kcpp sampler order
|
||||
relatedDOMElement = $('#sampler_order_block_kcpp');
|
||||
}
|
||||
|
||||
if (sampler === 'samplers') { //this is for lcpp sampler order
|
||||
relatedDOMElement = $('#sampler_order_block_lcpp');
|
||||
}
|
||||
|
||||
if (sampler === 'sampler_priority') { //this is for ooba's sampler priority
|
||||
relatedDOMElement = $('#sampler_priority_block_ooba');
|
||||
}
|
||||
|
||||
if (sampler === 'dry_multiplier') {
|
||||
relatedDOMElement = $('#dryBlock');
|
||||
targetDisplayType = 'block';
|
||||
}
|
||||
|
||||
if (sampler === 'penalty_alpha') { //contrastive search only has one sampler, does it need its own block?
|
||||
relatedDOMElement = $('#contrastiveSearchBlock');
|
||||
}
|
||||
|
||||
if (sampler === 'num_beams') { // num_beams is the killswitch for Beam Search
|
||||
relatedDOMElement = $('#beamSearchBlock');
|
||||
}
|
||||
|
||||
if (sampler === 'smoothing_factor') { // num_beams is the killswitch for Beam Search
|
||||
relatedDOMElement = $('#smoothingBlock');
|
||||
}
|
||||
|
||||
if (power_user?.selectSamplers?.forceHidden.includes(sampler)) {
|
||||
|
@ -418,6 +413,7 @@ export async function validateDisabledSamplers(redraw = false) {
|
|||
setSamplerListListeners();
|
||||
}
|
||||
|
||||
await saveSettingsDebounced();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ export const SECRET_KEYS = {
|
|||
ZEROONEAI: 'api_key_01ai',
|
||||
HUGGINGFACE: 'api_key_huggingface',
|
||||
STABILITY: 'api_key_stability',
|
||||
BLOCKENTROPY: 'api_key_blockentropy',
|
||||
CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts',
|
||||
};
|
||||
|
||||
const INPUT_MAP = {
|
||||
|
@ -63,6 +65,7 @@ const INPUT_MAP = {
|
|||
[SECRET_KEYS.FEATHERLESS]: '#api_key_featherless',
|
||||
[SECRET_KEYS.ZEROONEAI]: '#api_key_01ai',
|
||||
[SECRET_KEYS.HUGGINGFACE]: '#api_key_huggingface',
|
||||
[SECRET_KEYS.BLOCKENTROPY]: '#api_key_blockentropy',
|
||||
};
|
||||
|
||||
async function clearSecret() {
|
||||
|
@ -125,7 +128,7 @@ export async function writeSecret(key, value) {
|
|||
const text = await response.text();
|
||||
|
||||
if (text == 'ok') {
|
||||
secret_state[key] = true;
|
||||
secret_state[key] = !!value;
|
||||
updateSecretDisplay();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import { autoSelectPersona, retriggerFirstMessageOnEmptyChat, setPersonaLockStat
|
|||
import { addEphemeralStoppingString, chat_styles, flushEphemeralStoppingStrings, power_user } from './power-user.js';
|
||||
import { textgen_types, textgenerationwebui_settings } from './textgen-settings.js';
|
||||
import { decodeTextTokens, getFriendlyTokenizerName, getTextTokens, getTokenCountAsync } from './tokenizers.js';
|
||||
import { debounce, delay, isFalseBoolean, isTrueBoolean, stringToRange, trimToEndSentence, trimToStartSentence, waitUntilCondition } from './utils.js';
|
||||
import { debounce, delay, isFalseBoolean, isTrueBoolean, showFontAwesomePicker, stringToRange, trimToEndSentence, trimToStartSentence, waitUntilCondition } from './utils.js';
|
||||
import { registerVariableCommands, resolveVariable } from './variables.js';
|
||||
import { background_settings } from './backgrounds.js';
|
||||
import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
|
||||
|
@ -64,6 +64,9 @@ import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashComma
|
|||
import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
|
||||
import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js';
|
||||
import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||
import { SlashCommandDebugController } from './slash-commands/SlashCommandDebugController.js';
|
||||
import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakController.js';
|
||||
import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js';
|
||||
export {
|
||||
executeSlashCommands, executeSlashCommandsWithOptions, getSlashCommandsHelp, registerSlashCommand,
|
||||
};
|
||||
|
@ -139,9 +142,8 @@ export function initDefaultSlashCommands() {
|
|||
returns: 'the current background',
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
description: 'filename',
|
||||
description: 'background filename',
|
||||
typeList: [ARGUMENT_TYPE.STRING],
|
||||
isRequired: true,
|
||||
enumProvider: () => [...document.querySelectorAll('.bg_example')]
|
||||
.map(it => new SlashCommandEnumValue(it.getAttribute('bgfile')))
|
||||
.filter(it => it.value?.length),
|
||||
|
@ -151,12 +153,18 @@ export function initDefaultSlashCommands() {
|
|||
<div>
|
||||
Sets a background according to the provided filename. Partial names allowed.
|
||||
</div>
|
||||
<div>
|
||||
If no background is provided, this will return the currently selected background.
|
||||
</div>
|
||||
<div>
|
||||
<strong>Example:</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<pre><code>/bg beach.jpg</code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<pre><code>/bg</code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
|
@ -709,6 +717,7 @@ export function initDefaultSlashCommands() {
|
|||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'delswipe',
|
||||
callback: deleteSwipeCallback,
|
||||
returns: 'the new, currently selected swipe id',
|
||||
aliases: ['swipedel'],
|
||||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
|
@ -904,13 +913,28 @@ export function initDefaultSlashCommands() {
|
|||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'addswipe',
|
||||
callback: addSwipeCallback,
|
||||
returns: 'the new swipe id',
|
||||
aliases: ['swipeadd'],
|
||||
namedArgumentList: [
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'switch',
|
||||
description: 'switch to the new swipe',
|
||||
typeList: [ARGUMENT_TYPE.BOOLEAN],
|
||||
enumList: commonEnumProviders.boolean()(),
|
||||
}),
|
||||
],
|
||||
unnamedArgumentList: [
|
||||
new SlashCommandArgument(
|
||||
'text', [ARGUMENT_TYPE.STRING], true,
|
||||
),
|
||||
],
|
||||
helpString: 'Adds a swipe to the last chat message.',
|
||||
helpString: `
|
||||
<div>
|
||||
Adds a swipe to the last chat message.
|
||||
</div>
|
||||
<div>
|
||||
Use switch=true to switch to directly switch to the new swipe.
|
||||
</div>`,
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'stop',
|
||||
|
@ -1115,10 +1139,10 @@ export function initDefaultSlashCommands() {
|
|||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
description: 'scoped variable or qr label',
|
||||
typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING],
|
||||
typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.CLOSURE],
|
||||
isRequired: true,
|
||||
enumProvider: () => [
|
||||
...commonEnumProviders.variables('scope')(),
|
||||
enumProvider: (executor, scope) => [
|
||||
...commonEnumProviders.variables('scope')(executor, scope),
|
||||
...(typeof window['qrEnumProviderExecutables'] === 'function') ? window['qrEnumProviderExecutables']() : [],
|
||||
],
|
||||
}),
|
||||
|
@ -1356,7 +1380,7 @@ export function initDefaultSlashCommands() {
|
|||
enumProvider: commonEnumProviders.injects,
|
||||
}),
|
||||
new SlashCommandNamedArgument(
|
||||
'position', 'injection position', [ARGUMENT_TYPE.STRING], false, false, 'after', ['before', 'after', 'chat'],
|
||||
'position', 'injection position', [ARGUMENT_TYPE.STRING], false, false, 'after', ['before', 'after', 'chat', 'none'],
|
||||
),
|
||||
new SlashCommandNamedArgument(
|
||||
'depth', 'injection depth', [ARGUMENT_TYPE.NUMBER], false, false, '4',
|
||||
|
@ -1384,7 +1408,7 @@ export function initDefaultSlashCommands() {
|
|||
'text', [ARGUMENT_TYPE.STRING], false,
|
||||
),
|
||||
],
|
||||
helpString: 'Injects a text into the LLM prompt for the current chat. Requires a unique injection ID. Positions: "before" main prompt, "after" main prompt, in-"chat" (default: after). Depth: injection depth for the prompt (default: 4). Role: role for in-chat injections (default: system). Scan: include injection content into World Info scans (default: false).',
|
||||
helpString: 'Injects a text into the LLM prompt for the current chat. Requires a unique injection ID. Positions: "before" main prompt, "after" main prompt, in-"chat", hidden with "none" (default: after). Depth: injection depth for the prompt (default: 4). Role: role for in-chat injections (default: system). Scan: include injection content into World Info scans (default: false). Hidden injects in "none" position are not inserted into the prompt but can be used for triggering WI entries.',
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'listinjects',
|
||||
|
@ -1472,6 +1496,21 @@ export function initDefaultSlashCommands() {
|
|||
],
|
||||
helpString: 'Sets the specified prompt manager entry/entries on or off.',
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'pick-icon',
|
||||
callback: async()=>((await showFontAwesomePicker()) ?? false).toString(),
|
||||
returns: 'The chosen icon name or false if cancelled.',
|
||||
helpString: `
|
||||
<div>Opens a popup with all the available Font Awesome icons and returns the selected icon's name.</div>
|
||||
<div>
|
||||
<strong>Example:</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<pre><code>/pick-icon |\n/if left={{pipe}} rule=eq right=false\n\telse={: /echo chosen icon: "{{pipe}}" :}\n\t{: /echo cancelled icon selection :}\n|</code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
}));
|
||||
|
||||
registerVariableCommands();
|
||||
}
|
||||
|
@ -1486,6 +1525,7 @@ function injectCallback(args, value) {
|
|||
'before': extension_prompt_types.BEFORE_PROMPT,
|
||||
'after': extension_prompt_types.IN_PROMPT,
|
||||
'chat': extension_prompt_types.IN_CHAT,
|
||||
'none': extension_prompt_types.NONE,
|
||||
};
|
||||
const roles = {
|
||||
'system': extension_prompt_roles.SYSTEM,
|
||||
|
@ -1815,6 +1855,11 @@ async function runCallback(args, name) {
|
|||
throw new Error('No name provided for /run command');
|
||||
}
|
||||
|
||||
if (name instanceof SlashCommandClosure) {
|
||||
name.breakController = new SlashCommandBreakController();
|
||||
return (await name.execute())?.pipe;
|
||||
}
|
||||
|
||||
/**@type {SlashCommandScope} */
|
||||
const scope = args._scope;
|
||||
if (scope.existsVariable(name)) {
|
||||
|
@ -1823,6 +1868,11 @@ async function runCallback(args, name) {
|
|||
throw new Error(`"${name}" is not callable.`);
|
||||
}
|
||||
closure.scope.parent = scope;
|
||||
closure.breakController = new SlashCommandBreakController();
|
||||
if (args._debugController && !closure.debugController) {
|
||||
closure.debugController = args._debugController;
|
||||
}
|
||||
while (closure.providedArgumentList.pop());
|
||||
closure.argumentList.forEach(arg => {
|
||||
if (Object.keys(args).includes(arg.name)) {
|
||||
const providedArg = new SlashCommandNamedArgumentAssignment();
|
||||
|
@ -1841,9 +1891,14 @@ async function runCallback(args, name) {
|
|||
|
||||
try {
|
||||
name = name.trim();
|
||||
return await window['executeQuickReplyByName'](name, args);
|
||||
/**@type {ExecuteSlashCommandsOptions} */
|
||||
const options = {
|
||||
abortController: args._abortController,
|
||||
debugController: args._debugController,
|
||||
};
|
||||
return await window['executeQuickReplyByName'](name, args, options);
|
||||
} catch (error) {
|
||||
throw new Error(`Error running Quick Reply "${name}": ${error.message}`, 'Error');
|
||||
throw new Error(`Error running Quick Reply "${name}": ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2115,8 +2170,11 @@ async function echoCallback(args, value) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
async function addSwipeCallback(_, arg) {
|
||||
/**
|
||||
* @param {{switch?: string}} args - named arguments
|
||||
* @param {string} value - The swipe text to add (unnamed argument)
|
||||
*/
|
||||
async function addSwipeCallback(args, value) {
|
||||
const lastMessage = chat[chat.length - 1];
|
||||
|
||||
if (!lastMessage) {
|
||||
|
@ -2124,7 +2182,7 @@ async function addSwipeCallback(_, arg) {
|
|||
return '';
|
||||
}
|
||||
|
||||
if (!arg) {
|
||||
if (!value) {
|
||||
console.warn('WARN: No argument provided for /addswipe command');
|
||||
return '';
|
||||
}
|
||||
|
@ -2153,23 +2211,30 @@ async function addSwipeCallback(_, arg) {
|
|||
lastMessage.swipe_info = lastMessage.swipes.map(() => ({}));
|
||||
}
|
||||
|
||||
lastMessage.swipes.push(arg);
|
||||
lastMessage.swipes.push(value);
|
||||
lastMessage.swipe_info.push({
|
||||
send_date: getMessageTimeStamp(),
|
||||
gen_started: null,
|
||||
gen_finished: null,
|
||||
extra: {
|
||||
bias: extractMessageBias(arg),
|
||||
bias: extractMessageBias(value),
|
||||
gen_id: Date.now(),
|
||||
api: 'manual',
|
||||
model: 'slash command',
|
||||
},
|
||||
});
|
||||
|
||||
const newSwipeId = lastMessage.swipes.length - 1;
|
||||
|
||||
if (isTrueBoolean(args.switch)) {
|
||||
lastMessage.swipe_id = newSwipeId;
|
||||
lastMessage.mes = lastMessage.swipes[newSwipeId];
|
||||
}
|
||||
|
||||
await saveChatConditional();
|
||||
await reloadCurrentChat();
|
||||
|
||||
return '';
|
||||
return String(newSwipeId);
|
||||
}
|
||||
|
||||
async function deleteSwipeCallback(_, arg) {
|
||||
|
@ -2205,7 +2270,7 @@ async function deleteSwipeCallback(_, arg) {
|
|||
await saveChatConditional();
|
||||
await reloadCurrentChat();
|
||||
|
||||
return '';
|
||||
return String(newSwipeId);
|
||||
}
|
||||
|
||||
async function askCharacter(args, text) {
|
||||
|
@ -2846,7 +2911,6 @@ export async function sendMessageAs(args, text) {
|
|||
|
||||
if (args.name) {
|
||||
name = args.name.trim();
|
||||
mesText = text.trim();
|
||||
|
||||
if (!name && !text) {
|
||||
toastr.warning('You must specify a name and text to send as');
|
||||
|
@ -2859,8 +2923,14 @@ export async function sendMessageAs(args, text) {
|
|||
localStorage.setItem(namelessWarningKey, 'true');
|
||||
}
|
||||
name = name2;
|
||||
if (!text) {
|
||||
toastr.warning('You must specify text to send as');
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
mesText = text.trim();
|
||||
|
||||
// Requires a regex check after the slash command is pushed to output
|
||||
mesText = getRegexedString(mesText, regex_placement.SLASH_COMMAND, { characterOverride: name });
|
||||
|
||||
|
@ -3179,6 +3249,7 @@ function getModelOptions() {
|
|||
{ id: 'model_perplexity_select', api: 'openai', type: chat_completion_sources.PERPLEXITY },
|
||||
{ id: 'model_groq_select', api: 'openai', type: chat_completion_sources.GROQ },
|
||||
{ id: 'model_01ai_select', api: 'openai', type: chat_completion_sources.ZEROONEAI },
|
||||
{ id: 'model_blockentropy_select', api: 'openai', type: chat_completion_sources.BLOCKENTROPY },
|
||||
{ id: 'model_novel_select', api: 'novel', type: null },
|
||||
{ id: 'horde_model', api: 'koboldhorde', type: null },
|
||||
];
|
||||
|
@ -3417,7 +3488,9 @@ const clearCommandProgressDebounced = debounce(clearCommandProgress);
|
|||
* @prop {boolean} [handleExecutionErrors] (false) Whether to handle execution errors (show toast on error) or throw
|
||||
* @prop {{[id:PARSER_FLAG]:boolean}} [parserFlags] (null) Parser flags to apply
|
||||
* @prop {SlashCommandAbortController} [abortController] (null) Controller used to abort or pause command execution
|
||||
* @prop {SlashCommandDebugController} [debugController] (null) Controller used to control debug execution
|
||||
* @prop {(done:number, total:number)=>void} [onProgress] (null) Callback to handle progress events
|
||||
* @prop {string} [source] (null) String indicating where the code come from (e.g., QR name)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3425,6 +3498,7 @@ const clearCommandProgressDebounced = debounce(clearCommandProgress);
|
|||
* @prop {SlashCommandScope} [scope] (null) The scope to be used when executing the commands.
|
||||
* @prop {{[id:PARSER_FLAG]:boolean}} [parserFlags] (null) Parser flags to apply
|
||||
* @prop {boolean} [clearChatInput] (false) Whether to clear the chat input textarea
|
||||
* @prop {string} [source] (null) String indicating where the code come from (e.g., QR name)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3440,6 +3514,7 @@ export async function executeSlashCommandsOnChatInput(text, options = {}) {
|
|||
scope: null,
|
||||
parserFlags: null,
|
||||
clearChatInput: false,
|
||||
source: null,
|
||||
}, options);
|
||||
|
||||
isExecutingCommandsFromChatInput = true;
|
||||
|
@ -3462,13 +3537,21 @@ export async function executeSlashCommandsOnChatInput(text, options = {}) {
|
|||
|
||||
/**@type {SlashCommandClosureResult} */
|
||||
let result = null;
|
||||
let currentProgress = 0;
|
||||
try {
|
||||
commandsFromChatInputAbortController = new SlashCommandAbortController();
|
||||
result = await executeSlashCommandsWithOptions(text, {
|
||||
abortController: commandsFromChatInputAbortController,
|
||||
onProgress: (done, total) => ta.style.setProperty('--prog', `${done / total * 100}%`),
|
||||
onProgress: (done, total) => {
|
||||
const newProgress = done / total;
|
||||
if (newProgress > currentProgress) {
|
||||
currentProgress = newProgress;
|
||||
ta.style.setProperty('--prog', `${newProgress * 100}%`);
|
||||
}
|
||||
},
|
||||
parserFlags: options.parserFlags,
|
||||
scope: options.scope,
|
||||
source: options.source,
|
||||
});
|
||||
if (commandsFromChatInputAbortController.signal.aborted) {
|
||||
document.querySelector('#form_sheld').classList.add('script_aborted');
|
||||
|
@ -3481,7 +3564,23 @@ export async function executeSlashCommandsOnChatInput(text, options = {}) {
|
|||
result.isError = true;
|
||||
result.errorMessage = e.message || 'An unknown error occurred';
|
||||
if (e.cause !== 'abort') {
|
||||
toastr.error(result.errorMessage);
|
||||
if (e instanceof SlashCommandExecutionError) {
|
||||
/**@type {SlashCommandExecutionError}*/
|
||||
const ex = e;
|
||||
const toast = `
|
||||
<div>${ex.message}</div>
|
||||
<div>Line: ${ex.line} Column: ${ex.column}</div>
|
||||
<pre style="text-align:left;">${ex.hint}</pre>
|
||||
`;
|
||||
const clickHint = '<p>Click to see details</p>';
|
||||
toastr.error(
|
||||
`${toast}${clickHint}`,
|
||||
'SlashCommandExecutionError',
|
||||
{ escapeHtml: false, timeOut: 10000, onclick: () => callPopup(toast, 'text') },
|
||||
);
|
||||
} else {
|
||||
toastr.error(result.errorMessage);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
delay(1000).then(() => clearCommandProgressDebounced());
|
||||
|
@ -3509,7 +3608,9 @@ async function executeSlashCommandsWithOptions(text, options = {}) {
|
|||
handleExecutionErrors: false,
|
||||
parserFlags: null,
|
||||
abortController: null,
|
||||
debugController: null,
|
||||
onProgress: null,
|
||||
source: null,
|
||||
}, options);
|
||||
|
||||
let closure;
|
||||
|
@ -3517,6 +3618,8 @@ async function executeSlashCommandsWithOptions(text, options = {}) {
|
|||
closure = parser.parse(text, true, options.parserFlags, options.abortController ?? new SlashCommandAbortController());
|
||||
closure.scope.parent = options.scope;
|
||||
closure.onProgress = options.onProgress;
|
||||
closure.debugController = options.debugController;
|
||||
closure.source = options.source;
|
||||
} catch (e) {
|
||||
if (options.handleParserErrors && e instanceof SlashCommandParserError) {
|
||||
/**@type {SlashCommandParserError}*/
|
||||
|
@ -3548,7 +3651,23 @@ async function executeSlashCommandsWithOptions(text, options = {}) {
|
|||
return result;
|
||||
} catch (e) {
|
||||
if (options.handleExecutionErrors) {
|
||||
toastr.error(e.message);
|
||||
if (e instanceof SlashCommandExecutionError) {
|
||||
/**@type {SlashCommandExecutionError}*/
|
||||
const ex = e;
|
||||
const toast = `
|
||||
<div>${ex.message}</div>
|
||||
<div>Line: ${ex.line} Column: ${ex.column}</div>
|
||||
<pre style="text-align:left;">${ex.hint}</pre>
|
||||
`;
|
||||
const clickHint = '<p>Click to see details</p>';
|
||||
toastr.error(
|
||||
`${toast}${clickHint}`,
|
||||
'SlashCommandExecutionError',
|
||||
{ escapeHtml: false, timeOut: 10000, onclick: () => callPopup(toast, 'text') },
|
||||
);
|
||||
} else {
|
||||
toastr.error(e.message);
|
||||
}
|
||||
const result = new SlashCommandClosureResult();
|
||||
result.isError = true;
|
||||
result.errorMessage = e.message;
|
||||
|
@ -3585,6 +3704,7 @@ async function executeSlashCommands(text, handleParserErrors = true, scope = nul
|
|||
*
|
||||
* @param {HTMLTextAreaElement} textarea The textarea to receive autocomplete
|
||||
* @param {Boolean} isFloating Whether to show the auto complete as a floating window (e.g., large QR editor)
|
||||
* @returns {Promise<AutoComplete>}
|
||||
*/
|
||||
export async function setSlashCommandAutoComplete(textarea, isFloating = false) {
|
||||
function canUseNegativeLookbehind() {
|
||||
|
@ -3608,6 +3728,7 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false)
|
|||
async (text, index) => await parser.getNameAt(text, index),
|
||||
isFloating,
|
||||
);
|
||||
return ac;
|
||||
}
|
||||
/**@type {HTMLTextAreaElement} */
|
||||
const sendTextarea = document.querySelector('#send_textarea');
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue