mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-16 22:53:41 +08:00
♻️ refactor: 重构http请求函数
This commit is contained in:
@@ -116,7 +116,7 @@ func (p *AliProvider) ChatAction(request *types.ChatCompletionRequest, isModelMa
|
||||
|
||||
} else {
|
||||
aliResponse := &AliChatResponse{}
|
||||
errWithCode = p.SendRequest(req, aliResponse)
|
||||
errWithCode = p.SendRequest(req, aliResponse, false)
|
||||
if errWithCode != nil {
|
||||
return
|
||||
}
|
||||
@@ -159,7 +159,7 @@ func (p *AliProvider) sendStreamRequest(req *http.Request) (usage *types.Usage,
|
||||
}
|
||||
|
||||
if common.IsFailureStatusCode(resp) {
|
||||
return nil, p.HandleErrorResp(resp)
|
||||
return nil, common.HandleErrorResp(resp)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
@@ -63,7 +63,7 @@ func (p *AliProvider) EmbeddingsAction(request *types.EmbeddingRequest, isModelM
|
||||
}
|
||||
|
||||
aliEmbeddingResponse := &AliEmbeddingResponse{}
|
||||
errWithCode = p.SendRequest(req, aliEmbeddingResponse)
|
||||
errWithCode = p.SendRequest(req, aliEmbeddingResponse, false)
|
||||
if errWithCode != nil {
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user