Commit 479ccebe by JustSong

fix: provide a default value for api-version if not given (#57)

parent d97d50b1
...@@ -93,6 +93,10 @@ func relayHelper(c *gin.Context) error { ...@@ -93,6 +93,10 @@ func relayHelper(c *gin.Context) error {
fullRequestURL := fmt.Sprintf("%s%s", baseURL, requestURL) fullRequestURL := fmt.Sprintf("%s%s", baseURL, requestURL)
if channelType == common.ChannelTypeAzure { if channelType == common.ChannelTypeAzure {
// https://learn.microsoft.com/en-us/azure/cognitive-services/openai/chatgpt-quickstart?pivots=rest-api&tabs=command-line#rest-api // https://learn.microsoft.com/en-us/azure/cognitive-services/openai/chatgpt-quickstart?pivots=rest-api&tabs=command-line#rest-api
query := c.Request.URL.Query()
if query.Get("api-version") == "" {
requestURL = fmt.Sprintf("%s?api-version=2023-03-15-preview", requestURL)
}
baseURL = c.GetString("base_url") baseURL = c.GetString("base_url")
task := strings.TrimPrefix(requestURL, "/v1/") task := strings.TrimPrefix(requestURL, "/v1/")
model_ := textRequest.Model model_ := textRequest.Model
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment