diff --git a/default/settings.json b/default/settings.json index fd4edfda7..f8c4b54bf 100644 --- a/default/settings.json +++ b/default/settings.json @@ -163,6 +163,8 @@ "custom_stopping_strings_macro": true, "fuzzy_search": true, "encode_tags": false, + "enableLabMode": false, + "enableZenSliders": false, "ui_mode": 1 }, "extension_settings": { diff --git a/package-lock.json b/package-lock.json index 64f3f1cae..666982fbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sillytavern", - "version": "1.10.8", + "version": "1.10.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "sillytavern", - "version": "1.10.8", + "version": "1.10.9", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { diff --git a/package.json b/package.json index 39f731ae6..ab117a4a7 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "type": "git", "url": "https://github.com/SillyTavern/SillyTavern.git" }, - "version": "1.10.8", + "version": "1.10.9", "scripts": { "start": "node server.js", "start-multi": "node server.js --disableCsrf", diff --git a/public/css/tags.css b/public/css/tags.css index 788e7dc05..3ad18c468 100644 --- a/public/css/tags.css +++ b/public/css/tags.css @@ -13,7 +13,7 @@ .tag_view_item { display: flex; flex-direction: row; - align-items: baseline; + align-items: center; gap: 10px; margin-bottom: 5px; } diff --git a/public/index.html b/public/index.html index c51302ca2..25fec85c5 100644 --- a/public/index.html +++ b/public/index.html @@ -715,8 +715,8 @@ Temperature
- - + +
@@ -2502,6 +2502,7 @@ + + + +
@@ -3752,7 +3760,7 @@
- +
diff --git a/public/script.js b/public/script.js index 59aba505a..4d7e5d0d3 100644 --- a/public/script.js +++ b/public/script.js @@ -1050,9 +1050,10 @@ function getCharacterBlock(item, id) { template.find('.ch_description').hide(); } - const version = item.data?.character_version || ''; - if (version) { - template.find('.character_version').text(version); + const auxFieldName = power_user.aux_field || 'character_version'; + const auxFieldValue = (item.data && item.data[auxFieldName]) || ''; + if (auxFieldValue) { + template.find('.character_version').text(auxFieldValue); } else { template.find('.character_version').hide(); diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index b40e5f85a..35f7b1c2c 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -371,7 +371,7 @@ function RA_checkOnlineStatus() { connection_made = false; } else { if (online_status !== undefined && online_status !== "no_connection") { - $("#send_textarea").attr("placeholder", `Type a message, or /? for command list`); //on connect, placeholder tells user to type message + $("#send_textarea").attr("placeholder", `Type a message, or /? for help`); //on connect, placeholder tells user to type message $('#send_form').removeClass("no-connection"); $("#API-status-top").removeClass("fa-plug-circle-exclamation redOverlayGlow"); $("#API-status-top").addClass("fa-plug"); diff --git a/public/scripts/personas.js b/public/scripts/personas.js index fc91e8008..8a3f0341d 100644 --- a/public/scripts/personas.js +++ b/public/scripts/personas.js @@ -39,7 +39,23 @@ async function uploadUserAvatar(url, name) { } async function createDummyPersona() { - await uploadUserAvatar(default_avatar); + const personaName = await callPopup('

Enter a name for this persona:

', 'input', ''); + + if (!personaName) { + console.debug('User cancelled creating dummy persona'); + return; + } + + // Date + name (only ASCII) to make it unique + const avatarId = `${Date.now()}-${personaName.replace(/[^a-zA-Z0-9]/g, '')}.png`; + power_user.personas[avatarId] = personaName; + power_user.persona_descriptions[avatarId] = { + description: '', + position: persona_description_positions.IN_PROMPT, + }; + + await uploadUserAvatar(default_avatar, avatarId); + saveSettingsDebounced(); } export async function convertCharacterToPersona(characterId = null) { diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 51f1e1c09..0f24fe0e0 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -220,6 +220,7 @@ let power_user = { encode_tags: false, servers: [], bogus_folders: false, + aux_field: 'character_version', }; let themes = []; @@ -1255,6 +1256,7 @@ function loadPowerUserSettings(settings, data) { $(`#chat_display option[value=${power_user.chat_display}]`).attr("selected", true).trigger('change'); $('#chat_width_slider').val(power_user.chat_width); $("#token_padding").val(power_user.token_padding); + $("#aux_field").val(power_user.aux_field); $("#font_scale").val(power_user.font_scale); $("#font_scale_counter").val(power_user.font_scale); @@ -2832,6 +2834,13 @@ $(document).ready(() => { printCharacters(true); }); + $('#aux_field').on('change', function() { + const value = $(this).find(':selected').val(); + power_user.aux_field = String(value); + saveSettingsDebounced(); + printCharacters(false); + }); + $(document).on('click', '#debug_table [data-debug-function]', function () { const functionId = $(this).data('debug-function'); const functionRecord = debug_functions.find(f => f.functionId === functionId); diff --git a/public/scripts/templates/macros.html b/public/scripts/templates/macros.html index bd58ae1fe..dc2844439 100644 --- a/public/scripts/templates/macros.html +++ b/public/scripts/templates/macros.html @@ -1,26 +1,26 @@ System-wide Replacement Macros (in order of evaluation):
    -
  • {{original}} - global prompts defined in API settings. Only valid in Advanced Definitions prompt overrides.
  • -
  • {{input}} - the user input
  • -
  • {{description}} - the Character's Description
  • -
  • {{personality}} - the Character's Personality
  • -
  • {{scenario}} - the Character's Scenario
  • -
  • {{persona}} - your current Persona Description
  • -
  • {{mesExamples}} - the Character's Dialogue Examples
  • -
  • {{user}} - your current Persona username
  • -
  • {{char}} - the Character's name
  • -
  • {{lastMessageId}} - index # of the latest chat message. Useful for slash command batching.
  • -
  • {{// (note)}} - you can leave a note here, and the macro will be replaced with blank content. Not visible for the AI.
  • -
  • {{time}} - the current time
  • -
  • {{date}} - the current date
  • -
  • {{weekday}} - the current weekday
  • -
  • {{isotime}} - the current ISO date (YYYY-MM-DD)
  • -
  • {{isodate}} - the current ISO time (24-hour clock)
  • -
  • {{datetimeformat …}} - the current date/time in the specified format, e. g. for German date/time: {{datetimeformat DD.MM.YYYY HH:mm}}
  • -
  • {{time_UTC±#}} - the current time in the specified UTC time zone offset, e.g. UTC-4 or UTC+2
  • -
  • {{idle_duration}} - the time since the last user message was sent
  • -
  • {{bias "text here"}} - sets a behavioral bias for the AI until the next user input. Quotes around the text are important.
  • -
  • {{random:(args)}} - returns a random item from the list. (ex: {{random:1,2,3,4}} will return 1 of the 4 numbers at random. Works with text lists too.
  • -
  • {{roll:(formula)}} - rolls a dice. (ex: {{roll:1d6}} will roll a 6-sided dice and return a number between 1 and 6)
  • -
  • {{banned "text here"}} - dynamically add text in the quotes to banned words sequences, if Text Generation WebUI backend used. Do nothing for others backends. Can be used anywhere (Character description, WI, AN, etc.) Quotes around the text are important.
  • +
  • {{original}} – global prompts defined in API settings. Only valid in Advanced Definitions prompt overrides.
  • +
  • {{input}} – the user input
  • +
  • {{description}} – the Character's Description
  • +
  • {{personality}} – the Character's Personality
  • +
  • {{scenario}} – the Character's Scenario
  • +
  • {{persona}} – your current Persona Description
  • +
  • {{mesExamples}} – the Character's Dialogue Examples
  • +
  • {{user}} – your current Persona username
  • +
  • {{char}} – the Character's name
  • +
  • {{lastMessageId}} – index # of the latest chat message. Useful for slash command batching.
  • +
  • {{// (note)}} – you can leave a note here, and the macro will be replaced with blank content. Not visible for the AI.
  • +
  • {{time}} – the current time
  • +
  • {{date}} – the current date
  • +
  • {{weekday}} – the current weekday
  • +
  • {{isotime}} – the current ISO date (YYYY-MM-DD)
  • +
  • {{isodate}} – the current ISO time (24-hour clock)
  • +
  • {{datetimeformat …}} – the current date/time in the specified format, e. g. for German date/time: {{datetimeformat DD.MM.YYYY HH:mm}}
  • +
  • {{time_UTC±#}} – the current time in the specified UTC time zone offset, e.g. UTC-4 or UTC+2
  • +
  • {{idle_duration}} – the time since the last user message was sent
  • +
  • {{bias "text here"}} – sets a behavioral bias for the AI until the next user input. Quotes around the text are important.
  • +
  • {{random:(args)}} – returns a random item from the list. (ex: {{random:1,2,3,4}} will return 1 of the 4 numbers at random. Works with text lists too.
  • +
  • {{roll:(formula)}} – rolls a dice. (ex: {{roll:1d6}} will roll a 6- sided dice and return a number between 1 and 6)
  • +
  • {{banned "text here"}} – dynamically add text in the quotes to banned words sequences, if Text Generation WebUI backend used. Do nothing for others backends. Can be used anywhere (Character description, WI, AN, etc.) Quotes around the text are important.
diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 9b9a6670e..f5f3c60f5 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -269,7 +269,15 @@ function sortEntries(data) { const sortRule = option.data('rule'); const orderSign = sortOrder === 'asc' ? 1 : -1; - if (sortRule === 'priority') { + if (sortRule === 'custom') { + // First by display index, then by order, then by uid + data.sort((a, b) => { + const aValue = a.displayIndex; + const bValue = b.displayIndex; + + return (aValue - bValue || b.order - a.order || a.uid - b.uid); + }); + } else if (sortRule === 'priority') { // First constant, then normal, then disabled. Then sort by order data.sort((a, b) => { const aValue = a.constant ? 0 : a.disable ? 2 : 1; @@ -375,7 +383,7 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) { nextText: '>', formatNavigator: PAGINATION_TEMPLATE, showNavigator: true, - callback: function (page) { + callback: function (/** @type {object[]} */ page) { $("#world_popup_entries_list").empty(); const keywordHeaders = `
@@ -399,6 +407,12 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) {
` const blocks = page.map(entry => getWorldEntry(name, data, entry)).filter(x => x); + const isCustomOrder = $('#world_info_sort_order').find(':selected').data('rule') === 'custom'; + if (!isCustomOrder) { + blocks.forEach(block => { + block.find('.drag-handle').remove(); + }); + } $("#world_popup_entries_list").append(keywordHeaders); $("#world_popup_entries_list").append(blocks); }, @@ -500,6 +514,8 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) { delay: getSortableDelay(), handle: ".drag-handle", stop: async function (event, ui) { + const firstEntryUid = $('#world_popup_entries_list .world_entry').first().data('uid'); + const minDisplayIndex = data?.entries[firstEntryUid]?.displayIndex ?? 0; $('#world_popup_entries_list .world_entry').each(function (index) { const uid = $(this).data('uid'); @@ -511,8 +527,8 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) { return; } - item.displayIndex = index; - setOriginalDataValue(data, uid, 'extensions.display_index', index); + item.displayIndex = minDisplayIndex + index; + setOriginalDataValue(data, uid, 'extensions.display_index', item.displayIndex); }); console.table(Object.keys(data.entries).map(uid => data.entries[uid]).map(x => ({ uid: x.uid, key: x.key.join(','), displayIndex: x.displayIndex }))); @@ -1582,9 +1598,7 @@ async function checkWorldInfo(chat, maxContext) { over_max = ( world_info_min_activations_depth_max > 0 && minActivationMsgIndex > world_info_min_activations_depth_max - ) || ( - minActivationMsgIndex >= chat.length - ) + ) || (minActivationMsgIndex >= chat.length) if (!over_max) { needsToScan = true textToScan = transformString(chat.slice(minActivationMsgIndex, minActivationMsgIndex + 1).join("")); @@ -2167,11 +2181,9 @@ jQuery(() => { updateEditor(navigation_option.previous); }); - $('#world_info_sort_order').on('change', function (e) { - if (e.target instanceof HTMLOptionElement) { - localStorage.setItem(SORT_ORDER_KEY, e.target.value); - } - + $('#world_info_sort_order').on('change', function () { + const value = String($(this).find(":selected").val()); + localStorage.setItem(SORT_ORDER_KEY, value); updateEditor(navigation_option.none); })