Skip to content

Commit e47064d

Browse files
committed
fix(go): exclude reasoning part when return value from Text() function
1 parent d1c27c0 commit e47064d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

go/ai/generate.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,9 @@ func (c *ModelResponseChunk) Text() string {
768768
}
769769
var sb strings.Builder
770770
for _, p := range c.Content {
771-
sb.WriteString(p.Text)
771+
if p.IsText() || p.IsData() {
772+
sb.WriteString(p.Text)
773+
}
772774
}
773775
return sb.String()
774776
}
@@ -787,7 +789,9 @@ func (m *Message) Text() string {
787789
}
788790
var sb strings.Builder
789791
for _, p := range m.Content {
790-
sb.WriteString(p.Text)
792+
if p.IsText() || p.IsData() {
793+
sb.WriteString(p.Text)
794+
}
791795
}
792796
return sb.String()
793797
}

0 commit comments

Comments
 (0)