MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / GetStringContent

Method GetStringContent

dto/claude.go:116–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114}
115
116func (c *ClaudeMessage) GetStringContent() string {
117 if c.Content == nil {
118 return ""
119 }
120 switch c.Content.(type) {
121 case string:
122 return c.Content.(string)
123 case []any:
124 var contentStr string
125 for _, contentItem := range c.Content.([]any) {
126 contentMap, ok := contentItem.(map[string]any)
127 if !ok {
128 continue
129 }
130 if contentMap["type"] == ContentTypeText {
131 if subStr, ok := contentMap["text"].(string); ok {
132 contentStr += subStr
133 }
134 }
135 }
136 return contentStr
137 }
138
139 return ""
140}
141
142func (c *ClaudeMessage) SetStringContent(content string) {
143 c.Content = content

Callers 2

ClaudeToOpenAIRequestFunction · 0.45
CountTokenClaudeMessagesFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected