Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/agent/cortex_chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ impl<M: CompletionModel> PromptHook<M> for CortexChatHook {
result: &str,
) -> HookAction {
let preview = if result.len() > 200 {
format!("{}...", &result[..200])
let end = result.floor_char_boundary(200);
format!("{}...", &result[..end])
} else {
result.to_string()
};
Expand Down
5 changes: 4 additions & 1 deletion src/messaging/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,10 @@ async fn build_metadata(
let reply_content = resolve_mentions(&referenced.content, &referenced.mentions);
// Truncate to avoid bloating context with long quoted messages
let truncated = if reply_content.len() > 200 {
format!("{}...", &reply_content[..200])
format!(
"{}...",
&reply_content[..reply_content.floor_char_boundary(200)]
)
} else {
reply_content
};
Expand Down