diff --git a/cmd/cliproxyctl/main.go b/cmd/cliproxyctl/main.go index 93e187cb50..c569f35c57 100644 --- a/cmd/cliproxyctl/main.go +++ b/cmd/cliproxyctl/main.go @@ -16,7 +16,7 @@ import ( "time" cliproxycmd "github.com/router-for-me/CLIProxyAPI/v6/pkg/llmproxy/cmd" - "github.com/router-for-me/CLIProxyAPI/v6/pkg/llmproxy/config" + "github.com/router-for-me/CLIProxyAPI/v6/internal/config" ) const responseSchemaVersion = "cliproxyctl.response.v1" diff --git a/internal/translator/claude/openai/chat-completions/claude_openai_request.go b/internal/translator/claude/openai/chat-completions/claude_openai_request.go index f94825b2a0..1cde776629 100644 --- a/internal/translator/claude/openai/chat-completions/claude_openai_request.go +++ b/internal/translator/claude/openai/chat-completions/claude_openai_request.go @@ -156,8 +156,12 @@ func ConvertOpenAIRequestToClaude(modelName string, inputRawJSON []byte, stream } else if contentResult.Exists() && contentResult.IsArray() { contentResult.ForEach(func(_, part gjson.Result) bool { if part.Get("type").String() == "text" { + textContent := part.Get("text").String() + if textContent == "" { + return true + } textPart := `{"type":"text","text":""}` - textPart, _ = sjson.Set(textPart, "text", part.Get("text").String()) + textPart, _ = sjson.Set(textPart, "text", textContent) out, _ = sjson.SetRaw(out, fmt.Sprintf("messages.%d.content.-1", systemMessageIndex), textPart) } return true @@ -178,8 +182,12 @@ func ConvertOpenAIRequestToClaude(modelName string, inputRawJSON []byte, stream switch partType { case "text": + textContent := part.Get("text").String() + if textContent == "" { + return true + } textPart := `{"type":"text","text":""}` - textPart, _ = sjson.Set(textPart, "text", part.Get("text").String()) + textPart, _ = sjson.Set(textPart, "text", textContent) msg, _ = sjson.SetRaw(msg, "content.-1", textPart) case "image_url":