Skip to content

Commit 52893cd

Browse files
committed
fix(responses): 修复HandlerChatStream中对response.completed的处理,确保使用信息的正确性
1 parent 177ab7d commit 52893cd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

providers/openai/responses.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ func (h *OpenAIResponsesStreamHandler) HandlerChatStream(rawLine *[]byte, dataCh
125125
h.Usage.IncExtraBilling(types.APITollTypeFileSearch, "")
126126
}
127127
}
128-
case "response.completed":
129-
if openaiResponse.Response != nil {
128+
default:
129+
if openaiResponse.Response != nil && openaiResponse.Response.Usage != nil {
130130
usage := openaiResponse.Response.Usage
131131
*h.Usage = *usage.ToOpenAIUsage()
132132
getResponsesExtraBilling(openaiResponse.Response, h.Usage)

0 commit comments

Comments
 (0)