fix(translator): handle empty tool function names in OpenAI Claude responses

- Added check to prevent processing of empty `function.name` values, ensuring valid data is handled.

Fixed: #2557
This commit is contained in:
Luis Pater
2026-05-04 21:00:33 +08:00
parent bf6fa402e2
commit c1caa454b3
2 changed files with 42 additions and 1 deletions
@@ -236,7 +236,7 @@ func convertOpenAIStreamingChunkToAnthropic(rawJSON []byte, param *ConvertOpenAI
// Handle function name
if function := toolCall.Get("function"); function.Exists() {
if name := function.Get("name"); name.Exists() {
if name := function.Get("name"); name.Exists() && name.String() != "" {
accumulator.Name = util.MapToolName(param.ToolNameMap, name.String())
stopThinkingContentBlock(param, &results)