Merge pull request #2968 from 0-don/fix/claude-input-text-content-block

fix: normalize input_text content blocks in Claude-to-OpenAI conversion
This commit is contained in:
Seefs
2026-02-21 14:28:59 +08:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -127,7 +127,7 @@ func ClaudeToOpenAIRequest(claudeRequest dto.ClaudeRequest, info *relaycommon.Re
for _, mediaMsg := range contents {
switch mediaMsg.Type {
case "text":
case "text", "input_text":
message := dto.MediaContent{
Type: "text",
Text: mediaMsg.GetText(),

View File

@@ -214,8 +214,12 @@ func ChatCompletionsRequestToResponsesRequest(req *dto.GeneralOpenAIRequest) (*d
for _, part := range parts {
switch part.Type {
case dto.ContentTypeText:
textType := "input_text"
if role == "assistant" {
textType = "output_text"
}
contentParts = append(contentParts, map[string]any{
"type": "input_text",
"type": textType,
"text": part.Text,
})
case dto.ContentTypeImageURL: