7. AI 自动审核模块

AI 自动审核模块接入 DeepSeek API(模型 deepseek-v4-flash,思考强度关闭),自动审核上传权限申请、检测待审核封禁申请中的违禁内容,并提供单条内容检测接口。模块接口挂在 /aireview 前缀下。

7.1 内容检测 API

对单条内容做违禁词检测。

接口: POST /aireview/check

请求:

http
POST /aireview/check Content-Type: application/json Authorization: Bearer <你的token>
JSON
{ "content": "要检测的内容" }

Token 也可放入请求体:{"token": "xxx", "content": "..."},优先取 Header。

响应(violation 三态):

场景状态码返回
命中违禁词200{"violation": true, "reason": "命中的违禁内容"}
未命中200{"violation": false, "reason": "正常"}
AI 返回异常500{"violation": "error", "reason": "AI 返回内容异常"}
缺 token400{"violation": "error", "reason": "Missing token"}
token 非法401{"violation": "error", "reason": "Invalid token"}
缺 content400{"violation": "error", "reason": "Missing content"}
触发限流429{"violation": "error", "reason": "Rate limit exceeded", "release_at": "解除时间"}

限流规则(同一 IP,30 秒窗口):

请求次数封禁时长
≥ 40 次1 分钟
≥ 60 次5 分钟
≥ 90 次30 分钟

7.2 状态与统计 API

查看模块运行状态

接口: GET /aireview/status

响应示例:

JSON
{ "enabled": true, "model": "deepseek-v4-flash", "thinking": "off", "api_key_configured": true, "stats": { "reviewed_perms": 0, "deleted_bans": 0, "ai_calls": 0, "last_run": "...", "last_error": null }, "seen_pending_files": 0, "seen_perm_ids": 0 }

查看调用统计

接口: GET /aireview/stats

返回今日/本周/本月/全年的调用次数与违禁次数。

响应示例:

JSON
{ "today": {"calls": 5, "violations": 3}, "week": {"calls": 12, "violations": 7}, "month": {"calls": 50, "violations": 20}, "year": {"calls": 300, "violations": 100} }

7.3 检测类别说明

/aireview/check 会检测以下内容(命中即 violation: true):