mirror of
https://github.com/alibaba/higress.git
synced 2026-06-02 09:07:26 +08:00
fix(ai-proxy): only perform protocol conversion for non-original protocols
Change-Id: Ib8ae3ebf6b47284108663c97777032d6282bb53c
This commit is contained in:
@@ -205,8 +205,8 @@ func onHttpRequestHeader(ctx wrapper.HttpContext, pluginConfig config.PluginConf
|
||||
if handler, ok := activeProvider.(provider.ApiNameHandler); ok {
|
||||
apiName = handler.GetApiName(path.Path)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Only perform protocol conversion for non-original protocols.
|
||||
// Auto-detect protocol based on request path and handle conversion if needed
|
||||
// If request is Claude format (/v1/messages) but provider doesn't support it natively,
|
||||
// convert to OpenAI format (/v1/chat/completions)
|
||||
@@ -223,6 +223,7 @@ func onHttpRequestHeader(ctx wrapper.HttpContext, pluginConfig config.PluginConf
|
||||
// Provider supports Claude protocol natively, no conversion needed
|
||||
log.Debugf("[Auto Protocol] Claude request detected, provider supports natively, keeping original path: %s, apiName: %s", path.Path, apiName)
|
||||
}
|
||||
}
|
||||
|
||||
if contentType, _ := proxywasm.GetHttpRequestHeader(util.HeaderContentType); contentType != "" && !strings.Contains(contentType, util.MimeTypeApplicationJson) {
|
||||
ctx.DontReadRequestBody()
|
||||
|
||||
Reference in New Issue
Block a user