Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delay function to slow down conversations in agent.ts #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Aug 16, 2023

Description

This PR adds a delay function to slow down conversations in the agent.ts file. The delay function pauses the execution of the conversation for a specified period of time after each message is sent.

Summary of Changes

  • Added import statement for the sleep function from the utils file in the lib directory
  • Introduced a delay function using setTimeout in the utils file
  • Called the delay function after each message is sent in the handleAgentInteraction function
  • Added a constant for the conversation delay at the top of the file

Fixes #2.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/add-delay-function

To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.

@sweep-ai sweep-ai bot added the sweep Assigns Sweep to an issue or pull request. label Aug 16, 2023
@wwzeng1
Copy link

wwzeng1 commented Aug 17, 2023

./lib/utils does not exist, please create a new delay function and use that instead

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 17, 2023

./lib/utils does not exist, please create a new delay function and use that instead

Hi @wwzeng1,

I decided to make the following changes:

File Path Proposed Changes
convex/agent.ts Modify convex/agent.ts with contents:
* Remove the import statement for the sleep function from the utils file in the lib directory.
• Create a new function named "delay" at the top of the file. This function should take a single parameter, "ms", which represents the number of milliseconds to delay. The function should return a new Promise that resolves after the specified number of milliseconds using the setTimeout method.
• Replace the call to the sleep function after each message is sent in the handleAgentInteraction function with a call to the new delay function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: Add a new function in agent.ts to slow down conversations
1 participant