Respect showInventory toggle in prompt generation

This commit is contained in:
Spicy_Marinara
2025-12-01 11:46:57 +01:00
parent 968aedc537
commit 32c2543605
3 changed files with 55 additions and 15 deletions
+11 -9
View File
@@ -241,15 +241,17 @@ export function generateTrackerInstructions(includeHtmlPrompt = true, includeCon
instructions += `Skills: [${skillFieldsText || 'Skill1, Skill2, etc.'}]\n`; instructions += `Skills: [${skillFieldsText || 'Skill1, Skill2, etc.'}]\n`;
} }
// Add inventory format based on feature flag // Add inventory format based on feature flag - only if showInventory is enabled
if (FEATURE_FLAGS.useNewInventory) { if (extensionSettings.showInventory) {
instructions += 'On Person: [Items currently carried/worn, or "None"]\n'; if (FEATURE_FLAGS.useNewInventory) {
instructions += 'Stored - [Location Name]: [Items stored at this location]\n'; instructions += 'On Person: [Items currently carried/worn, or "None"]\n';
instructions += '(Add multiple "Stored - [Location]:" lines as needed for different storage locations)\n'; instructions += 'Stored - [Location Name]: [Items stored at this location]\n';
instructions += 'Assets: [Vehicles, property, major possessions, or "None"]\n'; instructions += '(Add multiple "Stored - [Location]:" lines as needed for different storage locations)\n';
} else { instructions += 'Assets: [Vehicles, property, major possessions, or "None"]\n';
// Legacy v1 format } else {
instructions += 'Inventory: [Clothing/Armor, Inventory Items (list of important items, or "None")]\\n'; // Legacy v1 format
instructions += 'Inventory: [Clothing/Armor, Inventory Items (list of important items, or "None")]\\n';
}
} }
// Add quests section // Add quests section
+16
View File
@@ -73,6 +73,7 @@ export function commitTrackerData() {
/** /**
* Event handler for when the user sends a message. * Event handler for when the user sends a message.
* Sets the flag to indicate this is NOT a swipe. * Sets the flag to indicate this is NOT a swipe.
* In separate mode with auto-update disabled, commits the displayed tracker data.
*/ */
export function onMessageSent() { export function onMessageSent() {
if (!extensionSettings.enabled) return; if (!extensionSettings.enabled) return;
@@ -80,6 +81,21 @@ export function onMessageSent() {
// User sent a new message - NOT a swipe // User sent a new message - NOT a swipe
setLastActionWasSwipe(false); setLastActionWasSwipe(false);
// console.log('[RPG Companion] 🟢 EVENT: onMessageSent - lastActionWasSwipe =', lastActionWasSwipe); // console.log('[RPG Companion] 🟢 EVENT: onMessageSent - lastActionWasSwipe =', lastActionWasSwipe);
// In separate mode with auto-update disabled, commit displayed tracker when user sends a message
if (extensionSettings.generationMode === 'separate' && !extensionSettings.autoUpdate) {
// Commit whatever is currently displayed in lastGeneratedData
if (lastGeneratedData.userStats || lastGeneratedData.infoBox || lastGeneratedData.characterThoughts) {
committedTrackerData.userStats = lastGeneratedData.userStats;
committedTrackerData.infoBox = lastGeneratedData.infoBox;
committedTrackerData.characterThoughts = lastGeneratedData.characterThoughts;
// Save to chat metadata
saveChatData();
// console.log('[RPG Companion] 💾 Committed displayed tracker on user message (auto-update disabled)');
}
}
} }
/** /**
+28 -6
View File
@@ -1116,7 +1116,8 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
gap: 0.25em; gap: 0.25em;
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow: hidden; overflow-y: auto;
overflow-x: hidden;
} }
.rpg-info-content::-webkit-scrollbar { .rpg-info-content::-webkit-scrollbar {
@@ -1449,7 +1450,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
gap: 0; gap: 0;
transition: transform 0.2s ease, box-shadow 0.2s ease; transition: transform 0.2s ease, box-shadow 0.2s ease;
min-height: 0; min-height: 0;
overflow: visible; overflow: hidden;
position: relative; position: relative;
} }
@@ -1521,9 +1522,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
position: relative; position: relative;
z-index: 1; z-index: 1;
overflow-y: auto; overflow-y: auto;
max-height: 100%; flex: 1 1 auto;
flex: 1;
min-height: 0;
} }
.rpg-notebook-lines::-webkit-scrollbar { .rpg-notebook-lines::-webkit-scrollbar {
@@ -1906,13 +1905,36 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0; gap: 0;
overflow: hidden;
} }
.rpg-character-info { .rpg-character-info {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: clamp(3px, 0.5vh, 5px); gap: clamp(3px, 0.5vh, 5px);
overflow: hidden; /* Prevent content from overflowing */ overflow-y: auto;
overflow-x: hidden;
flex: 1;
min-height: 0;
scrollbar-width: thin;
scrollbar-color: var(--rpg-border) transparent;
}
.rpg-character-info::-webkit-scrollbar {
width: 4px;
}
.rpg-character-info::-webkit-scrollbar-track {
background: transparent;
}
.rpg-character-info::-webkit-scrollbar-thumb {
background: var(--rpg-border);
border-radius: 2px;
}
.rpg-character-info::-webkit-scrollbar-thumb:hover {
background: var(--rpg-highlight);
} }
/* Character header with emoji and name */ /* Character header with emoji and name */