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 jingze
parent b1571de6f0
commit 1199946d36
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)