mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 02:04:22 +01:00
fix: anthropic non-empty blocks
This commit is contained in:
@@ -85,16 +85,15 @@ func (a *anthropicClient) convertMessages(messages []message.Message) (anthropic
|
|||||||
|
|
||||||
if msg.Content() != nil {
|
if msg.Content() != nil {
|
||||||
content := msg.Content().String()
|
content := msg.Content().String()
|
||||||
if strings.TrimSpace(content) == "" {
|
if strings.TrimSpace(content) != "" {
|
||||||
content = " "
|
block := anthropic.NewTextBlock(content)
|
||||||
}
|
if cache && !a.options.disableCache {
|
||||||
block := anthropic.NewTextBlock(content)
|
block.OfRequestTextBlock.CacheControl = anthropic.CacheControlEphemeralParam{
|
||||||
if cache && !a.options.disableCache {
|
Type: "ephemeral",
|
||||||
block.OfRequestTextBlock.CacheControl = anthropic.CacheControlEphemeralParam{
|
}
|
||||||
Type: "ephemeral",
|
|
||||||
}
|
}
|
||||||
|
blocks = append(blocks, block)
|
||||||
}
|
}
|
||||||
blocks = append(blocks, block)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, toolCall := range msg.ToolCalls() {
|
for _, toolCall := range msg.ToolCalls() {
|
||||||
|
|||||||
Reference in New Issue
Block a user