From 856465ae59a8c1b19e39db211e53036b3eddc9b0 Mon Sep 17 00:00:00 2001 From: a37836323 <37836323@qq.com> Date: Wed, 11 Jun 2025 22:11:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAzure=E6=B8=A0=E9=81=93?= =?UTF-8?q?=E5=AF=B9responses=20API=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20-=20=E4=B8=BAAzure=E6=B8=A0=E9=81=93?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9responses=20API=E7=9A=84=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=A4=84=E7=90=86=20-=20=E5=85=BC=E5=AE=B9=E5=BE=AE?= =?UTF-8?q?=E8=BD=AF=E6=96=B0=E7=9A=84API=E6=A0=BC=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E7=94=A8preview=E7=89=88=E6=9C=AC=E7=9A=84api-version?= =?UTF-8?q?=20-=20=E4=BF=AE=E5=A4=8D=E4=BA=86Azure=E6=B8=A0=E9=81=93?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E5=A4=84=E7=90=86responses?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- relay/channel/openai/adaptor.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/relay/channel/openai/adaptor.go b/relay/channel/openai/adaptor.go index f0cf073f..8358f3e2 100644 --- a/relay/channel/openai/adaptor.go +++ b/relay/channel/openai/adaptor.go @@ -88,6 +88,13 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) { requestURL := strings.Split(info.RequestURLPath, "?")[0] requestURL = fmt.Sprintf("%s?api-version=%s", requestURL, apiVersion) task := strings.TrimPrefix(requestURL, "/v1/") + + // 特殊处理 responses API + if info.RelayMode == constant.RelayModeResponses { + requestURL = fmt.Sprintf("/openai/v1/responses?api-version=preview") + return relaycommon.GetFullRequestURL(info.BaseUrl, requestURL, info.ChannelType), nil + } + model_ := info.UpstreamModelName // 2025年5月10日后创建的渠道不移除. if info.ChannelCreateTime < constant2.AzureNoRemoveDotTime {