Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Building an iOS Moderation Layer with Apple Foundation Models framework and Firebase

说明与用途

iOS 混合式审核架构将 Apple Foundation Models 用于快速本地预检,结合 Firebase Callable Functions 进行最终决策,确保在所有设备上实现快速、私密且一致的内容审核。

问题

Developers need a moderation system that works fast, privately, and consistently across devices, including those without Apple Intelligence support.

结果

The hybrid approach delivers fast, private preflight moderation on supported devices, while maintaining consistent server‑side enforcement and fallback paths for unsupported devices, resulting in a robust moderation layer suitable for iOS apps.

工作流

  • 1. User composes text in the app.
  • 2. App calls classifyDraft using Apple Foundation Models; if available, receives a structured ModerationSignal with label, confidence, PII flag, and user message.
  • 3. If the model is unavailable, the app skips preflight and proceeds to step 4.
  • 4. App sends content, local signal (if any), and auth context to a Firebase Callable Function submitContent.
  • 5. Server checks for PII, spam, and local signal labels to decide action: publish, review, or block.
  • 6. Server logs decision reason and stores content in Firestore.
  • 7. For media uploads, a Cloud Storage trigger runs a separate moderation function and writes moderation state back to Firestore.
  • 8. Client UI reflects moderation state and provides feedback to the user.

证据

Apple’s Foundation Models framework gives fast, private, on-device text classification and rewrite suggestions.

来源

Firebase callable functions automatically include Auth and App Check tokens when available, and App Check enforcement can be turned on serverside.

来源

Cloud Storage triggers for handling media separately, because images and video are their own special form of pain.

来源

  • 记录日期: 2026-10-03T23:41:19.157Z