Fix {{original}}

This commit is contained in:
Cohee 2024-01-28 17:31:19 +02:00
parent 4bd7364a8e
commit 8037e31c53

View File

@ -2163,12 +2163,9 @@ function scrollChatToBottom() {
function substituteParams(content, _name1, _name2, _original, _group, _replaceCharacterCard = true) { function substituteParams(content, _name1, _name2, _original, _group, _replaceCharacterCard = true) {
const environment = {}; const environment = {};
let substitutedOriginal = false; if (typeof _original === 'string') {
environment.original = () => { environment.original = _original;
// Only substitute {{original}} on its first occurrence }
if (substitutedOriginal || typeof _original !== 'string') return '';
return _original;
};
if (_replaceCharacterCard) { if (_replaceCharacterCard) {
const fields = getCharacterCardFields(); const fields = getCharacterCardFields();
@ -2487,7 +2484,7 @@ function showStopButton() {
function hideStopButton() { function hideStopButton() {
// prevent NOOP, because hideStopButton() gets called multiple times // prevent NOOP, because hideStopButton() gets called multiple times
if($('#mes_stop').css('display') !== 'none') { if ($('#mes_stop').css('display') !== 'none') {
$('#mes_stop').css({ 'display': 'none' }); $('#mes_stop').css({ 'display': 'none' });
eventSource.emit(event_types.GENERATION_ENDED, chat.length); eventSource.emit(event_types.GENERATION_ENDED, chat.length);
} }