- 删除后端 risk_exceptions 模块(API/Model/Schema/迁移/测试) - 删除后端 metrics 模块(API/测试) - 删除后端 ManualTask 模型和相关 Schema - 修复搜索接口响应缺少 total 字段的问题 - 统一 Platform 枚举(前端去掉后端不支持的 weibo/wechat) - 新增前端注册页面 /register,登录页添加注册链接 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
126 lines
2.8 KiB
TypeScript
126 lines
2.8 KiB
TypeScript
/**
|
||
* 视频审核相关类型定义
|
||
* 与后端 schemas/review.py 对齐
|
||
*/
|
||
|
||
// 审核任务状态(区别于 task.ts 中的 TaskStatus)
|
||
export type ReviewTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'approved' | 'rejected'
|
||
|
||
export type RiskLevel = 'high' | 'medium' | 'low'
|
||
|
||
export type ViolationType =
|
||
| 'forbidden_word'
|
||
| 'efficacy_claim'
|
||
| 'competitor_logo'
|
||
| 'duration_short'
|
||
| 'mention_missing'
|
||
| 'brand_safety'
|
||
|
||
export type ViolationSource = 'text' | 'speech' | 'subtitle' | 'visual'
|
||
|
||
export type SoftRiskAction = 'confirm' | 'note'
|
||
|
||
export type Platform = 'douyin' | 'xiaohongshu' | 'bilibili' | 'kuaishou'
|
||
|
||
// 文本位置(脚本审核)
|
||
export interface Position {
|
||
start: number
|
||
end: number
|
||
}
|
||
|
||
// 违规项(与后端 Violation 对齐)
|
||
export interface Violation {
|
||
type: ViolationType
|
||
content: string
|
||
severity: RiskLevel
|
||
suggestion: string
|
||
// 文本审核字段
|
||
position?: Position | null
|
||
// 视频审核字段
|
||
timestamp?: number | null
|
||
timestamp_end?: number | null
|
||
source?: ViolationSource | null
|
||
}
|
||
|
||
// 软性风控提示(与后端 SoftRiskWarning 对齐)
|
||
export interface SoftRiskWarning {
|
||
code: string
|
||
message: string
|
||
action_required: SoftRiskAction
|
||
blocking: boolean
|
||
context?: Record<string, unknown> | null
|
||
}
|
||
|
||
// 前端内部使用的审核任务状态对象
|
||
export interface ReviewTask {
|
||
review_id: string
|
||
title?: string
|
||
status: ReviewTaskStatus
|
||
progress?: number
|
||
current_step?: string
|
||
score?: number
|
||
summary?: string
|
||
violations?: Violation[]
|
||
soft_warnings?: SoftRiskWarning[]
|
||
created_at: string
|
||
completed_at?: string
|
||
}
|
||
|
||
// ==================== 请求/响应类型 ====================
|
||
|
||
export interface VideoReviewRequest {
|
||
video_url: string
|
||
platform: Platform
|
||
brand_id: string
|
||
creator_id: string
|
||
competitors?: string[]
|
||
requirements?: Record<string, unknown>
|
||
}
|
||
|
||
export interface VideoReviewResponse {
|
||
review_id: string
|
||
status: ReviewTaskStatus
|
||
}
|
||
|
||
export interface ReviewProgressResponse {
|
||
review_id: string
|
||
status: ReviewTaskStatus
|
||
progress: number
|
||
current_step: string
|
||
}
|
||
|
||
export interface ReviewResultResponse {
|
||
review_id: string
|
||
status: ReviewTaskStatus
|
||
score: number
|
||
summary: string
|
||
violations: Violation[]
|
||
soft_warnings: SoftRiskWarning[]
|
||
}
|
||
|
||
// ==================== 脚本预审 ====================
|
||
|
||
export interface SoftRiskContext {
|
||
violation_rate?: number
|
||
violation_threshold?: number
|
||
asr_confidence?: number
|
||
ocr_confidence?: number
|
||
has_history_violation?: boolean
|
||
}
|
||
|
||
export interface ScriptReviewRequest {
|
||
content: string
|
||
platform: Platform
|
||
brand_id: string
|
||
required_points?: string[]
|
||
soft_risk_context?: SoftRiskContext
|
||
}
|
||
|
||
export interface ScriptReviewResponse {
|
||
score: number
|
||
summary: string
|
||
violations: Violation[]
|
||
missing_points?: string[]
|
||
soft_warnings: SoftRiskWarning[]
|
||
}
|