add channel proxy

This commit is contained in:
Martial BE
2023-12-26 18:42:39 +08:00
parent eeb867da10
commit fb24d024a7
27 changed files with 181 additions and 33 deletions

View File

@@ -142,10 +142,12 @@ func (p *ClaudeProvider) sendStreamRequest(req *http.Request) (*types.OpenAIErro
defer req.Body.Close()
// 发送请求
resp, err := common.HttpClient.Do(req)
client := common.GetHttpClient(p.Channel.Proxy)
resp, err := client.Do(req)
if err != nil {
return common.ErrorWrapper(err, "http_request_failed", http.StatusInternalServerError), ""
}
common.PutHttpClient(client)
if common.IsFailureStatusCode(resp) {
return common.HandleErrorResp(resp), ""