mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into parser-followup-2
This commit is contained in:
@ -2180,7 +2180,7 @@ function validateStoryString(storyString, params) {
|
||||
validateMissingField('personality');
|
||||
validateMissingField('persona');
|
||||
validateMissingField('scenario');
|
||||
validateMissingField('system');
|
||||
// validateMissingField('system');
|
||||
validateMissingField('wiBefore', 'loreBefore');
|
||||
validateMissingField('wiAfter', 'loreAfter');
|
||||
|
||||
@ -2973,7 +2973,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: [
|
||||
@ -2981,12 +2987,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;
|
||||
}
|
||||
|
||||
@ -3333,10 +3339,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();
|
||||
});
|
||||
|
||||
@ -3362,11 +3369,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();
|
||||
});
|
||||
|
||||
@ -4065,13 +4073,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',
|
||||
|
Reference in New Issue
Block a user