special handling for cases where extracted content is empty and add unit test (#3251)

This commit is contained in:
rinfx
2025-12-23 16:55:06 +08:00
committed by GitHub
parent 00d0ad0f5e
commit 3191bb1bf5
3 changed files with 707 additions and 2 deletions

View File

@@ -100,10 +100,11 @@ func HandleTextGenerationStreamingResponseBody(ctx wrapper.HttpContext, config c
break
}
}
// if streaming body has reasoning_content, buffer maybe empty
// case 1: streaming body has reasoning_content, part of buffer maybe empty
// case 2: streaming body has toolcall result, part of buffer maybe empty
log.Debugf("current content piece: %s", buffer)
if len(buffer) == 0 {
return
buffer = "[empty content]"
}
ctx.SetContext("during_call", true)
log.Debugf("current content piece: %s", buffer)