mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix swipes counter on old chats. Remove force height on last message
This commit is contained in:
@@ -2677,12 +2677,23 @@ function read_bg_load(input) {
|
||||
|
||||
function showSwipeButtons() {
|
||||
if (
|
||||
chat[chat.length - 1].name === 'TavernAI' ||
|
||||
chat[chat.length - 1].is_system ||
|
||||
!swipes ||
|
||||
$('.mes:last').attr('mesid') <= 0 ||
|
||||
chat[chat.length - 1].is_user ||
|
||||
count_view_mes <= 1
|
||||
) { return; }
|
||||
|
||||
//had to add this to make the swipe counter work
|
||||
//(copied from the onclick functions for swipe buttons..
|
||||
//don't know why the array isn't set for non-swipe messsages in Generate or addOneMessage..)
|
||||
|
||||
if (chat[chat.length - 1]['swipe_id'] === undefined) { // if there is no swipe-message in the last spot of the chat array
|
||||
chat[chat.length - 1]['swipe_id'] = 0; // set it to id 0
|
||||
chat[chat.length - 1]['swipes'] = []; // empty the array
|
||||
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="${count_view_mes - 1}"]`);
|
||||
const swipeId = chat[chat.length - 1].swipe_id;
|
||||
var swipesCounterHTML = (`${(swipeId + 1)}/${(chat[chat.length - 1].swipes.length)}`);
|
||||
@@ -2694,16 +2705,6 @@ function showSwipeButtons() {
|
||||
currentMessage.children('.swipe_right').css('display', 'flex');
|
||||
currentMessage.children('.swipe_right').css('opacity', '0.3');
|
||||
}
|
||||
|
||||
//had to add this to make the swipe counter work
|
||||
//(copied from the onclick functions for swipe buttons..
|
||||
//don't know why the array isn't set for non-swipe messsages in Generate or addOneMessage..)
|
||||
|
||||
if (chat[chat.length - 1]['swipe_id'] === undefined) { // if there is no swipe-message in the last spot of the chat array
|
||||
chat[chat.length - 1]['swipe_id'] = 0; // set it to id 0
|
||||
chat[chat.length - 1]['swipes'] = []; // empty the array
|
||||
chat[chat.length - 1]['swipes'][0] = chat[chat.length - 1]['mes']; //assign swipe array with last message from chat
|
||||
}
|
||||
//console.log((chat[chat.length - 1]));
|
||||
if (is_send_press === false && (chat[chat.length - 1].swipes.length - swipeId) === 1) {
|
||||
console.log('highlighting R swipe');
|
||||
|
Reference in New Issue
Block a user