File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -768,13 +768,16 @@ func (c *ModelResponseChunk) Text() string {
768
768
}
769
769
var sb strings.Builder
770
770
for _ , p := range c .Content {
771
- sb .WriteString (p .Text )
771
+ if p .IsText () || p .IsData () {
772
+ sb .WriteString (p .Text )
773
+ }
772
774
}
773
775
return sb .String ()
774
776
}
775
777
776
778
// Text returns the contents of a [Message] as a string. It
777
779
// returns an empty string if the message has no content.
780
+ // If you want to get reasoning from the message, use Reasoning() instead.
778
781
func (m * Message ) Text () string {
779
782
if m == nil {
780
783
return ""
@@ -787,7 +790,9 @@ func (m *Message) Text() string {
787
790
}
788
791
var sb strings.Builder
789
792
for _ , p := range m .Content {
790
- sb .WriteString (p .Text )
793
+ if p .IsText () || p .IsData () {
794
+ sb .WriteString (p .Text )
795
+ }
791
796
}
792
797
return sb .String ()
793
798
}
You can’t perform that action at this time.
0 commit comments