diff --git a/changelog/unreleased/kong/ai-proxy-add-deep-copy-lib.yml b/changelog/unreleased/kong/ai-proxy-add-deep-copy-lib.yml new file mode 100644 index 000000000000..ea3d5a198ba7 --- /dev/null +++ b/changelog/unreleased/kong/ai-proxy-add-deep-copy-lib.yml @@ -0,0 +1,4 @@ +message: | + **AI-proxy-plugin**: Replace the lib and use cycle_aware_deep_copy for the `request_table` object. +scope: Plugin +type: feature diff --git a/kong/llm/proxy/handler.lua b/kong/llm/proxy/handler.lua index 2e5bed4edfc9..27540a77fa9d 100644 --- a/kong/llm/proxy/handler.lua +++ b/kong/llm/proxy/handler.lua @@ -12,7 +12,7 @@ local cjson = require("cjson.safe") local kong_utils = require("kong.tools.gzip") local buffer = require "string.buffer" local strip = require("kong.tools.utils").strip - +local cycle_aware_deep_copy = require("kong.tools.table").cycle_aware_deep_copy local EMPTY = require("kong.tools.table").EMPTY @@ -346,7 +346,7 @@ function _M:access(conf) end request_table = kong.request.get_body(content_type, nil, conf.max_request_body_size) - llm_state.set_request_body_table(request_table) + llm_state.set_request_body_table(cycle_aware_deep_copy(request_table)) end if not request_table then