Skip to content

Commit

Permalink
Merge pull request elizaOS#729 from cygaar/fix_twitter_context
Browse files Browse the repository at this point in the history
fix: twitter recent interactions
  • Loading branch information
jkbrooks authored Nov 30, 2024
2 parents b6ec71e + 2d57d27 commit 2782cc5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/client-twitter/src/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ Recent interactions between {{agentName}} and other users:
{{recentPosts}}
# Task: Generate a post/reply in the voice, style and perspective of {{agentName}} (@{{twitterUserName}}) while using the thread of tweets as additional context:
Current Post:
{{currentPost}}
Thread of Tweets You Are Replying To:
Thread of Tweets You Are Replying To:
{{formattedConversation}}
{{actions}}
Expand Down
4 changes: 2 additions & 2 deletions packages/client-twitter/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ export async function sendTweet(
id: tweetResult.rest_id,
text: tweetResult.legacy.full_text,
conversationId: tweetResult.legacy.conversation_id_str,
//createdAt:
timestamp: tweetResult.timestamp * 1000,
timestamp:
new Date(tweetResult.legacy.created_at).getTime() / 1000,
userId: tweetResult.legacy.user_id_str,
inReplyToStatusId: tweetResult.legacy.in_reply_to_status_id_str,
permanentUrl: `https://twitter.com/${twitterUsername}/status/${tweetResult.rest_id}`,
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-bootstrap/src/providers/facts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const factsProvider: Provider = {
index === self.findIndex((t) => t.id === fact.id)
);

if (allFacts.length === 0) {
return "";
}

const formattedFacts = formatFacts(allFacts);

return "Key facts that {{agentName}} knows:\n{{formattedFacts}}"
Expand Down

0 comments on commit 2782cc5

Please sign in to comment.