Skip to content

Commit

Permalink
Merge pull request #3286 from azep-ninja/fix-twitter-suppress-message…
Browse files Browse the repository at this point in the history
…-add

fix: twitter - add actions suppress action ability.
  • Loading branch information
shakkernerd authored Feb 5, 2025
2 parents 1f4b6d4 + 97c8f09 commit f5669f7
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion packages/client-twitter/src/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,24 @@ export class TwitterInteractionClient {
return memories;
};

const responseMessages = await callback(response);
const action = this.runtime.actions.find((a) => a.name === response.action);
const shouldSuppressInitialMessage = action?.suppressInitialMessage;

let responseMessages = [];

if (!shouldSuppressInitialMessage) {
responseMessages = await callback(response);
} else {
responseMessages = [{
id: stringToUuid(tweet.id + "-" + this.runtime.agentId),
userId: this.runtime.agentId,
agentId: this.runtime.agentId,
content: response,
roomId: message.roomId,
embedding: getEmbeddingZeroVector(),
createdAt: Date.now(),
}];
}

state = (await this.runtime.updateRecentMessageState(
state
Expand All @@ -515,9 +532,11 @@ export class TwitterInteractionClient {
responseMessage
);
}

const responseTweetId =
responseMessages[responseMessages.length - 1]?.content
?.tweetId;

await this.runtime.processActions(
message,
responseMessages,
Expand Down

0 comments on commit f5669f7

Please sign in to comment.