diff --git a/internal/translator/openai/claude/openai_claude_request.go b/internal/translator/openai/claude/openai_claude_request.go index bff306cc..3521b2e5 100644 --- a/internal/translator/openai/claude/openai_claude_request.go +++ b/internal/translator/openai/claude/openai_claude_request.go @@ -8,6 +8,7 @@ package claude import ( "bytes" "encoding/json" + "strings" "github.com/tidwall/gjson" "github.com/tidwall/sjson" @@ -242,11 +243,12 @@ func convertClaudeContentPart(part gjson.Result) (string, bool) { switch partType { case "text": - if !part.Get("text").Exists() { + text := part.Get("text").String() + if strings.TrimSpace(text) == "" { return "", false } textContent := `{"type":"text","text":""}` - textContent, _ = sjson.Set(textContent, "text", part.Get("text").String()) + textContent, _ = sjson.Set(textContent, "text", text) return textContent, true case "image":