mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-18 08:26:37 +08:00
fix: support AI Gateway, close #52
This commit is contained in:
parent
4274b925da
commit
0004c1022d
@ -43,14 +43,10 @@ func testChannel(channel *model.Channel, request ChatRequest) (err error, openai
|
|||||||
default:
|
default:
|
||||||
request.Model = "gpt-3.5-turbo"
|
request.Model = "gpt-3.5-turbo"
|
||||||
}
|
}
|
||||||
requestURL := common.ChannelBaseURLs[channel.Type]
|
requestURL := getFullRequestURL(channel.GetBaseURL(), "/v1/chat/completions", channel.Type)
|
||||||
|
|
||||||
if channel.Type == common.ChannelTypeAzure {
|
if channel.Type == common.ChannelTypeAzure {
|
||||||
requestURL = getFullRequestURL(channel.GetBaseURL(), fmt.Sprintf("/openai/deployments/%s/chat/completions?api-version=2023-03-15-preview", request.Model), channel.Type)
|
requestURL = getFullRequestURL(channel.GetBaseURL(), fmt.Sprintf("/openai/deployments/%s/chat/completions?api-version=2023-03-15-preview", request.Model), channel.Type)
|
||||||
} else {
|
|
||||||
if channel.GetBaseURL() != "" {
|
|
||||||
requestURL = channel.GetBaseURL()
|
|
||||||
}
|
|
||||||
requestURL += "/v1/chat/completions"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonData, err := json.Marshal(request)
|
jsonData, err := json.Marshal(request)
|
||||||
|
Loading…
Reference in New Issue
Block a user