Fix: Support multiple character variants in Present Characters panel

Fixed issues when AI generates multiple character variants (e.g.,
storyteller mode with 'Dottore (Prime)', 'Dottore (Beta)', etc.):

1. Escape quotes in character names to prevent HTML attribute breakage
   - Added escapeHtmlAttr() helper function
   - Prevents names like 'Marianna "Mari"' from breaking HTML

2. Restore avatar lookup for character variants
   - namesMatch() now strips parentheses and quotes from both sides
   - Allows 'Dottore (Prime)' to find 'Dottore' character card avatar
   - Each variant still gets its own card with separate attributes

3. Multiple characters now display correctly in panel
   - Each variant creates its own character object
   - Attributes (Details, Relationship, Stats, Thoughts) don't mix
   - All characters appear in the panel, not just the last one
This commit is contained in:
Spicy_Marinara
2025-11-13 16:18:35 +01:00
parent 172c8d6ab8
commit d658e337f6
2 changed files with 35 additions and 19 deletions
+1 -1
View File
@@ -256,7 +256,7 @@ export function generateTrackerInstructions(includeHtmlPrompt = true, includeCon
// Relationship line (only if relationships are enabled)
if (relationshipPlaceholders) {
instructions += `Relationship: [${relationshipPlaceholders}]\n`;
instructions += `Relationship: [(choose one: ${relationshipPlaceholders})]\n`;
}
// Stats line (if enabled)