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

fix: handle long tweet in utils #1520

Merged
merged 20 commits into from
Dec 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
20f2d9d
fix: handle long tweet in utils
oxSaturn Dec 28, 2024
19b9de1
Merge branch 'develop' into fix/long-tweet
odilitime Dec 28, 2024
6d19903
feat: use OPENAI_API_URL from env to support custom OpenAI API endpoint
imtms Dec 28, 2024
39fed59
isFalsish() for parsing environment in a standard way
odilitime Dec 28, 2024
e7f9693
roll isFalsish into parseBooleanFromText
odilitime Dec 28, 2024
d22369c
lint: remove unused error variable
odilitime Dec 28, 2024
a2853fa
lint: fix EmbeddingProvider already defined error (via claude)
odilitime Dec 28, 2024
35d26c6
empty is already mapped to null
odilitime Dec 28, 2024
bdabfbc
move all env parsing here
odilitime Dec 28, 2024
cad36a7
add twitterConfig cstr param and prefer it over getSetting
odilitime Dec 28, 2024
bd78337
prefer this.client.twitterConfig over getSetting
odilitime Dec 28, 2024
ec33a17
prefer client.twitterConfig over getSetting
odilitime Dec 28, 2024
b8bde37
prefer this.client.twitterConfig over getSetting
odilitime Dec 28, 2024
2c57732
prefer this.client.twitterConfig over getSettings
odilitime Dec 28, 2024
68288ad
pass twitterConfig as 2nd parameter to cstr, only start search once
odilitime Dec 28, 2024
4f92818
fix TWITTER_POLL_INTERVAL scale
odilitime Dec 28, 2024
7fce277
make MAX_TWEET_LENGTH integer since that's how it's consomed/compared
odilitime Dec 28, 2024
8b9278e
chore: revert file to match develop branch
shakkernerd Dec 28, 2024
d537154
chore: revert file to match develop branch
shakkernerd Dec 28, 2024
7e6e7a9
Merge branch 'develop' into fix/long-tweet
odilitime Dec 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prefer client.twitterConfig over getSetting
odilitime committed Dec 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit ec33a178c2534f095f6ab399b71773c351c68750
3 changes: 1 addition & 2 deletions packages/client-twitter/src/utils.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { Content, Memory, UUID } from "@elizaos/core";
import { stringToUuid } from "@elizaos/core";
import { ClientBase } from "./base";
import { elizaLogger } from "@elizaos/core";
import { DEFAULT_MAX_TWEET_LENGTH } from "./environment";
import { Media } from "@elizaos/core";
import fs from "fs";
import path from "path";
@@ -172,7 +171,7 @@ export async function sendTweet(
twitterUsername: string,
inReplyTo: string
): Promise<Memory[]> {
const maxTweetLength = parseInt(client.runtime.getSetting("MAX_TWEET_LENGTH") ?? DEFAULT_MAX_TWEET_LENGTH.toString());
const maxTweetLength = client.twitterConfig.MAX_TWEET_LENGTH;
const isLongTweet = maxTweetLength > 280;

const tweetChunks = splitTweetContent(content.text, maxTweetLength);