Fix Refresh RPG Info to treat placeholder data as first-time generation and remove cache clear popups

This commit is contained in:
Spicy_Marinara
2025-10-15 08:44:24 +02:00
parent 5a204df931
commit 8e624a807d
+9 -5
View File
@@ -903,7 +903,6 @@ function setupSettingsPopup() {
// Clear cache button
$('#rpg-clear-cache').on('click', function() {
if (confirm('Are you sure you want to clear all cached RPG data for this chat? This will reset Stats, Info Box, and Mind Reading.')) {
// Clear the data
lastGeneratedData.userStats = null;
lastGeneratedData.infoBox = null;
@@ -969,8 +968,6 @@ function setupSettingsPopup() {
updateChatThoughts(); // Clear the thought bubble in chat
// console.log('[RPG Companion] Chat cache cleared');
alert('Chat cache cleared successfully!');
}
});
}
@@ -1575,8 +1572,15 @@ async function updateRPGData() {
// characterThoughts: lastGeneratedData.characterThoughts ? 'exists' : 'null'
// });
// If there's no committed data yet (first time), commit immediately
if (!committedTrackerData.userStats && !committedTrackerData.infoBox && !committedTrackerData.characterThoughts) {
// If there's no committed data yet (first time) or only has placeholder data, commit immediately
const hasNoRealData = !committedTrackerData.userStats && !committedTrackerData.infoBox && !committedTrackerData.characterThoughts;
const hasOnlyPlaceholderData = (
(!committedTrackerData.userStats || committedTrackerData.userStats === '') &&
(!committedTrackerData.infoBox || committedTrackerData.infoBox === 'Info Box\n---\n' || committedTrackerData.infoBox === '') &&
(!committedTrackerData.characterThoughts || committedTrackerData.characterThoughts === 'Present Characters\n---\n' || committedTrackerData.characterThoughts === '')
);
if (hasNoRealData || hasOnlyPlaceholderData) {
committedTrackerData.userStats = parsedData.userStats;
committedTrackerData.infoBox = parsedData.infoBox;
committedTrackerData.characterThoughts = parsedData.characterThoughts;