feat: add CloseResponseBodyGracefully function to handle HTTP response body closure

This commit is contained in:
CaIon
2025-06-27 21:37:13 +08:00
parent 647f8d7958
commit 3002659f47
23 changed files with 52 additions and 125 deletions

View File

@@ -48,10 +48,7 @@ func cozeChatHandler(c *gin.Context, resp *http.Response, info *relaycommon.Rela
if err != nil {
return service.OpenAIErrorWrapper(err, "read_response_body_failed", http.StatusInternalServerError), nil
}
err = resp.Body.Close()
if err != nil {
return service.OpenAIErrorWrapperLocal(err, "close_response_body_failed", http.StatusInternalServerError), nil
}
common.CloseResponseBodyGracefully(resp)
// convert coze response to openai response
var response dto.TextResponse
var cozeResponse CozeChatDetailResponse