Fix Refresh RPG Info to treat placeholder data as first-time generation and remove cache clear popups
This commit is contained in:
@@ -903,7 +903,6 @@ function setupSettingsPopup() {
|
|||||||
|
|
||||||
// Clear cache button
|
// Clear cache button
|
||||||
$('#rpg-clear-cache').on('click', function() {
|
$('#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
|
// Clear the data
|
||||||
lastGeneratedData.userStats = null;
|
lastGeneratedData.userStats = null;
|
||||||
lastGeneratedData.infoBox = null;
|
lastGeneratedData.infoBox = null;
|
||||||
@@ -969,8 +968,6 @@ function setupSettingsPopup() {
|
|||||||
updateChatThoughts(); // Clear the thought bubble in chat
|
updateChatThoughts(); // Clear the thought bubble in chat
|
||||||
|
|
||||||
// console.log('[RPG Companion] Chat cache cleared');
|
// console.log('[RPG Companion] Chat cache cleared');
|
||||||
alert('Chat cache cleared successfully!');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1575,8 +1572,15 @@ async function updateRPGData() {
|
|||||||
// characterThoughts: lastGeneratedData.characterThoughts ? 'exists' : 'null'
|
// characterThoughts: lastGeneratedData.characterThoughts ? 'exists' : 'null'
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// If there's no committed data yet (first time), commit immediately
|
// If there's no committed data yet (first time) or only has placeholder data, commit immediately
|
||||||
if (!committedTrackerData.userStats && !committedTrackerData.infoBox && !committedTrackerData.characterThoughts) {
|
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.userStats = parsedData.userStats;
|
||||||
committedTrackerData.infoBox = parsedData.infoBox;
|
committedTrackerData.infoBox = parsedData.infoBox;
|
||||||
committedTrackerData.characterThoughts = parsedData.characterThoughts;
|
committedTrackerData.characterThoughts = parsedData.characterThoughts;
|
||||||
|
|||||||
Reference in New Issue
Block a user