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

feat: TwitterInteractionClient response handling and boredom provider #384

Closed
wants to merge 8 commits into from

Conversation

DanielHighETH
Copy link

Relates to:

https://x.com/shawmakesmagic/status/1858248520060567911

Risks

Low

What does this PR do?

  • Added boredom score if conversation is too long or between same people
  • Added error handling to the interaction loop using try-catch blocks to ensure the system keeps running smoothly even if an error occurs.
  • Improved tweet processing by introducing methods to filter out duplicates (filterValidTweets) and group tweets by conversation (groupTweetsByConversation) for more context-aware responses.
  • Made the code more modular by moving timeline formatting (getFormattedTimeline) and response evaluation (evaluateShouldRespond) into their own dedicated methods, making the logic easier to read and reuse.
  • Enhanced conversation handling by grouping tweets by conversation ID, enabling the bot to respond with better context for multi-tweet threads.
  • Cleaned up logging for better visibility into what the bot is doing and easier tracking of errors.
  • Refactored large, complex methods into smaller, single-purpose functions, making the code easier to maintain, debug, and extend in the future.

@monilpat
Copy link
Collaborator

Please update the PR to pass the PR Title Check thank you!

Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM need some minor clean up please address then will approve!

Added TODO comments for elizaOS#408 to review and update the `totalMessages` logic.
@DanielHighETH
Copy link
Author

LGTM need some minor clean up please address then will approve!

Everything commited and issue #408 created! Thank you

@DanielHighETH DanielHighETH changed the title TwitterInteractionClient response handling and boredom provider feat: TwitterInteractionClient response handling and boredom provider Nov 18, 2024
@monilpat
Copy link
Collaborator

Amazing - thank you so much!

monilpat
monilpat previously approved these changes Nov 18, 2024
Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after addressing comments!

@jkbrooks
Copy link
Contributor

@monilpat you sure? we have conflicts in packages/client-twitter/src/interactions.ts

@monilpat
Copy link
Collaborator

I can't see the conflicts somehow. That is so weird. Yes - please resolve the conflicts first. Sending back to reviewer.

@jkbrooks
Copy link
Contributor

@DanielHighETH would you fix the merge conflict in packages/client-twitter/src/interactions.ts so we can finish the review and merge this in?

@DanielHighETH
Copy link
Author

@DanielHighETH would you fix the merge conflict in packages/client-twitter/src/interactions.ts so we can finish the review and merge this in?

@jkbrooks @monilpat a new code was merged 3 hours ago from #383 I'm not really sure if we should use my refractored code in this new code

@jkbrooks
Copy link
Contributor

@DanielHighETH looks like there is still some value in your PR, even though we also have #383

Please let us know if you think you can get to the merge conflict, we are still happy to merge. Otherwise, no worries, we can close this PR.

@monilpat
Copy link
Collaborator

Thanks for doing this and addressing all comments. Sorry to bother you again, but can we add any tests or screengrabs confirming that this does in fact improve the conversation and address? https://x.com/shawmakesmagic/status/1858248520060567911

@DanielHighETH
Copy link
Author

Thanks for doing this and addressing all comments. Sorry to bother you again, but can we add any tests or screengrabs confirming that this does in fact improve the conversation and address? https://x.com/shawmakesmagic/status/1858248520060567911

Hey, I have no idea how to do it actually

@odilitime odilitime changed the base branch from main to develop December 14, 2024 17:36
@lalalune lalalune closed this Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants