File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -434,18 +434,19 @@ func printResponse(response string, prettyPrint bool) error {
434
434
return fmt .Errorf ("failed to pretty print text content: %w" , err )
435
435
}
436
436
fmt .Println (string (prettyText ))
437
- } else {
438
- var textContentList [] interface { }
439
- if err := json . Unmarshal ([] byte ( content . Text ), & textContentList ); err != nil {
440
- return fmt . Errorf ( "failed to parse text content as a list: %w" , err )
441
- }
442
- // Pretty print the array content
443
- prettyText , err := json . MarshalIndent ( textContentList , "" , " " )
444
- if err != nil {
445
- return fmt . Errorf ( "failed to pretty print array content: %w" , err )
446
- }
447
- fmt .Println ( string ( prettyText ) )
437
+ continue
438
+ }
439
+
440
+ // Fallback parsing as JSONL
441
+ var textContentList [] map [ string ] interface { }
442
+ if err := json . Unmarshal ([] byte ( content . Text ), & textContentList ); err != nil {
443
+ return fmt . Errorf ( "failed to parse text content as a list: %w" , err )
444
+ }
445
+ prettyText , err := json . MarshalIndent ( textContentList , "" , " " )
446
+ if err != nil {
447
+ return fmt .Errorf ( "failed to pretty print array content: %w" , err )
448
448
}
449
+ fmt .Println (string (prettyText ))
449
450
}
450
451
}
451
452
You can’t perform that action at this time.
0 commit comments