mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix empty original substitution and bg mobile usability
This commit is contained in:
@ -1524,6 +1524,8 @@ function scrollChatToBottom() {
|
||||
function substituteParams(content, _name1, _name2, _original) {
|
||||
_name1 = _name1 ?? name1;
|
||||
_name2 = _name2 ?? name2;
|
||||
_original = _original || '';
|
||||
|
||||
if (!content) {
|
||||
return '';
|
||||
}
|
||||
@ -1531,10 +1533,7 @@ function substituteParams(content, _name1, _name2, _original) {
|
||||
// Replace {{original}} with the original message
|
||||
// Note: only replace the first instance of {{original}}
|
||||
// This will hopefully prevent the abuse
|
||||
if (_original) {
|
||||
content = content.replace(/{{original}}/i, _original);
|
||||
}
|
||||
|
||||
content = content.replace(/{{original}}/i, _original);
|
||||
content = content.replace(/{{input}}/gi, $('#send_textarea').val());
|
||||
content = content.replace(/{{user}}/gi, _name1);
|
||||
content = content.replace(/{{char}}/gi, _name2);
|
||||
@ -7075,6 +7074,12 @@ $(document).ready(function () {
|
||||
const fileExtension = old_bg.split('.').pop();
|
||||
const old_bg_extensionless = old_bg.replace(`.${fileExtension}`, '');
|
||||
const new_bg_extensionless = await callPopup('<h3>Enter new background name:</h3>', 'input', old_bg_extensionless);
|
||||
|
||||
if (!new_bg_extensionless) {
|
||||
console.debug('no new_bg_extensionless');
|
||||
return;
|
||||
}
|
||||
|
||||
const new_bg = `${new_bg_extensionless}.${fileExtension}`;
|
||||
|
||||
if (old_bg_extensionless === new_bg_extensionless) {
|
||||
|
Reference in New Issue
Block a user