@@ -6,7 +6,6 @@ use crossterm::queue;
66use crossterm:: style:: {
77 self ,
88 Color ,
9- Stylize ,
109} ;
1110use eyre:: {
1211 Result ,
@@ -38,9 +37,6 @@ use crate::cli::chat::util::images::{
3837} ;
3938use crate :: os:: Os ;
4039
41- const CHECKMARK : & str = "✔" ;
42- const CROSS : & str = "✘" ;
43-
4440#[ derive( Debug , Clone , Deserialize ) ]
4541pub struct FsRead {
4642 // For batch operations
@@ -112,7 +108,7 @@ impl FsRead {
112108 // Multiple operations - combine results
113109 let mut combined_results = Vec :: new ( ) ;
114110 let mut all_images = Vec :: new ( ) ;
115-
111+ let mut has_non_image_ops = false ;
116112 let mut success_ops = 0usize ;
117113 let mut failed_ops = 0usize ;
118114
@@ -128,13 +124,15 @@ impl FsRead {
128124 i + 1 ,
129125 text
130126 ) ) ;
127+ has_non_image_ops = true ;
131128 } ,
132129 OutputKind :: Json ( json) => {
133130 combined_results. push ( format ! (
134131 "=== Operation {} Result (Json) ===\n {}" ,
135132 i + 1 ,
136133 serde_json:: to_string_pretty( json) ?
137134 ) ) ;
135+ has_non_image_ops = true ;
138136 } ,
139137 OutputKind :: Images ( images) => {
140138 all_images. extend ( images. clone ( ) ) ;
@@ -144,6 +142,9 @@ impl FsRead {
144142 images. len( )
145143 ) ) ;
146144 } ,
145+ // This branch won't be reached because single operation execution never returns a Mixed
146+ // result
147+ OutputKind :: Mixed { text : _, images : _ } => { } ,
147148 }
148149 } ,
149150
@@ -172,15 +173,23 @@ impl FsRead {
172173 true ,
173174 ) ?;
174175
175- // If we have images, return them as the primary output
176- if !all_images. is_empty ( ) {
176+ let combined_text = combined_results. join ( "\n \n " ) ;
177+
178+ if !all_images. is_empty ( ) && has_non_image_ops {
179+ queue ! ( updates, style:: Print ( "\n herherherherherh" ) , ) ?;
180+ Ok ( InvokeOutput {
181+ output : OutputKind :: Mixed {
182+ text : combined_text,
183+ images : all_images,
184+ } ,
185+ } )
186+ } else if !all_images. is_empty ( ) {
177187 Ok ( InvokeOutput {
178188 output : OutputKind :: Images ( all_images) ,
179189 } )
180190 } else {
181- // Otherwise, return the combined text results
182191 Ok ( InvokeOutput {
183- output : OutputKind :: Text ( combined_results . join ( " \n \n " ) ) ,
192+ output : OutputKind :: Text ( combined_text ) ,
184193 } )
185194 }
186195 }
@@ -248,7 +257,7 @@ impl FsImage {
248257 pub async fn invoke ( & self , updates : & mut impl Write ) -> Result < InvokeOutput > {
249258 let pre_processed_paths: Vec < String > = self . image_paths . iter ( ) . map ( |path| pre_process ( path) ) . collect ( ) ;
250259 let valid_images = handle_images_from_paths ( updates, & pre_processed_paths) ;
251- super :: queue_function_result ( & format ! ( "Successfully read image" ) , updates, false , false ) ?;
260+ super :: queue_function_result ( "Successfully read image" , updates, false , false ) ?;
252261 Ok ( InvokeOutput {
253262 output : OutputKind :: Images ( valid_images) ,
254263 } )
0 commit comments