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`;
}
// Add inventory format based on feature flag
if (FEATURE_FLAGS.useNewInventory) {
instructions += 'On Person: [Items currently carried/worn, or "None"]\n';
instructions += 'Stored - [Location Name]: [Items stored at this location]\n';
instructions += '(Add multiple "Stored - [Location]:" lines as needed for different storage locations)\n';
instructions += 'Assets: [Vehicles, property, major possessions, or "None"]\n';
} else {
// Legacy v1 format
instructions += 'Inventory: [Clothing/Armor, Inventory Items (list of important items, or "None")]\\n';
// Add inventory format based on feature flag - only if showInventory is enabled
if (extensionSettings.showInventory) {
if (FEATURE_FLAGS.useNewInventory) {
instructions += 'On Person: [Items currently carried/worn, or "None"]\n';
instructions += 'Stored - [Location Name]: [Items stored at this location]\n';
instructions += '(Add multiple "Stored - [Location]:" lines as needed for different storage locations)\n';
instructions += 'Assets: [Vehicles, property, major possessions, or "None"]\n';
} else {
// Legacy v1 format
instructions += 'Inventory: [Clothing/Armor, Inventory Items (list of important items, or "None")]\\n';
}
}
// Add quests section
+16
View File
@@ -73,6 +73,7 @@ export function commitTrackerData() {
/**
* Event handler for when the user sends a message.
* 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() {
if (!extensionSettings.enabled) return;
@@ -80,6 +81,21 @@ export function onMessageSent() {
// User sent a new message - NOT a swipe
setLastActionWasSwipe(false);
// 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)');
}
}
}
/**