File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
samples/semantic-kernel/a2a-net.Samples.SemanticKernel.Client Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -102,17 +102,27 @@ void spinStopThen(Action runThis)
102102 continue ;
103103 }
104104
105+ var filePath = AnsiConsole . Ask < string > ( "[blue]File path (optional, <enter> to skip)>[/]" , string . Empty ) . TrimStart ( '"' ) . TrimEnd ( '"' ) ;
106+ string ? filename = ! string . IsNullOrWhiteSpace ( filePath ) ? Path . GetFileName ( filePath ) : null ;
107+ var fileBytes = ! string . IsNullOrWhiteSpace ( filePath ) ? System . IO . File . ReadAllBytes ( filePath ) : null ;
108+
105109 spinnerCts = new ( ) ;
106110
107111 try
108112 {
113+ var parts = new List < Part > ( ) { new TextPart ( prompt ) } ;
114+ if ( ! string . IsNullOrWhiteSpace ( filePath ) )
115+ {
116+ parts . Add ( new FilePart { File = new ( ) { Bytes = Convert . ToBase64String ( fileBytes ! ) , Name = filename } } ) ;
117+ }
118+
109119 var taskParams = new TaskSendParameters
110120 {
111121 SessionId = session ,
112122 Message = new ( )
113123 {
114124 Role = MessageRole . User ,
115- Parts = [ new TextPart ( prompt ) ]
125+ Parts = [ .. parts ]
116126 }
117127 } ;
118128
You can’t perform that action at this time.
0 commit comments