mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add settings for multiple expressions
This commit is contained in:
@@ -152,8 +152,18 @@ export const extension_settings = {
|
|||||||
refine_mode: false,
|
refine_mode: false,
|
||||||
},
|
},
|
||||||
expressions: {
|
expressions: {
|
||||||
|
/** @type {number} see `EXPRESSION_API` */
|
||||||
|
api: undefined,
|
||||||
/** @type {string[]} */
|
/** @type {string[]} */
|
||||||
custom: [],
|
custom: [],
|
||||||
|
showDefault: false,
|
||||||
|
translate: false,
|
||||||
|
/** @type {string} */
|
||||||
|
fallback_expression: undefined,
|
||||||
|
/** @type {string} */
|
||||||
|
llmPrompt: undefined,
|
||||||
|
allowMultiple: true,
|
||||||
|
rerollIfSame: false,
|
||||||
},
|
},
|
||||||
connectionManager: {
|
connectionManager: {
|
||||||
selectedProfile: '',
|
selectedProfile: '',
|
||||||
|
@@ -1588,10 +1588,10 @@ async function setExpression(character, expression, force = false) {
|
|||||||
|
|
||||||
let spriteFile = sprite.files[0];
|
let spriteFile = sprite.files[0];
|
||||||
|
|
||||||
// Calculate next expression
|
// Calculate next expression, if multiple are allowed
|
||||||
if (sprite.files.length > 1) {
|
if (extension_settings.expressions.allowMultiple && sprite.files.length > 1) {
|
||||||
let possibleFiles = sprite.files;
|
let possibleFiles = sprite.files;
|
||||||
if (extension_settings.expressions_reroll_if_same) {
|
if (extension_settings.expressions.rerollIfSame) {
|
||||||
possibleFiles = possibleFiles.filter(x => x.imageSrc !== prevExpressionSrc);
|
possibleFiles = possibleFiles.filter(x => x.imageSrc !== prevExpressionSrc);
|
||||||
}
|
}
|
||||||
spriteFile = possibleFiles[Math.floor(Math.random() * possibleFiles.length)];
|
spriteFile = possibleFiles[Math.floor(Math.random() * possibleFiles.length)];
|
||||||
@@ -2141,6 +2141,14 @@ function migrateSettings() {
|
|||||||
extension_settings.expressions.translate = !!$(this).prop('checked');
|
extension_settings.expressions.translate = !!$(this).prop('checked');
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
$('#expressions_allow_multiple').prop('checked', extension_settings.expressions.allowMultiple).on('input', function () {
|
||||||
|
extension_settings.expressions.allowMultiple = !!$(this).prop('checked');
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
|
$('#expressions_reroll_if_same').prop('checked', extension_settings.expressions.rerollIfSame).on('input', function () {
|
||||||
|
extension_settings.expressions.rerollIfSame = !!$(this).prop('checked');
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
$('#expression_override_cleanup_button').on('click', onClickExpressionOverrideRemoveAllButton);
|
$('#expression_override_cleanup_button').on('click', onClickExpressionOverrideRemoveAllButton);
|
||||||
$(document).on('dragstart', '.expression', (e) => {
|
$(document).on('dragstart', '.expression', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@@ -52,6 +52,16 @@
|
|||||||
<i id="expression_custom_remove" class="menu_button fa-solid fa-xmark margin0" title="Remove"></i>
|
<i id="expression_custom_remove" class="menu_button fa-solid fa-xmark margin0" title="Remove"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="m-b-1 m-t-1">
|
||||||
|
<label class="checkbox_label" for="expressions_allow_multiple">
|
||||||
|
<input id="expressions_allow_multiple" type="checkbox">
|
||||||
|
<span data-i18n="Allow multiple files per expression">Allow multiple files per expression</span>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox_label" for="expressions_reroll_if_same">
|
||||||
|
<input id="expressions_reroll_if_same" type="checkbox">
|
||||||
|
<span data-i18n="Re-roll if same expression is used again">Re-roll if same expression is used again</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div id="no_chat_expressions" data-i18n="Open a chat to see the character expressions.">
|
<div id="no_chat_expressions" data-i18n="Open a chat to see the character expressions.">
|
||||||
Open a chat to see the character expressions.
|
Open a chat to see the character expressions.
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user