mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-22 11:25:15 +00:00
fix: anthropic non-empty blocks
This commit is contained in:
parent
efaba6c5b8
commit
afcdabd095
1 changed files with 7 additions and 8 deletions
|
|
@ -85,16 +85,15 @@ func (a *anthropicClient) convertMessages(messages []message.Message) (anthropic
|
|||
|
||||
if msg.Content() != nil {
|
||||
content := msg.Content().String()
|
||||
if strings.TrimSpace(content) == "" {
|
||||
content = " "
|
||||
}
|
||||
block := anthropic.NewTextBlock(content)
|
||||
if cache && !a.options.disableCache {
|
||||
block.OfRequestTextBlock.CacheControl = anthropic.CacheControlEphemeralParam{
|
||||
Type: "ephemeral",
|
||||
if strings.TrimSpace(content) != "" {
|
||||
block := anthropic.NewTextBlock(content)
|
||||
if cache && !a.options.disableCache {
|
||||
block.OfRequestTextBlock.CacheControl = anthropic.CacheControlEphemeralParam{
|
||||
Type: "ephemeral",
|
||||
}
|
||||
}
|
||||
blocks = append(blocks, block)
|
||||
}
|
||||
blocks = append(blocks, block)
|
||||
}
|
||||
|
||||
for _, toolCall := range msg.ToolCalls() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue