nic-6443 commented on code in PR #13598:
URL: https://github.com/apache/apisix/pull/13598#discussion_r3457090148
##########
apisix/plugins/ai-aliyun-content-moderation.lua:
##########
@@ -61,11 +61,20 @@ local schema = {
fail_mode = binding.schema_property("skip"),
check_request = {type = "boolean", default = true},
check_response = {type = "boolean", default = false},
+ request_check_mode = {
+ type = "string",
+ enum = {"last", "all"},
+ default = "last",
+ description = [[
+ which user messages to moderate: last (only the latest consecutive
user
+ message block) | all (every user message). Both ignore non-user
roles.
+ ]]
+ },
request_check_service = {type = "string", minLength = 1, default =
"llm_query_moderation"},
- request_check_length_limit = {type = "number", default = 2000},
+ request_check_length_limit = {type = "number", minimum = 1, default =
2000},
response_check_service = {type = "string", minLength = 1,
default = "llm_response_moderation"},
- response_check_length_limit = {type = "number", default = 5000},
+ response_check_length_limit = {type = "number", minimum = 1, default =
5000},
Review Comment:
Done in the latest commit — both `request_check_length_limit` and
`response_check_length_limit` are now `type = "integer"` with `minimum = 1`,
matching the other integer fields (e.g. `stream_check_cache_size`).
##########
apisix/plugins/ai-aliyun-content-moderation.lua:
##########
@@ -113,20 +122,20 @@ end
-- openresty ngx.escape_uri don't escape some sub-delimis in rfc 3986 but
aliyun do it,
--- in order to we can calculate same signature with aliyun, we need escape
those chars manually
+-- in order to we can calculate same signature with aliyun, we need escape
those chars manually.
+-- A single JIT-compiled PCRE pass is ~20x faster than five Lua string.gsub
passes over the
+-- encoded text, which is the hottest per-chunk operation in the signing path.
Review Comment:
Done — rewrote the comment for clarity (typos and grammar fixed).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]