From 6d64acb9a9276ffbd87d750efbc9d1153f2b9d6b Mon Sep 17 00:00:00 2001 From: kwaroran Date: Sun, 8 Dec 2024 22:14:53 +0900 Subject: [PATCH] Improve random selection logic for preset chain names --- src/ts/process/index.svelte.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ts/process/index.svelte.ts b/src/ts/process/index.svelte.ts index adfb4a89..718023cf 100644 --- a/src/ts/process/index.svelte.ts +++ b/src/ts/process/index.svelte.ts @@ -111,7 +111,8 @@ export async function sendChat(chatProcessIndex = -1,arg:{ if(chatProcessIndex === -1 && DBState.db.presetChain){ const names = DBState.db.presetChain.split(' ') - const ele = names[Math.random() * names.length] + const randomSelect = Math.floor(Math.random() * names.length) + const ele = names[randomSelect] const findId = DBState.db.botPresets.findIndex((v) => { return v.name === ele