perf: reuse http client to reduce delay

This commit is contained in:
JustSong
2023-07-23 15:18:58 +08:00
parent dccd66b852
commit 3da119efba
5 changed files with 11 additions and 9 deletions

View File

@@ -109,8 +109,7 @@ func relayImageHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode
req.Header.Set("Content-Type", c.Request.Header.Get("Content-Type"))
req.Header.Set("Accept", c.Request.Header.Get("Accept"))
client := &http.Client{}
resp, err := client.Do(req)
resp, err := httpClient.Do(req)
if err != nil {
return errorWrapper(err, "do_request_failed", http.StatusInternalServerError)
}