Skip to content
Open
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
6 changes: 3 additions & 3 deletions src/cortex-cli/src/agent_cmd/handlers/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ pub async fn run_generate(args: CreateArgs) -> Result<()> {
println!(" {}", "-".repeat(36));

// Show truncated prompt
let prompt_preview = if generated.system_prompt.len() > 500 {
let prompt_preview = if generated.system_prompt.chars().count() > 500 {
format!(
"{}...\n\n (truncated, {} chars total)",
&generated.system_prompt[..500],
generated.system_prompt.len()
generated.system_prompt.chars().take(500).collect::<String>(),
generated.system_prompt.chars().count()
)
} else {
generated.system_prompt.clone()
Expand Down
4 changes: 2 additions & 2 deletions src/cortex-cli/src/agent_cmd/handlers/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ pub async fn run_list(args: ListArgs) -> Result<()> {
.description
.as_ref()
.map(|d| {
if d.len() > 38 {
format!("{}...", &d[..35])
if d.chars().count() > 38 {
format!("{}...", d.chars().take(35).collect::<String>())
} else {
d.clone()
}
Expand Down
6 changes: 3 additions & 3 deletions src/cortex-cli/src/agent_cmd/handlers/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ pub async fn run_show(args: ShowArgs) -> Result<()> {
if let Some(ref prompt) = agent.prompt {
println!("\nSystem Prompt:");
println!("{}", "-".repeat(40));
let preview = if prompt.len() > 500 {
let preview = if prompt.chars().count() > 500 {
format!(
"{}...\n\n(truncated, {} chars total)",
&prompt[..500],
prompt.len()
prompt.chars().take(500).collect::<String>(),
prompt.chars().count()
)
} else {
prompt.clone()
Expand Down