()
| 114 | } |
| 115 | |
| 116 | func (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 | |
| 142 | func (c *ClaudeMessage) SetStringContent(content string) { |
| 143 | c.Content = content |
no outgoing calls
no test coverage detected