diff --git a/Cargo.lock b/Cargo.lock index 173e9b8..bd1649b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -105,7 +105,7 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "anda_bot" -version = "0.4.1" +version = "0.4.2" dependencies = [ "agent-twitter-client", "anda_core", @@ -160,7 +160,7 @@ dependencies = [ [[package]] name = "anda_engine" -version = "0.4.4" +version = "0.4.5" dependencies = [ "anda_core", "async-trait", diff --git a/agents/anda_bot/Cargo.toml b/agents/anda_bot/Cargo.toml index b3af486..c24cf83 100644 --- a/agents/anda_bot/Cargo.toml +++ b/agents/anda_bot/Cargo.toml @@ -3,7 +3,7 @@ name = "anda_bot" description = "I'm Anda ICP, Digital panda 🐼 by Anda framework. Secured in TEE, memories on ICP chain.✨" repository = "https://github.com/ldclabs/anda/tree/main/agents/anda_bot" publish = false -version = "0.4.1" +version = "0.4.2" edition.workspace = true keywords.workspace = true categories.workspace = true diff --git a/agents/anda_bot/nitro_enclave/amd64.Dockerfile b/agents/anda_bot/nitro_enclave/amd64.Dockerfile index 6926b39..9f530c1 100644 --- a/agents/anda_bot/nitro_enclave/amd64.Dockerfile +++ b/agents/anda_bot/nitro_enclave/amd64.Dockerfile @@ -25,7 +25,7 @@ RUN chmod +x ic_tee_daemon RUN wget -O ic_tee_nitro_gateway https://github.com/ldclabs/ic-tee/releases/download/v0.3.0/ic_tee_nitro_gateway RUN chmod +x ic_tee_nitro_gateway -RUN wget -O anda_bot https://github.com/ldclabs/anda/releases/download/v0.4.1/anda_bot +RUN wget -O anda_bot https://github.com/ldclabs/anda/releases/download/v0.4.2/anda_bot RUN chmod +x anda_bot FROM debian:bookworm-slim AS runtime diff --git a/agents/anda_bot/src/twitter.rs b/agents/anda_bot/src/twitter.rs index 58ab578..53ae79c 100644 --- a/agents/anda_bot/src/twitter.rs +++ b/agents/anda_bot/src/twitter.rs @@ -302,12 +302,13 @@ impl TwitterDaemon { if res.failed_reason.is_none() { // Reply to the original tweet let tweet: Option<&str> = tweet.id.as_deref(); - let _ = self.scraper.send_tweet(&res.content, tweet, None).await?; + let content = remove_quotes(res.content); + let _ = self.scraper.send_tweet(&content, tweet, None).await?; log::info!( tweet_user = tweet_user, tweet_id = tweet_id, - chars = res.content.chars().count(), + chars = content.chars().count(), time_elapsed = ctx.time_elapsed().as_millis() as u64; "handle mention"); } @@ -378,7 +379,7 @@ impl TwitterDaemon { .character .to_request( "\ - Reply the tweet with a single clear, natural sentence.\ + Reply the tweet with a single clear, natural sentence. No hashtags.\ " .to_string(), ctx.user(), @@ -395,7 +396,7 @@ impl TwitterDaemon { None => { let _ = self .scraper - .send_tweet(&res.content, Some(tweet_id), None) + .send_tweet(&remove_quotes(res.content), Some(tweet_id), None) .await?; return Ok(true); } @@ -416,7 +417,7 @@ impl TwitterDaemon { .character .to_request( "\ - Reply the tweet with a single clear, natural sentence.\ + Quote the tweet with a single clear, natural sentence. No hashtags.\ " .to_string(), ctx.user(), @@ -433,7 +434,7 @@ impl TwitterDaemon { None => { let _ = self .scraper - .send_quote_tweet(&res.content, tweet_id, None) + .send_quote_tweet(&remove_quotes(res.content), tweet_id, None) .await?; return Ok(true); } @@ -510,3 +511,12 @@ mod tests { // std::fs::write("home_timeline_tweets.json", tweets).unwrap(); } } + +fn remove_quotes(s: String) -> String { + let mut chars = s.chars(); + if chars.next() == Some('"') && chars.next_back() == Some('"') { + chars.collect() + } else { + s + } +} diff --git a/anda_engine/Cargo.toml b/anda_engine/Cargo.toml index 66fad67..8012fc7 100644 --- a/anda_engine/Cargo.toml +++ b/anda_engine/Cargo.toml @@ -3,7 +3,7 @@ name = "anda_engine" description = "Agents engine for Anda -- an AI agent framework built with Rust, powered by ICP and TEEs." repository = "https://github.com/ldclabs/anda/tree/main/anda_engine" publish = true -version = "0.4.4" +version = "0.4.5" edition.workspace = true keywords.workspace = true categories.workspace = true