mirror of
https://github.com/sst/opencode.git
synced 2025-08-04 13:30:52 +00:00
fix: anthropic non-empty blocks
This commit is contained in:
parent
49423da081
commit
f004a0b8c3
2 changed files with 20 additions and 12 deletions
|
@ -48,7 +48,10 @@ type TextContent struct {
|
|||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
func (tc TextContent) String() string {
|
||||
func (tc *TextContent) String() string {
|
||||
if tc == nil {
|
||||
return ""
|
||||
}
|
||||
return tc.Text
|
||||
}
|
||||
|
||||
|
@ -115,13 +118,13 @@ type Message struct {
|
|||
UpdatedAt int64
|
||||
}
|
||||
|
||||
func (m *Message) Content() TextContent {
|
||||
func (m *Message) Content() *TextContent {
|
||||
for _, part := range m.Parts {
|
||||
if c, ok := part.(TextContent); ok {
|
||||
return c
|
||||
return &c
|
||||
}
|
||||
}
|
||||
return TextContent{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message) ReasoningContent() ReasoningContent {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue