🎨 Change the method of getting channel parameters

This commit is contained in:
Martial BE
2023-12-26 16:40:50 +08:00
parent 47b72b850f
commit eeb867da10
34 changed files with 67 additions and 120 deletions

View File

@@ -59,7 +59,7 @@ func (p *OpenAIProvider) GetFullRequestURL(requestURL string, modelName string)
baseURL := strings.TrimSuffix(p.GetBaseURL(), "/")
if p.IsAzure {
apiVersion := p.Context.GetString("api_version")
apiVersion := p.Channel.Other
if modelName == "dall-e-2" {
// 因为dall-e-3需要api-version=2023-12-01-preview但是该版本
// 已经没有dall-e-2了所以暂时写死
@@ -85,9 +85,9 @@ func (p *OpenAIProvider) GetRequestHeaders() (headers map[string]string) {
headers = make(map[string]string)
p.CommonRequestHeaders(headers)
if p.IsAzure {
headers["api-key"] = p.Context.GetString("api_key")
headers["api-key"] = p.Channel.Key
} else {
headers["Authorization"] = fmt.Sprintf("Bearer %s", p.Context.GetString("api_key"))
headers["Authorization"] = fmt.Sprintf("Bearer %s", p.Channel.Key)
}
return headers