Skip to content

Commit

Permalink
Merge pull request #14 from blorm-network/choiceloop
Browse files Browse the repository at this point in the history
Changed example delays, interval logic
  • Loading branch information
ef95023 authored Dec 21, 2024
2 parents dbc8c8c + 4cca898 commit 9ec9dfe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions agents/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"This is an example tweet.",
"This is another example tweet."
],
"loop_delay": 60,
"loop_delay": 900,
"config": [
{
"name": "twitter",
"timeline_read_count": 10,
"self_reply_chance": 0.05,
"tweet_interval": 900
"tweet_interval": 5400
},
{
"name": "openai",
Expand Down
9 changes: 7 additions & 2 deletions src/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ def loop(self):
)
last_tweet_time = current_time
logger.info("\n✅ Tweet posted successfully!")
else:
logger.info("\n👀 Delaying post until tweet interval elapses...")
print_h_bar()
continue

elif action_name == "reply-to-tweet":
if "timeline_tweets" in self.state and len(self.state["timeline_tweets"]) > 0:
# Get next tweet from inputs
Expand All @@ -169,7 +174,7 @@ def loop(self):
is_own_tweet = tweet.get('author_username', '').lower() == self.username
if is_own_tweet and random.random() > self.self_reply_chance:
logger.info("\n🤖 Skipping self-reply due to agent's choice.")
# TODO: Should failure to self-reply still incur an action? or skip/shorten delay?
print_h_bar()
continue

logger.info(f"\n💬 GENERATING REPLY to: {tweet.get('text', '')[:50]}...")
Expand Down Expand Up @@ -212,7 +217,7 @@ def loop(self):
logger.info("✅ Tweet liked successfully!")


logger.info(f"\n⏳ Waiting {self.loop_delay} seconds before next check...")
logger.info(f"\n⏳ Waiting {self.loop_delay} seconds before next loop...")
print_h_bar()
time.sleep(self.loop_delay)

Expand Down

0 comments on commit 9ec9dfe

Please sign in to comment.