diff --git a/relay/channel/openai/adaptor.go b/relay/channel/openai/adaptor.go index 2b7f71d6..56a58f28 100644 --- a/relay/channel/openai/adaptor.go +++ b/relay/channel/openai/adaptor.go @@ -136,8 +136,8 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) { task = "chat/completions" + task } - // 特殊处理 responses API - if info.RelayMode == relayconstant.RelayModeResponses { + // 特殊处理 responses API(包含 compact) + if info.RelayMode == relayconstant.RelayModeResponses || info.RelayMode == relayconstant.RelayModeResponsesCompact { responsesApiVersion := "preview" subUrl := "/openai/v1/responses" @@ -150,6 +150,11 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) { responsesApiVersion = info.ChannelOtherSettings.AzureResponsesVersion } + // compact 模式追加 /compact + if info.RelayMode == relayconstant.RelayModeResponsesCompact { + subUrl = subUrl + "/compact" + } + requestURL = fmt.Sprintf("%s?api-version=%s", subUrl, responsesApiVersion) return relaycommon.GetFullRequestURL(info.ChannelBaseUrl, requestURL, info.ChannelType), nil }