Merge pull request #1970 from LenAnderson/fix-go-cmd-activechar

Set active character / group when using /go command
This commit is contained in:
Cohee 2024-03-26 18:25:54 +02:00 committed by GitHub
commit 90e66e7782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,8 @@ import {
saveChatConditional,
sendMessageAsUser,
sendSystemMessage,
setActiveCharacter,
setActiveGroup,
setCharacterId,
setCharacterName,
setExtensionPrompt,
@ -1248,11 +1250,15 @@ async function goToCharacterCallback(_, name) {
if (characterIndex !== -1) {
await openChat(new String(characterIndex));
setActiveCharacter(characters[characterIndex]?.avatar);
setActiveGroup(null);
return characters[characterIndex]?.name;
} else {
const group = groups.find(it => it.name.toLowerCase() == name.toLowerCase());
if (group) {
await openGroupById(group.id);
setActiveCharacter(null);
setActiveGroup(group.id);
return group.name;
} else {
console.warn(`No matches found for name "${name}"`);