Merge pull request #2685 from SillyTavern/fix-tag-import

Tag import fixed, again. (accepts char avatar key)
This commit is contained in:
Cohee 2024-08-19 22:31:26 +03:00 committed by GitHub
commit 9505f6915b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -445,7 +445,11 @@ export function getTagKeyForEntity(entityOrKey) {
}
// Next lets check if its a valid character or character id, so we can swith it to its tag
const character = characters.indexOf(x) >= 0 ? x : characters[x];
let character;
if (!character && characters.indexOf(x) >= 0) character = x; // Check for char object
if (!character && typeof x === 'number') character = characters[x]; // check if its a char id
if (!character) character = characters.find(y => y.avatar === x); // check if its a char key
if (character) {
x = character.avatar;
}