فهرست منبع

✨ feat: Update request URL handling for Azure responses based on base URL

CaIon 6 ماه پیش
والد
کامیت
92022360de
1فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 7 1
      relay/channel/openai/adaptor.go

+ 7 - 1
relay/channel/openai/adaptor.go

@@ -132,7 +132,13 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
 			if info.ChannelOtherSettings.AzureResponsesVersion != "" {
 				responsesApiVersion = info.ChannelOtherSettings.AzureResponsesVersion
 			}
-			requestURL = fmt.Sprintf("/openai/v1/responses?api-version=%s", responsesApiVersion)
+
+			subUrl := "/openai/v1/responses"
+			if strings.Contains(info.BaseUrl, "cognitiveservices.azure.com") {
+				subUrl = "/openai/responses"
+			}
+
+			requestURL = fmt.Sprintf("%s?api-version=%s", subUrl, responsesApiVersion)
 			return relaycommon.GetFullRequestURL(info.BaseUrl, requestURL, info.ChannelType), nil
 		}