File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -645,17 +645,23 @@ const convertToolResultContent = (
645645 }
646646
647647 if ( Array . isArray ( content ) ) {
648- if ( content . length > 0 && content [ 0 ] . type === "text" ) {
649- return ( content as Array < AnthropicTextBlock > ) . map ( ( block ) =>
650- createTextContent ( block . text ) ,
651- )
652- }
653-
654- if ( content . length > 0 && content [ 0 ] . type === "image" ) {
655- return ( content as Array < AnthropicImageBlock > ) . map ( ( block ) =>
656- createImageContent ( block ) ,
657- )
648+ const result : Array < ResponseInputContent > = [ ]
649+ for ( const block of content ) {
650+ switch ( block . type ) {
651+ case "text" : {
652+ result . push ( createTextContent ( block . text ) )
653+ break
654+ }
655+ case "image" : {
656+ result . push ( createImageContent ( block ) )
657+ break
658+ }
659+ default : {
660+ break
661+ }
662+ }
658663 }
664+ return result
659665 }
660666
661667 return ""
You can’t perform that action at this time.
0 commit comments