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

Method StringContent

dto/openai_request.go:248–269  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

246}
247
248func (m *Message) StringContent() string {
249 switch m.Content.(type) {
250 case string:
251 return m.Content.(string)
252 case []any:
253 var contentStr string
254 for _, contentItem := range m.Content.([]any) {
255 contentMap, ok := contentItem.(map[string]any)
256 if !ok {
257 continue
258 }
259 if contentMap["type"] == ContentTypeText {
260 if subStr, ok := contentMap["text"].(string); ok {
261 contentStr += subStr
262 }
263 }
264 }
265 return contentStr
266 }
267
268 return ""
269}
270
271func (m *Message) SetNullContent() {
272 m.Content = nil

Callers 14

ResponseOpenAI2ClaudeFunction · 0.80
CovertGemini2OpenAIFunction · 0.80
requestOpenAI2XunfeiFunction · 0.80
requestOpenAI2PaLMFunction · 0.80
OpenaiHandlerFunction · 0.80
requestOpenAI2ZhipuFunction · 0.80
requestOpenAI2TencentFunction · 0.80
requestOpenAI2DifyFunction · 0.80
requestOpenAI2CohereFunction · 0.80
requestOpenAI2BaiduFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected