MCPcopy Create free account
hub / github.com/astercloud/aster / GetContent

Method GetContent

pkg/types/message.go:205–216  ·  view source on GitHub ↗

GetContent 获取消息内容,优先返回 Content,如果为空则从 ContentBlocks 提取

()

Source from the content-addressed store, hash-verified

203
204// GetContent 获取消息内容,优先返回 Content,如果为空则从 ContentBlocks 提取
205func (m *Message) GetContent() string {
206 if m.Content != "" {
207 return m.Content
208 }
209 // 从 ContentBlocks 提取文本
210 for _, block := range m.ContentBlocks {
211 if tb, ok := block.(*TextBlock); ok {
212 return tb.Text
213 }
214 }
215 return ""
216}
217
218// SetContent 设置消息内容(简单文本格式)
219func (m *Message) SetContent(content string) {

Callers 2

StreamMethod · 0.95
WrapModelCallMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected