Skip to content

feat: add ai-aliyun-content-moderation plugin#12530

Merged
Revolyssup merged 14 commits into
apache:masterfrom
Revolyssup:revolyssup/ai-aliyun-moderation
Aug 26, 2025
Merged

feat: add ai-aliyun-content-moderation plugin#12530
Revolyssup merged 14 commits into
apache:masterfrom
Revolyssup:revolyssup/ai-aliyun-moderation

Conversation

@Revolyssup

@Revolyssup Revolyssup commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

Description

  1. Refactor and improve the chunk decoding from llm backend into a separate sse.lua
  2. Add lua_response_filter which runs lua_body_filter as defined by each plugin. We can't use body_filter directly because in case of ai response, the responses are managed directly by apisix, therefore this new phase is introduced.
  3. Modifies ai-request-rewrite plugin to leverage lua_body_filter for writing response. This way is cleaner to read as all response modification for the ai plugins happens at one place lua_response_filter and each plugin just has a callback to take headers, body and return code,body.
  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@Revolyssup
Revolyssup marked this pull request as draft August 18, 2025 08:28
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. plugin labels Aug 18, 2025
@Revolyssup
Revolyssup marked this pull request as ready for review August 21, 2025 07:41
@Revolyssup
Revolyssup marked this pull request as draft August 22, 2025 06:29
@Revolyssup
Revolyssup marked this pull request as ready for review August 22, 2025 07:57
},
"auth": {"header": {"Authorization": "Bearer token"}},
"options": {"model": "gpt-4"},
"override": {"endpoint": "http://localhost:16724"},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nic-6443
nic-6443 previously approved these changes Aug 25, 2025
@Revolyssup
Revolyssup requested a review from AlinsRan August 25, 2025 05:46
membphis
membphis previously approved these changes Aug 25, 2025
Comment thread apisix/plugins/ai-aliyun-content-moderation.lua
Comment thread apisix/plugins/ai-aliyun-content-moderation.lua
@Revolyssup
Revolyssup dismissed stale reviews from membphis and nic-6443 via 796bb2a August 25, 2025 11:54
@Baoyuantop
Baoyuantop requested a review from membphis August 26, 2025 01:47

@membphis membphis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants