Skip to content

Commit

Permalink
Merge pull request #1323 from oxSaturn/fix/max-tweet-length
Browse files Browse the repository at this point in the history
fix: use MAX_TWEET_LENGTH from setting
  • Loading branch information
monilpat authored Dec 21, 2024
2 parents faf7163 + 6551ac3 commit 7b609df
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/client-twitter/src/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { generateTweetActions } from "@ai16z/eliza";
import { IImageDescriptionService, ServiceType } from "@ai16z/eliza";
import { buildConversationThread } from "./utils.ts";
import { twitterMessageHandlerTemplate } from "./interactions.ts";
import { DEFAULT_MAX_TWEET_LENGTH } from "./environment.ts";

const twitterPostTemplate = `
# Areas of Expertise
Expand Down Expand Up @@ -58,8 +59,6 @@ Tweet:
# Respond with qualifying action tags only.` + postActionResponseFooter;

const MAX_TWEET_LENGTH = 240;

/**
* Truncate text to fit within the Twitter character limit, ensuring it ends at a complete sentence.
*/
Expand Down Expand Up @@ -280,7 +279,7 @@ export class TwitterPostClient {
// Use the helper function to truncate to complete sentence
const content = truncateToCompleteSentence(
cleanedContent,
MAX_TWEET_LENGTH
parseInt(this.runtime.getSetting("MAX_TWEET_LENGTH")) || DEFAULT_MAX_TWEET_LENGTH
);

const removeQuotes = (str: string) =>
Expand Down

0 comments on commit 7b609df

Please # to comment.