mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-01-18 20:39:58 +01:00
Fix swipe buttons display when using /comment after last AI message
This commit is contained in:
parent
f732b8ae4c
commit
ef9cdf64cf
@ -2035,18 +2035,19 @@ function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll = true
|
|||||||
const messageId = forceId ?? chat.length - 1;
|
const messageId = forceId ?? chat.length - 1;
|
||||||
$('#chat').find(`[mesid="${messageId}"]`).find('.mes_text').append(messageText);
|
$('#chat').find(`[mesid="${messageId}"]`).find('.mes_text').append(messageText);
|
||||||
appendMediaToMessage(mes, newMessage);
|
appendMediaToMessage(mes, newMessage);
|
||||||
hideSwipeButtons(newMessageId);
|
hideSwipeButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
addCopyToCodeBlocks(newMessage);
|
addCopyToCodeBlocks(newMessage);
|
||||||
|
|
||||||
|
$('#chat .mes').last().addClass('last_mes');
|
||||||
|
$('#chat .mes').eq(-2).removeClass('last_mes');
|
||||||
|
|
||||||
|
hideSwipeButtons();
|
||||||
|
showSwipeButtons();
|
||||||
|
|
||||||
// Don't scroll if not inserting last
|
// Don't scroll if not inserting last
|
||||||
if (!insertAfter && !insertBefore && scroll) {
|
if (!insertAfter && !insertBefore && scroll) {
|
||||||
$('#chat .mes').last().addClass('last_mes');
|
|
||||||
$('#chat .mes').eq(-2).removeClass('last_mes');
|
|
||||||
|
|
||||||
hideSwipeButtons(newMessageId);
|
|
||||||
showSwipeButtons(newMessageId);
|
|
||||||
scrollChatToBottom();
|
scrollChatToBottom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6475,7 +6476,7 @@ function callPopup(text, type, inputValue = '', { okButton, rows, wide, large }
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSwipeButtons(id = chat.length - 1) {
|
function showSwipeButtons() {
|
||||||
if (chat.length === 0) {
|
if (chat.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -6483,10 +6484,9 @@ function showSwipeButtons(id = chat.length - 1) {
|
|||||||
if (
|
if (
|
||||||
chat[chat.length - 1].is_system ||
|
chat[chat.length - 1].is_system ||
|
||||||
!swipes ||
|
!swipes ||
|
||||||
$('.mes:last').attr('mesid') < 0 ||
|
Number($('.mes:last').attr('mesid')) < 0 ||
|
||||||
chat[chat.length - 1].is_user ||
|
chat[chat.length - 1].is_user ||
|
||||||
chat[chat.length - 1].extra?.image ||
|
chat[chat.length - 1].extra?.image ||
|
||||||
id < 0 ||
|
|
||||||
(selected_group && is_group_generating)
|
(selected_group && is_group_generating)
|
||||||
) { return; }
|
) { return; }
|
||||||
|
|
||||||
@ -6505,7 +6505,7 @@ function showSwipeButtons(id = chat.length - 1) {
|
|||||||
chat[chat.length - 1]['swipes'][0] = chat[chat.length - 1]['mes']; //assign swipe array with last message from chat
|
chat[chat.length - 1]['swipes'][0] = chat[chat.length - 1]['mes']; //assign swipe array with last message from chat
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentMessage = $('#chat').children().filter(`[mesid="${id}"]`);
|
const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`);
|
||||||
const swipeId = chat[chat.length - 1].swipe_id;
|
const swipeId = chat[chat.length - 1].swipe_id;
|
||||||
var swipesCounterHTML = (`${(swipeId + 1)}/${(chat[chat.length - 1].swipes.length)}`);
|
var swipesCounterHTML = (`${(swipeId + 1)}/${(chat[chat.length - 1].swipes.length)}`);
|
||||||
|
|
||||||
@ -6530,10 +6530,10 @@ function showSwipeButtons(id = chat.length - 1) {
|
|||||||
//console.log(chat[chat.length - 1].swipes.length);
|
//console.log(chat[chat.length - 1].swipes.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideSwipeButtons(id = chat.length - 1) {
|
function hideSwipeButtons() {
|
||||||
//console.log('hideswipebuttons entered');
|
//console.log('hideswipebuttons entered');
|
||||||
$('#chat').children().filter(`[mesid="${id}"]`).children('.swipe_right').css('display', 'none');
|
$('#chat').find('.swipe_right').css('display', 'none');
|
||||||
$('#chat').children().filter(`[mesid="${id}"]`).children('.swipe_left').css('display', 'none');
|
$('#chat').find('.swipe_left').css('display', 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function saveMetadata() {
|
export async function saveMetadata() {
|
||||||
|
Loading…
Reference in New Issue
Block a user