Added a hard coded 500 character limit.
This commit is contained in:
14
src/chat.rs
14
src/chat.rs
@@ -66,18 +66,14 @@ impl Chat {
|
|||||||
if let Command::PRIVMSG(channel, message) = message.command
|
if let Command::PRIVMSG(channel, message) = message.command
|
||||||
&& message.starts_with("!gem")
|
&& 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, "Asked: {}", message);
|
||||||
event!(Level::INFO, "Answered: {}", msg);
|
event!(Level::INFO, "Answered: {}", msg);
|
||||||
|
|
||||||
// Send responses as one PRIVMSG per line.
|
// Make it all one line.
|
||||||
let mut lines = msg.lines();
|
msg.retain(|c| c != '\n' && c != '\r');
|
||||||
|
msg.truncate(500);
|
||||||
while let Some(line) = lines.next() {
|
client.send_privmsg(&channel, msg).wrap_err("Could not send to {channel}")?;
|
||||||
client
|
|
||||||
.send_privmsg(&channel, line)
|
|
||||||
.wrap_err("Couldn't send response to channel.")?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user