Files
beige/backend/app/constants/enums.py
yangqianqian 6a2632da70 baseline: Clover 独立仓库首次基线提交
将 Clover 从上层产品包旧仓库中独立出来,建立专属版本控制。
当前状态=纵切片端到端已打通(登录→选品→出文出图→审核→下载包),
M1文案质量去套路化已验收。此提交作为后续按核销清单逐条修复的基线。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 11:30:22 +08:00

133 lines
4.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
constants/enums.py — Clover 命名中心
DB枚举约束在此定义消除三套命名打架。
业务参数(品类/数量/角度不在此定义基石A
"""
from enum import Enum
# ── 用户角色 ────────────────────────────────────────────
class UserRole(str, Enum):
ADMIN = "admin"
SUPERVISOR = "supervisor"
OPERATOR = "operator"
# ── 任务状态机 ──────────────────────────────────────────
class TaskStatus(str, Enum):
PENDING = "pending"
GENERATING = "generating"
PENDING_SELECTION = "pending_selection"
PENDING_REVIEW = "pending_review"
APPROVED = "approved"
REJECTED = "rejected"
ARCHIVED = "archived"
# ── 审核状态generation_tasks 平铺字段)──────────────────
class ReviewStatus(str, Enum):
PENDING = "pending"
APPROVED = "approved"
REJECTED = "rejected"
# ── 文案候选来源 ───────────────────────────────────────
class CandidateSource(str, Enum):
AI = "ai"
IMPORT = "import"
# ── 违禁词等级 ────────────────────────────────────────
class BannedWordLevel(str, Enum):
AUTO_FIX = "auto_fix"
SOFT_WARN = "soft_warn"
HARD_BLOCK = "hard_block"
# ── 违禁词扫描结果 ───────────────────────────────────
class BannedWordStatus(str, Enum):
PASS = "pass"
AUTO_FIXED = "auto_fixed"
SOFT_WARN = "soft_warn"
HARD_BLOCK = "hard_block"
# ── 飞轮信号类型 ─────────────────────────────────────
class SignalType(str, Enum):
TEXT_SELECT = "text_select"
IMAGE_SELECT = "image_select"
APPROVE = "approve"
REJECT_WITH_REASON = "reject_with_reason"
REGENERATE = "regenerate"
# ── 飞轮信号权重默认值(北哥可校准)─────────────────────
SIGNAL_WEIGHTS: dict[str, int] = {
SignalType.TEXT_SELECT: 3,
SignalType.IMAGE_SELECT: 3,
SignalType.APPROVE: 5,
SignalType.REJECT_WITH_REASON: -3,
SignalType.REGENERATE: -1,
}
# ── 数据归属 ──────────────────────────────────────────
class DataOwnership(str, Enum):
CLIENT_DATA = "client_data" # 原始输入产出,客户可导出
PLATFORM_ASSET = "platform_asset" # 飞轮蒸馏成果,归平台
# ── 交付包状态 ────────────────────────────────────────
class PackageStatus(str, Enum):
PENDING = "pending"
READY = "ready"
DOWNLOADED = "downloaded"
# ── 图片分镜角色G5坑修复对齐 storyboard.py 实际角色名)────
class ImageRole(str, Enum):
# storyboard 实际输出角色名
HOOK = "hook"
PAIN_SCENE = "pain_scene"
PRODUCT_CLOSEUP = "product_closeup"
INGREDIENT = "ingredient"
APPLIED_PROOF = "applied_proof"
TEXTURE = "texture"
SOCIAL_PROOF = "social_proof"
CLOSER = "closer"
SCENARIO = "scenario"
TUTORIAL = "tutorial"
# 旧值保留向后兼容
PAIN = "pain"
PROOF = "proof"
QUALITY = "quality"
CREDIT = "credit"
CONVERT = "convert"
MAIN = "main"
# ── AI 图片提供商 ─────────────────────────────────────
class ImageProvider(str, Enum):
GPT = "gpt"
GEMINI = "gemini"
# ── 产品来源 ──────────────────────────────────────────
class ProductSource(str, Enum):
PRESET = "preset"
CUSTOM = "custom"
# ── 错误码契约§0七类─────────────────────────────────
class ErrorCode:
SUCCESS = 0
PARAM_INVALID = 40001
UNAUTHORIZED = 40101
FORBIDDEN = 40301
NOT_FOUND = 40401
STATE_INVALID = 40901
BUSINESS_ERROR = 42201
SERVER_ERROR = 50001
AI_CALL_FAILED = 50002