Merge pull request #2511 from JerryKwan/issue2499

This commit is contained in:
Seefs
2025-12-24 16:51:51 +08:00
committed by GitHub
+4
View File
@@ -389,6 +389,7 @@ func StreamResponseOpenAI2Claude(openAIResponse *dto.ChatCompletionsStreamRespon
} }
idx := blockIndex idx := blockIndex
if toolCall.Function.Name != "" {
claudeResponses = append(claudeResponses, &dto.ClaudeResponse{ claudeResponses = append(claudeResponses, &dto.ClaudeResponse{
Index: &idx, Index: &idx,
Type: "content_block_start", Type: "content_block_start",
@@ -399,7 +400,9 @@ func StreamResponseOpenAI2Claude(openAIResponse *dto.ChatCompletionsStreamRespon
Input: map[string]interface{}{}, Input: map[string]interface{}{},
}, },
}) })
}
if len(toolCall.Function.Arguments) > 0 {
claudeResponses = append(claudeResponses, &dto.ClaudeResponse{ claudeResponses = append(claudeResponses, &dto.ClaudeResponse{
Index: &idx, Index: &idx,
Type: "content_block_delta", Type: "content_block_delta",
@@ -408,6 +411,7 @@ func StreamResponseOpenAI2Claude(openAIResponse *dto.ChatCompletionsStreamRespon
PartialJson: &toolCall.Function.Arguments, PartialJson: &toolCall.Function.Arguments,
}, },
}) })
}
info.ClaudeConvertInfo.Index = blockIndex info.ClaudeConvertInfo.Index = blockIndex
} }