1Panel-dev / 1Panel-dev/1Panel

[Feature] Add “Replace / Restore” Actions for Sensitive Words in AI Gateway Content Moderation

Open
#13,419 2 comments 0 reactions 1 assignee View on GitHub

@wanghe-fit2cloud is already working on this.

Since Jul 30, 2026.

type: feature-request
Dominant language
Go
Stars
37k
Forks
3.4k
Avg merge
9h 16m
Merged PRs (30d)
105

Description

1Panel Version

2.2.3 企业版

Please describe your needs or suggestions for improvements
现状

企业版 AI 网关 → 内容合规 → 敏感词分组 中,处理动作目前仅支持:

  • 阻断
  • 仅记录
需求

希望增加 敏感词替换 处理动作,并支持「出网关替换、回网关还原」:

  1. 请求出网关:命中敏感词时,将原文替换为占位符/掩码后再发给上游模型
  2. 响应回网关:将模型回复中的占位符还原为原始敏感词,再返回给客户端

这样既能避免敏感原文直接进入公网大模型,又不影响用户侧阅读体验。

使用场景

企业内部统一通过 AI 网关调用公网大模型时,需要对提示词中的姓名、项目名、客户名等敏感信息进行脱敏转发,同时在返回结果中自动还原,便于业务继续使用。

参考截图

当前处理动作仅有「阻断 / 仅记录」:

Image

其他产品可灵活配置阻断、替换、还原等能力,效果示意:

Image
Please describe the solution you suggest

建议在现有敏感词分组「处理动作」中新增选项,例如:

  1. 替换:请求侧将命中词替换为可配置占位符(如 ***[SENSITIVE_1]),再转发上游
  2. 还原(可与替换联动):响应侧按本次请求的替换映射表,把占位符还原为原文后返回客户端
  3. 与现有「阻断」「仅记录」并存,按敏感词分组独立配置

可选增强:

  • 支持自定义替换文本 / 占位符规则
  • 审计日志记录:原词、替换词、是否已还原
  • 可配置仅替换请求、仅还原响应,或双向都启用
Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.