mirror of
https://github.com/alibaba/higress.git
synced 2026-03-02 07:30:49 +08:00
feat: Enhance the feature of ai-proxy plugin (#976)
This commit is contained in:
@@ -46,6 +46,8 @@ type HttpContext interface {
|
||||
BufferRequestBody()
|
||||
// If the onHttpStreamingResponseBody handle is not set, and the onHttpResponseBody handle is set, the response body will be buffered by default
|
||||
BufferResponseBody()
|
||||
// If any request header is changed in onHttpRequestHeaders, envoy will re-calculate the route. Call this function to disable the re-routing.
|
||||
DisableReroute()
|
||||
}
|
||||
|
||||
type ParseConfigFunc[PluginConfig any] func(json gjson.Result, config *PluginConfig, log Log) error
|
||||
@@ -331,6 +333,10 @@ func (ctx *CommonHttpCtx[PluginConfig]) BufferResponseBody() {
|
||||
ctx.streamingResponseBody = false
|
||||
}
|
||||
|
||||
func (ctx *CommonHttpCtx[PluginConfig]) DisableReroute() {
|
||||
_ = proxywasm.SetProperty([]string{"clear_route_cache"}, []byte("off"))
|
||||
}
|
||||
|
||||
func (ctx *CommonHttpCtx[PluginConfig]) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
|
||||
config, err := ctx.plugin.GetMatchConfig()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user