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

@@ -45,8 +45,7 @@ func testChannel(channel *model.Channel, request ChatRequest) (error, *OpenAIErr
req.Header.Set("Authorization", "Bearer "+channel.Key)
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
resp, err := httpClient.Do(req)
if err != nil {
return err, nil
}