feat(news): add content safety baseline gate for daily news morning
Memind CI / Test, build, and release guards (push) Successful in 4m51s
Memind CI / Test, build, and release guards (push) Successful in 4m51s
Rules-first safety gate covering adult content, minor protection, legal compliance (stock tips, crypto promotion, gambling, drugs, source provenance for political news) and ethics (tragedy tone, discrimination, gossip). Filters without blocking publication: - SearXNG prefetch uses safesearch=2 and drops block-level results before they can be supplemented into the page - worker sanitizes the page after dedupe and after the image gate, with a single batched model review; review-level items are removed fail-safe when the reviewer is unavailable - sections the gate filtered are exempt from fill/structure audits so filtering never turns into a failed generation - push/preview recheck removes block-level items and masks title/digest - AI-assisted disclosure in page footer and WeChat draft, plus aigc and content-safety meta markers Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -109,6 +109,31 @@ news002 的卡片图会先上传到微信正文素材接口,再由 inline 渲
|
||||
真实图片来源按优先级取 SearXNG 结果里的 `img_src`/`thumbnail`,以及文章来源的
|
||||
`og:image:secure_url`、`og:image`、`twitter:image`;不使用与事件无法核验关系的泛图片搜索结果。
|
||||
|
||||
## 内容安全底线闸门
|
||||
|
||||
成人、未成年人保护、法律合规、人文伦理、来源资质是底线,**只过滤、不阻断**:命中就删卡或改写,生成和发布照常进行。
|
||||
|
||||
| 层 | 位置 | 做什么 |
|
||||
|----|------|--------|
|
||||
| 提示词 | `NEWS_MORNING_CONTENT_SAFETY_TASK_SPEC`(拼进生成任务,不改冻结的 news001 模板) | 告诉 Agent 底线 |
|
||||
| 检索 | `wechat-news-morning-search.mjs` | SearXNG `safesearch=2`;预取结果先过 `filterNewsSearchGroupsForSafety`,因为 SearXNG 补位会把预取结果直接写进页面 |
|
||||
| 页面 | `wechat-news-morning-content-safety.mjs`,worker 在去重后、配图检查后各跑一次 | 逐块检查卡片 / 速读 / 深读 / 导语;一次批量模型复审 |
|
||||
| 推送 | `pushDraft` / 预览前 `sanitizeNewsMorningHtmlSync` | 只删 block 级,标题与摘要残留词打码 |
|
||||
|
||||
规则在 [`news-content-safety-rules.mjs`](../news-content-safety-rules.mjs),分两级:
|
||||
|
||||
- `block`:命中必删,模型复审不能放行(色情、荐股、虚拟货币推广、赌博毒品交易、歧视词、八卦、灾难调侃、非新闻来源、自媒体作时政来源等)。
|
||||
- `review`:交给模型复审(性犯罪新闻、涉未成年人伤害、自杀、恐袭、传闻、标题党、币价行情等)。**复审不可用时按失败即删处理。**
|
||||
|
||||
删卡导致栏目不满时,被删过内容的栏目会进 `exemptSectionIds`,配图/写满检查对这些栏目豁免,否则「过滤」会变成「阻断发布」。
|
||||
被删事件出现在 description 里时,用剩余速读重建 description;残留在 meta、JSON-LD 的 block 级词打码。
|
||||
页面 footer 与微信草稿底部追加「本文由 AI 辅助整理」显式标识,`<head>` 写入 `memind-aigc`(隐式标识)与 `memind-content-safety`(审计标记)。
|
||||
|
||||
- 关闭模型复审(规则仍生效):`MEMIND_NEWS_MORNING_CONTENT_REVIEW=0`
|
||||
- 复审模型 / 超时:`MEMIND_NEWS_MORNING_CONTENT_REVIEW_MODEL`、`MEMIND_NEWS_MORNING_CONTENT_REVIEW_TIMEOUT_MS`(默认 90s)
|
||||
|
||||
> 规则只能加严或修正误伤,不得为了写满栏目放宽 block 级规则。修正误伤时必须在 `news-content-safety-rules.test.mjs` 补一条「不应命中」的用例。
|
||||
|
||||
## 预览与验证
|
||||
|
||||
```bash
|
||||
@@ -120,6 +145,8 @@ node scripts/build-news002-real-design-sample.mjs
|
||||
|
||||
# 相关单测
|
||||
node --test news-morning-templates.test.mjs \
|
||||
news-content-safety-rules.test.mjs \
|
||||
wechat-news-morning-content-safety.test.mjs \
|
||||
wechat-news-morning-images.test.mjs \
|
||||
wechat-news-morning-dedup.test.mjs \
|
||||
wechat-news-morning-draft.test.mjs \
|
||||
|
||||
Reference in New Issue
Block a user