Merge branch 'staging' into debounce-processHotkeys

This commit is contained in:
LenAnderson 2024-03-26 13:14:05 -04:00
commit 78400b4a2e
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,8 @@ import {
saveChatConditional, saveChatConditional,
setAnimationDuration, setAnimationDuration,
ANIMATION_DURATION_DEFAULT, ANIMATION_DURATION_DEFAULT,
setActiveGroup,
setActiveCharacter,
} from '../script.js'; } from '../script.js';
import { isMobile, initMovingUI, favsToHotswap } from './RossAscends-mods.js'; import { isMobile, initMovingUI, favsToHotswap } from './RossAscends-mods.js';
import { import {
@ -2302,6 +2304,8 @@ async function doRandomChat() {
resetSelectedGroup(); resetSelectedGroup();
const characterId = Math.floor(Math.random() * characters.length).toString(); const characterId = Math.floor(Math.random() * characters.length).toString();
setCharacterId(characterId); setCharacterId(characterId);
setActiveCharacter(characters[characterId]?.avatar);
setActiveGroup(null);
await delay(1); await delay(1);
await reloadCurrentChat(); await reloadCurrentChat();
return characters[characterId]?.name; return characters[characterId]?.name;

View File

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