We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc42839 commit ca5643fCopy full SHA for ca5643f
pkg/openai/chat.go
@@ -2,6 +2,8 @@ package openai
2
3
import (
4
// Packages
5
+ "strings"
6
+
7
"github.com/mutablelogic/go-client/pkg/client"
8
)
9
@@ -50,6 +52,17 @@ func (msg *Message) AppendImageFile(file ...string) *Message {
50
52
return msg
51
53
}
54
55
+// Return the text of the message
56
+func (arr MessageContentArray) Flatten() string {
57
+ var content []string
58
+ for _, v := range arr {
59
+ if v.Text != nil {
60
+ content = append(content, *v.Text)
61
+ }
62
63
+ return strings.Join(content, "\n")
64
+}
65
66
///////////////////////////////////////////////////////////////////////////////
67
// API CALLS
68
0 commit comments