Fix AI
This commit is contained in:
parent
2f76efed2e
commit
a17e54d024
1 changed files with 6 additions and 6 deletions
|
|
@ -35,17 +35,17 @@ const onAI = async (text: string, roomId: string, sender: string) => {
|
|||
return;
|
||||
}
|
||||
|
||||
const date = Date.now();
|
||||
let personality = config.app.ai.personalities[state.personality.index];
|
||||
if (
|
||||
Date.now() >
|
||||
state.personality.startTime + (personality?.timeout ?? 0)
|
||||
) {
|
||||
|
||||
if (date > state.personality.startTime + (personality?.timeout ?? 0)) {
|
||||
console.log("TEST");
|
||||
const randomInt = Math.floor(
|
||||
Math.random() * (config.app.ai.personalities.length + 1),
|
||||
Math.random() * config.app.ai.personalities.length,
|
||||
);
|
||||
state.personality = {
|
||||
index: randomInt,
|
||||
startTime: Date.now(),
|
||||
startTime: date,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue