From 2ee081a6191d86ca45a2621fff4caa2599f61924 Mon Sep 17 00:00:00 2001 From: Tremendoussly Date: Tue, 14 Apr 2026 17:08:42 +0200 Subject: [PATCH] Clean up post-merge delete handler artifacts --- src/systems/integration/sillytavern.js | 71 -------------------------- 1 file changed, 71 deletions(-) diff --git a/src/systems/integration/sillytavern.js b/src/systems/integration/sillytavern.js index e2709e4..518a527 100644 --- a/src/systems/integration/sillytavern.js +++ b/src/systems/integration/sillytavern.js @@ -770,77 +770,6 @@ export function onMessageDeleted() { saveChatData(); } -/** - * Event handler for when a message is deleted. - * Re-syncs lastGeneratedData, committedTrackerData, and all UI panels to the - * new last assistant message's active swipe — or clears everything if no - * assistant messages remain. - */ -/* Removed during merge resolution. - return; - - // console.log('[RPG Companion] 🗑️ EVENT: onMessageDeleted'); - - // Invalidate any pending or in-flight separate-mode generation so - // its result is not applied to the (now-changed) chat tail. - incrementSeparateGenerationId(); - - const currentChat = getContext().chat; - - // Walk backward to find the new last assistant message. - let lastAssistantIndex = -1; - for (let i = currentChat.length - 1; i >= 0; i--) { - if (!currentChat[i].is_user && !currentChat[i].is_system) { - lastAssistantIndex = i; - break; - } - } - - if (lastAssistantIndex === -1) { - // No assistant messages remain — clear all state. - lastGeneratedData.userStats = null; - lastGeneratedData.infoBox = null; - lastGeneratedData.characterThoughts = null; - committedTrackerData.userStats = null; - committedTrackerData.infoBox = null; - committedTrackerData.characterThoughts = null; - // console.log('[RPG Companion] 🗑️ No assistant messages remain — cleared all tracker state.'); - } else { - // Restore display state from the new tail message's active swipe. - // If the message has no swipe data yet, null the fields so we - // don't show stale data from the deleted message. - const hadSwipeData = syncLastGeneratedDataFromSwipeStore(currentChat); - if (!hadSwipeData) { - lastGeneratedData.userStats = null; - lastGeneratedData.infoBox = null; - lastGeneratedData.characterThoughts = null; - committedTrackerData.userStats = null; - committedTrackerData.infoBox = null; - committedTrackerData.characterThoughts = null; - // console.log('[RPG Companion] 🗑️ No swipe data for last assistant message — cleared display state.'); - } - - // Commit context from the message *before* the new tail assistant message, - // so any subsequent generation uses the correct N-1 world state. - commitTrackerDataFromPriorMessage(lastAssistantIndex); - } - - // Re-render all panels. - renderUserStats(); - renderInfoBox(); - renderThoughts(); - renderInventory(); - renderQuests(); - renderMusicPlayer($musicPlayerContainer[0]); - - // Update widget strips. - updateFabWidgets(); - updateStripWidgets(); - - // Persist updated state. - saveChatData(); -*/ - /** * Update the persona avatar image when user switches personas */