Fix recursive QR auto-execution

This commit is contained in:
Cohee
2023-11-27 02:18:36 +02:00
parent 3eeb137416
commit fd0edd67a6
3 changed files with 93 additions and 55 deletions

View File

@ -1981,13 +1981,13 @@ function doNewChat() {
}, 1);
}
function doRandomChat() {
async function doRandomChat() {
resetSelectedGroup();
setCharacterId(Math.floor(Math.random() * characters.length).toString());
setTimeout(() => {
reloadCurrentChat();
}, 1);
const characterId = Math.floor(Math.random() * characters.length).toString();
setCharacterId(characterId);
await delay(1);
await reloadCurrentChat();
return characters[characterId]?.name;
}
/**