Skip to content

Commit

Permalink
feat(agent): add random reply trigger to agent (#308)
Browse files Browse the repository at this point in the history
* Add 1/2 chances for the agent to reply to new messages in the chat.
  • Loading branch information
ramidecodes authored Feb 9, 2024
1 parent 37d9ce2 commit ded72ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/service/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Agent {

async triggerResponse() {
// TODO: perform actual logic to understand if response should be triggered or not
const shouldTrigger = true;
const shouldTrigger = Math.random() < 0.5;
if (!shouldTrigger) return;

this._triggeredAt = Date.now();
Expand All @@ -82,7 +82,7 @@ export class Agent {
};

// TODO: remove artificial wait in favour of something more inteligent
const waitTime = this._match.messages.length === 1 ? 8500 : 6500;
const waitTime = this._match.messages.length === 1 ? 9000 : 6500;
await wait(waitTime);

this._match.addMessage(payload);
Expand Down

0 comments on commit ded72ff

Please sign in to comment.