File tree Expand file tree Collapse file tree
src/cortex-cli/src/agent_cmd/handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,11 +117,11 @@ pub async fn run_generate(args: CreateArgs) -> Result<()> {
117117 println ! ( " {}" , "-" . repeat( 36 ) ) ;
118118
119119 // Show truncated prompt
120- let prompt_preview = if generated. system_prompt . len ( ) > 500 {
120+ let prompt_preview = if generated. system_prompt . chars ( ) . count ( ) > 500 {
121121 format ! (
122122 "{}...\n \n (truncated, {} chars total)" ,
123- & generated. system_prompt[ .. 500 ] ,
124- generated. system_prompt. len ( )
123+ generated. system_prompt. chars ( ) . take ( 500 ) . collect :: < String > ( ) ,
124+ generated. system_prompt. chars ( ) . count ( )
125125 )
126126 } else {
127127 generated. system_prompt . clone ( )
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ pub async fn run_list(args: ListArgs) -> Result<()> {
9898 . description
9999 . as_ref ( )
100100 . map ( |d| {
101- if d. len ( ) > 38 {
102- format ! ( "{}..." , & d [ .. 35 ] )
101+ if d. chars ( ) . count ( ) > 38 {
102+ format ! ( "{}..." , d . chars ( ) . take ( 35 ) . collect :: < String > ( ) )
103103 } else {
104104 d. clone ( )
105105 }
Original file line number Diff line number Diff line change @@ -136,11 +136,11 @@ pub async fn run_show(args: ShowArgs) -> Result<()> {
136136 if let Some ( ref prompt) = agent. prompt {
137137 println ! ( "\n System Prompt:" ) ;
138138 println ! ( "{}" , "-" . repeat( 40 ) ) ;
139- let preview = if prompt. len ( ) > 500 {
139+ let preview = if prompt. chars ( ) . count ( ) > 500 {
140140 format ! (
141141 "{}...\n \n (truncated, {} chars total)" ,
142- & prompt[ .. 500 ] ,
143- prompt. len ( )
142+ prompt. chars ( ) . take ( 500 ) . collect :: < String > ( ) ,
143+ prompt. chars ( ) . count ( )
144144 )
145145 } else {
146146 prompt. clone ( )
You can’t perform that action at this time.
0 commit comments