Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/cliproxyctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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":
Expand Down
Loading