Prefer const variables

3918192dee20e9d1a8e6ae25c4a461cc7a1f7648

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +6 -7Ignore whitespace
public/scripts/group-chats.js+6 -7
@@ -855,7 +855,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
855855 const bias = getBiasStrings(userInput, type);
856856 await sendMessageAsUser(userInput, bias.messageBias);
857857 await saveChatConditional();
858858 $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles: true }));
859859 }
860860
861861 // now the real generation begins: cycle through every activated character
@@ -1006,7 +1006,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
10061006 }
10071007 }
10081008
10091009 letconst chattyMembers = [];
10101010 // activation by talkativeness (in shuffled order, except banned)
10111011 const shuffledMembers = shuffle([...members]);
10121012 for (let member of shuffledMembers) {
@@ -1017,14 +1017,13 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
10171017 }
10181018
10191019 const rollValue = Math.random();
10201020 letconst talkativeness = NumberisNaN(character.talkativeness);
1021- talkativeness = Number.isNaN(talkativeness)
10221021 ? talkativeness_default
10231022 : Number(character.talkativeness);
10241023 if (talkativeness >= rollValue) {
10251024 activatedMembers.push(member);
10261025 }
10271026 if (talkativeness > 0) {
10281027 chattyMembers.push(member);
10291028 }
10301029 }
@@ -1032,7 +1031,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
10321031 // pick 1 at random if no one was activated
10331032 let retries = 0;
10341033 // try to limit the selected random character to those with talkativeness > 0
10351034 letconst randomPool = chattyMembers.length > 0 ? chattyMembers : members;
10361035 while (activatedMembers.length === 0 && ++retries <= randomPool.length) {
10371036 const randomIndex = Math.floor(Math.random() * randomPool.length);
10381037 const character = characters.find((x) => x.avatar === randomPool[randomIndex]);