File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -980,16 +980,14 @@ func (cm *ChatModel) convCandidate(candidate *genai.Candidate) (*schema.Message,
980980 }
981981
982982 var (
983- texts []string
984- outParts []schema.MessageOutputPart
985- contentBuilder strings.Builder
983+ texts []string
984+ outParts []schema.MessageOutputPart
986985 )
987986 for _ , part := range candidate .Content .Parts {
988987 if part .Thought {
989988 result .ReasoningContent = part .Text
990989 } else if len (part .Text ) > 0 {
991990 texts = append (texts , part .Text )
992- contentBuilder .WriteString (part .Text )
993991 outParts = append (outParts , schema.MessageOutputPart {
994992 Type : schema .ChatMessagePartTypeText ,
995993 Text : part .Text ,
@@ -1024,8 +1022,10 @@ func (cm *ChatModel) convCandidate(candidate *genai.Candidate) (*schema.Message,
10241022 outParts = append (outParts , outPart )
10251023 }
10261024 }
1027- result .Content = contentBuilder .String ()
1028- if len (texts ) > 1 {
1025+
1026+ if len (texts ) == 1 {
1027+ result .Content = texts [0 ]
1028+ } else if len (texts ) > 1 {
10291029 for _ , text := range texts {
10301030 result .MultiContent = append (result .MultiContent , schema.ChatMessagePart {
10311031 Type : schema .ChatMessagePartTypeText ,
You can’t perform that action at this time.
0 commit comments