大量修改二期功能清单内容

This commit is contained in:
Azmat@qq.com
2026-08-17 18:26:42 +08:00
parent 36e91aab3c
commit d1ecb52125
76 changed files with 4222 additions and 294 deletions
+34 -3
View File
@@ -59,11 +59,16 @@ def get_or_create_team_group(team) -> AssetReviewGroup:
return grp
def submit_asset_for_review(asset: Asset) -> bool:
def submit_asset_for_review(asset: Asset, *, force: bool = False) -> bool:
"""真人资产送审:建组(若无)→ 传素材 → 标 processing。出错只记日志,不抛。
返回是否真正进入审核(True=已标 processing;False=未送审/未配置/失败),
供手动兜底端点据此如实回报,避免前端把「没送出去」误显示成「审核中」。"""
if not assets_client.is_enabled() or asset.category not in Asset.REVIEW_CATEGORIES:
供手动兜底端点据此如实回报,避免前端把「没送出去」误显示成「审核中」。
force=True 跳过 REVIEW_CATEGORIES 白名单:用户上传的资产被拿去当生成参考时,
我们无从判断里面有没有真人脸,一律登记一次(与人物素材库上传同策略)。"""
if not assets_client.is_enabled():
return False
if not force and asset.category not in Asset.REVIEW_CATEGORIES:
return False
url = _asset_url(asset)
if not url:
@@ -85,6 +90,32 @@ def submit_asset_for_review(asset: Asset) -> bool:
return False
# 平台自己生成的资产,提示词与生成链路都在我们手里,视为免审;用户上传的必须真过一遍审核。
# 判据是 Asset.source 而不是「在不在某个库里」—— 按库免审等于把审核架空:
# 用户上传一张图进资产库,再从自由创作引用出去,就绕过了整套人像审核。
SELF_TRUSTED_SOURCES = (Asset.Source.AI_GENERATED, Asset.Source.SYSTEM)
def reference_review_state(asset: Asset) -> str:
"""引用一个平台资产(自由创作 @引用三库)前的审核判定。
返回 allowed / processing / failed / unsubmitted 四态之一,由调用方决定放行还是给提示。
未送审(unsubmitted)不代表拒绝到底 —— 调用方应顺手送一次审,让用户等一会儿再来。
"""
if not assets_client.is_enabled():
# 审核整套机制没配置时不能拿它拦人,否则一关审核全平台引用都用不了
return "allowed"
if asset.source in SELF_TRUSTED_SOURCES:
return "allowed"
if asset.review_status == "active":
return "allowed"
if asset.review_status == "processing":
return "processing"
if asset.review_status == "failed":
return "failed"
return "unsubmitted"
def poll_asset_review(asset: Asset) -> str:
"""查单个真人资产审核状态并更新 review_status。返回最新状态。
只在状态变化时落库(保留 updated_at 作为「进入 processing 的时刻」);processing 超时兜底为 failed。"""