From 7f7981d6cde0f759308e0cb1963353cea023703a Mon Sep 17 00:00:00 2001 From: Micheal Smith Date: Thu, 6 Nov 2025 17:28:46 -0600 Subject: [PATCH] Added a hard coded 500 character limit. --- src/chat.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 18beff3..eb9d13b 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -66,18 +66,14 @@ impl Chat { if let Command::PRIVMSG(channel, message) = message.command && message.starts_with("!gem") { - let msg = self.llm_handle.send_request(&message).await?; + let mut msg = self.llm_handle.send_request(&message).await?; event!(Level::INFO, "Asked: {}", message); event!(Level::INFO, "Answered: {}", msg); - // Send responses as one PRIVMSG per line. - let mut lines = msg.lines(); - - while let Some(line) = lines.next() { - client - .send_privmsg(&channel, line) - .wrap_err("Couldn't send response to channel.")?; - } + // Make it all one line. + msg.retain(|c| c != '\n' && c != '\r'); + msg.truncate(500); + client.send_privmsg(&channel, msg).wrap_err("Could not send to {channel}")?; } }