Fix: Strip thinking tags from parser and persist tracker data on page refresh

- Added removal of <think> and <thinking> tags from AI responses before parsing
- Fixed Info Box display to use committedTrackerData as fallback after page refresh
- Fixed Present Characters display to use committedTrackerData as fallback after page refresh
- Fixed 4-part character format handling in updateCharacterField to preserve thoughts
- Ensures Recent Events and all tracker data persist correctly across page reloads
This commit is contained in:
Spicy_Marinara
2025-10-28 18:07:15 +01:00
parent a063ae780b
commit 13019c65ee
3 changed files with 57 additions and 19 deletions
+6 -3
View File
@@ -64,8 +64,11 @@ export function renderInfoBox() {
$infoBoxContainer.addClass('rpg-content-updating');
}
// Use committedTrackerData as fallback if lastGeneratedData is empty (e.g., after page refresh)
const infoBoxData = lastGeneratedData.infoBox || committedTrackerData.infoBox;
// If no data yet, show placeholder
if (!lastGeneratedData.infoBox) {
if (!infoBoxData) {
const placeholderHtml = `
<div class="rpg-dashboard rpg-dashboard-row-1">
<div class="rpg-dashboard-widget rpg-placeholder-widget">
@@ -81,10 +84,10 @@ export function renderInfoBox() {
return;
}
// console.log('[RPG Companion] renderInfoBox called with data:', lastGeneratedData.infoBox);
// console.log('[RPG Companion] renderInfoBox called with data:', infoBoxData);
// Parse the info box data
const lines = lastGeneratedData.infoBox.split('\n');
const lines = infoBoxData.split('\n');
// console.log('[RPG Companion] Info Box split into lines:', lines);
const data = {
date: '',