mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into neo-server
This commit is contained in:
@ -18,7 +18,7 @@
|
|||||||
"input_suffix": "<|eot_id|>",
|
"input_suffix": "<|eot_id|>",
|
||||||
"system_suffix": "<|eot_id|>",
|
"system_suffix": "<|eot_id|>",
|
||||||
"user_alignment_message": "",
|
"user_alignment_message": "",
|
||||||
"system_same_as_user": false,
|
"system_same_as_user": true,
|
||||||
"last_system_sequence": "",
|
"last_system_sequence": "",
|
||||||
"name": "Llama 3 Instruct"
|
"name": "Llama 3 Instruct"
|
||||||
}
|
}
|
||||||
|
@ -6773,8 +6773,9 @@ function select_rm_info(type, charId, previousCharId = null) {
|
|||||||
importFlashTimeout = setTimeout(function () {
|
importFlashTimeout = setTimeout(function () {
|
||||||
if (type === 'char_import' || type === 'char_create') {
|
if (type === 'char_import' || type === 'char_create') {
|
||||||
// Find the page at which the character is located
|
// Find the page at which the character is located
|
||||||
|
const avatarFileName = `${charId}.png`;
|
||||||
const charData = getEntitiesList({ doFilter: true });
|
const charData = getEntitiesList({ doFilter: true });
|
||||||
const charIndex = charData.findIndex((x) => x?.item?.avatar?.startsWith(charId));
|
const charIndex = charData.findIndex((x) => x?.item?.avatar?.startsWith(avatarFileName));
|
||||||
|
|
||||||
if (charIndex === -1) {
|
if (charIndex === -1) {
|
||||||
console.log(`Could not find character ${charId} in the list`);
|
console.log(`Could not find character ${charId} in the list`);
|
||||||
@ -6784,7 +6785,7 @@ function select_rm_info(type, charId, previousCharId = null) {
|
|||||||
try {
|
try {
|
||||||
const perPage = Number(localStorage.getItem('Characters_PerPage')) || per_page_default;
|
const perPage = Number(localStorage.getItem('Characters_PerPage')) || per_page_default;
|
||||||
const page = Math.floor(charIndex / perPage) + 1;
|
const page = Math.floor(charIndex / perPage) + 1;
|
||||||
const selector = `#rm_print_characters_block [title^="${charId}"]`;
|
const selector = `#rm_print_characters_block [title*="${avatarFileName}"]`;
|
||||||
$('#rm_print_characters_pagination').pagination('go', page);
|
$('#rm_print_characters_pagination').pagination('go', page);
|
||||||
|
|
||||||
waitUntilCondition(() => document.querySelector(selector) !== null).then(() => {
|
waitUntilCondition(() => document.querySelector(selector) !== null).then(() => {
|
||||||
|
@ -1398,7 +1398,8 @@ class PromptManager {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const rangeBlockDiv = promptManagerDiv.querySelector('.range-block');
|
const rangeBlockDiv = promptManagerDiv.querySelector('.range-block');
|
||||||
rangeBlockDiv.insertAdjacentHTML('beforeend', footerHtml);
|
const headerDiv = promptManagerDiv.querySelector('.completion_prompt_manager_header');
|
||||||
|
headerDiv.insertAdjacentHTML('afterend', footerHtml);
|
||||||
rangeBlockDiv.querySelector('#prompt-manager-reset-character').addEventListener('click', this.handleCharacterReset);
|
rangeBlockDiv.querySelector('#prompt-manager-reset-character').addEventListener('click', this.handleCharacterReset);
|
||||||
|
|
||||||
const footerDiv = rangeBlockDiv.querySelector(`.${this.configuration.prefix}prompt_manager_footer`);
|
const footerDiv = rangeBlockDiv.querySelector(`.${this.configuration.prefix}prompt_manager_footer`);
|
||||||
@ -1427,7 +1428,12 @@ class PromptManager {
|
|||||||
|
|
||||||
rangeBlockDiv.insertAdjacentHTML('beforeend', exportPopup);
|
rangeBlockDiv.insertAdjacentHTML('beforeend', exportPopup);
|
||||||
|
|
||||||
let exportPopper = Popper.createPopper(
|
// Destroy previous popper instance if it exists
|
||||||
|
if (this.exportPopper) {
|
||||||
|
this.exportPopper.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.exportPopper = Popper.createPopper(
|
||||||
document.getElementById('prompt-manager-export'),
|
document.getElementById('prompt-manager-export'),
|
||||||
document.getElementById('prompt-manager-export-format-popup'),
|
document.getElementById('prompt-manager-export-format-popup'),
|
||||||
{ placement: 'bottom' },
|
{ placement: 'bottom' },
|
||||||
@ -1440,7 +1446,7 @@ class PromptManager {
|
|||||||
if (show) popup.removeAttribute('data-show');
|
if (show) popup.removeAttribute('data-show');
|
||||||
else popup.setAttribute('data-show', '');
|
else popup.setAttribute('data-show', '');
|
||||||
|
|
||||||
exportPopper.update();
|
this.exportPopper.update();
|
||||||
};
|
};
|
||||||
|
|
||||||
footerDiv.querySelector('#prompt-manager-import').addEventListener('click', this.handleImport);
|
footerDiv.querySelector('#prompt-manager-import').addEventListener('click', this.handleImport);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { chat, chat_metadata, main_api, getMaxContextSize, getCurrentChatId } from '../script.js';
|
import { chat, chat_metadata, main_api, getMaxContextSize, getCurrentChatId, substituteParams } from '../script.js';
|
||||||
import { timestampToMoment, isDigitsOnly, getStringHash } from './utils.js';
|
import { timestampToMoment, isDigitsOnly, getStringHash } from './utils.js';
|
||||||
import { textgenerationwebui_banned_in_macros } from './textgen-settings.js';
|
import { textgenerationwebui_banned_in_macros } from './textgen-settings.js';
|
||||||
import { replaceInstructMacros } from './instruct-mode.js';
|
import { replaceInstructMacros } from './instruct-mode.js';
|
||||||
@ -6,6 +6,12 @@ import { replaceVariableMacros } from './variables.js';
|
|||||||
|
|
||||||
// Register any macro that you want to leave in the compiled story string
|
// Register any macro that you want to leave in the compiled story string
|
||||||
Handlebars.registerHelper('trim', () => '{{trim}}');
|
Handlebars.registerHelper('trim', () => '{{trim}}');
|
||||||
|
// Catch-all helper for any macro that is not defined for story strings
|
||||||
|
Handlebars.registerHelper('helperMissing', function () {
|
||||||
|
const options = arguments[arguments.length - 1];
|
||||||
|
const macroName = options.name;
|
||||||
|
return substituteParams(`{{${macroName}}}`);
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a hashed id of the current chat from the metadata.
|
* Gets a hashed id of the current chat from the metadata.
|
||||||
|
Reference in New Issue
Block a user