v3.6.3: Fix relationship field to use correct nested format (relationship.status)
This commit is contained in:
+1
-1
@@ -6,6 +6,6 @@
|
|||||||
"js": "index.js",
|
"js": "index.js",
|
||||||
"css": "style.css",
|
"css": "style.css",
|
||||||
"author": "Marinara",
|
"author": "Marinara",
|
||||||
"version": "3.6.2",
|
"version": "3.6.3",
|
||||||
"homePage": "https://github.com/SpicyMarinara/rpg-companion-sillytavern"
|
"homePage": "https://github.com/SpicyMarinara/rpg-companion-sillytavern"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1023,18 +1023,27 @@ export function updateCharacterField(characterName, field, value) {
|
|||||||
} else if (field === 'emoji') {
|
} else if (field === 'emoji') {
|
||||||
char.emoji = value;
|
char.emoji = value;
|
||||||
} else if (field === 'Relationship') {
|
} else if (field === 'Relationship') {
|
||||||
// Store relationship as text, converting emoji if needed
|
// Store relationship in the correct nested format
|
||||||
|
// Remove old flat format if it exists
|
||||||
|
if (char.Relationship) {
|
||||||
|
delete char.Relationship;
|
||||||
|
}
|
||||||
|
|
||||||
// First check if it's an emoji → convert to text
|
// First check if it's an emoji → convert to text
|
||||||
|
let relationshipValue;
|
||||||
if (emojiToRelationship[value]) {
|
if (emojiToRelationship[value]) {
|
||||||
char.Relationship = emojiToRelationship[value];
|
relationshipValue = emojiToRelationship[value];
|
||||||
} else {
|
} else {
|
||||||
// It's text - find matching relationship name (case-insensitive)
|
// It's text - find matching relationship name (case-insensitive)
|
||||||
const matchingRelationship = Object.keys(relationshipEmojis).find(
|
const matchingRelationship = Object.keys(relationshipEmojis).find(
|
||||||
name => name.toLowerCase() === value.toLowerCase()
|
name => name.toLowerCase() === value.toLowerCase()
|
||||||
);
|
);
|
||||||
char.Relationship = matchingRelationship || value;
|
relationshipValue = matchingRelationship || value;
|
||||||
}
|
}
|
||||||
// console.log('[RPG Companion] After update - char.Relationship:', char.Relationship);
|
|
||||||
|
// Store in the correct nested format
|
||||||
|
char.relationship = { status: relationshipValue };
|
||||||
|
// console.log('[RPG Companion] After update - char.relationship:', char.relationship);
|
||||||
// console.log('[RPG Companion] relationshipEmojis:', relationshipEmojis);
|
// console.log('[RPG Companion] relationshipEmojis:', relationshipEmojis);
|
||||||
// console.log('[RPG Companion] emojiToRelationship:', emojiToRelationship);
|
// console.log('[RPG Companion] emojiToRelationship:', emojiToRelationship);
|
||||||
} else if (field.toLowerCase() === 'thoughts' || field === (presentCharsConfig?.thoughts?.name || 'Thoughts')) {
|
} else if (field.toLowerCase() === 'thoughts' || field === (presentCharsConfig?.thoughts?.name || 'Thoughts')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user