mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-16 13:13:41 +08:00
✨ add channel proxy
This commit is contained in:
@@ -38,7 +38,7 @@ func (c *ImageAzureResponse) ResponseHandler(resp *http.Response) (OpenAIRespons
|
||||
for i := 0; i < 3; i++ {
|
||||
// 休眠 2 秒
|
||||
time.Sleep(2 * time.Second)
|
||||
_, errWithCode = common.SendRequest(req, &getImageAzureResponse, false)
|
||||
_, errWithCode = common.SendRequest(req, &getImageAzureResponse, false, c.Proxy)
|
||||
fmt.Println("getImageAzureResponse", getImageAzureResponse)
|
||||
if errWithCode != nil {
|
||||
return
|
||||
@@ -81,6 +81,7 @@ func (p *AzureProvider) ImageGenerationsAction(request *types.ImageRequest, isMo
|
||||
if request.Model == "dall-e-2" {
|
||||
imageAzureResponse := &ImageAzureResponse{
|
||||
Header: headers,
|
||||
Proxy: p.Channel.Proxy,
|
||||
}
|
||||
errWithCode = p.SendRequest(req, imageAzureResponse, false)
|
||||
} else {
|
||||
|
||||
@@ -10,6 +10,7 @@ type ImageAzureResponse struct {
|
||||
Status string `json:"status,omitempty"`
|
||||
Error ImageAzureError `json:"error,omitempty"`
|
||||
Header map[string]string `json:"header,omitempty"`
|
||||
Proxy string `json:"proxy,omitempty"`
|
||||
}
|
||||
|
||||
type ImageAzureError struct {
|
||||
|
||||
Reference in New Issue
Block a user