refactor: 清理无用模块、修复前后端对齐、添加注册页面
- 删除后端 risk_exceptions 模块(API/Model/Schema/迁移/测试) - 删除后端 metrics 模块(API/测试) - 删除后端 ManualTask 模型和相关 Schema - 修复搜索接口响应缺少 total 字段的问题 - 统一 Platform 枚举(前端去掉后端不支持的 weibo/wechat) - 新增前端注册页面 /register,登录页添加注册链接 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a32102f583
commit
4a3c7e7923
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* AI 配置类型定义
|
||||
* 与后端 schemas/ai_config.py 对齐
|
||||
*/
|
||||
|
||||
export type AIProvider =
|
||||
| 'oneapi'
|
||||
| 'openrouter'
|
||||
| 'anthropic'
|
||||
| 'openai'
|
||||
| 'deepseek'
|
||||
| 'qwen'
|
||||
| 'doubao'
|
||||
| 'zhipu'
|
||||
| 'moonshot'
|
||||
|
||||
export interface AIModelsConfig {
|
||||
text: string
|
||||
vision: string
|
||||
audio: string
|
||||
}
|
||||
|
||||
export interface AIParametersConfig {
|
||||
temperature: number
|
||||
max_tokens: number
|
||||
}
|
||||
|
||||
// ===== 请求 =====
|
||||
|
||||
export interface AIConfigUpdate {
|
||||
provider: AIProvider
|
||||
base_url: string
|
||||
api_key: string
|
||||
models: AIModelsConfig
|
||||
parameters: AIParametersConfig
|
||||
}
|
||||
|
||||
export interface GetModelsRequest {
|
||||
provider: AIProvider
|
||||
base_url: string
|
||||
api_key: string
|
||||
}
|
||||
|
||||
export interface TestConnectionRequest {
|
||||
provider: AIProvider
|
||||
base_url: string
|
||||
api_key: string
|
||||
models: AIModelsConfig
|
||||
}
|
||||
|
||||
// ===== 响应 =====
|
||||
|
||||
export interface AIConfigResponse {
|
||||
provider: string
|
||||
base_url: string
|
||||
api_key_masked: string
|
||||
models: AIModelsConfig
|
||||
parameters: AIParametersConfig
|
||||
available_models: Record<string, ModelInfo[]>
|
||||
is_configured: boolean
|
||||
last_test_at?: string | null
|
||||
last_test_result?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface ModelInfo {
|
||||
id: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface ModelsListResponse {
|
||||
success: boolean
|
||||
models: Record<string, ModelInfo[]>
|
||||
error?: string | null
|
||||
}
|
||||
|
||||
export interface ModelTestResult {
|
||||
success: boolean
|
||||
latency_ms?: number | null
|
||||
error?: string | null
|
||||
model: string
|
||||
}
|
||||
|
||||
export interface ConnectionTestResponse {
|
||||
success: boolean
|
||||
results: Record<string, ModelTestResult>
|
||||
message: string
|
||||
}
|
||||
+80
-30
@@ -1,75 +1,125 @@
|
||||
/**
|
||||
* 视频审核相关类型定义
|
||||
* 与后端 schemas/review.py 对齐
|
||||
*/
|
||||
|
||||
export type TaskStatus = 'pending' | 'processing' | 'completed' | 'failed'
|
||||
// 审核任务状态(区别于 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 = 'speech' | 'subtitle' | 'visual'
|
||||
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 {
|
||||
id: string
|
||||
type: ViolationType
|
||||
content: string
|
||||
timestamp: number
|
||||
source: ViolationSource
|
||||
riskLevel: RiskLevel
|
||||
severity: RiskLevel
|
||||
suggestion: string
|
||||
// 文本审核字段
|
||||
position?: Position | null
|
||||
// 视频审核字段
|
||||
timestamp?: number | null
|
||||
timestamp_end?: number | null
|
||||
source?: ViolationSource | null
|
||||
}
|
||||
|
||||
export interface SoftWarning {
|
||||
id: string
|
||||
type: string
|
||||
content: string
|
||||
suggestion: string
|
||||
// 软性风控提示(与后端 SoftRiskWarning 对齐)
|
||||
export interface SoftRiskWarning {
|
||||
code: string
|
||||
message: string
|
||||
action_required: SoftRiskAction
|
||||
blocking: boolean
|
||||
context?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
// 前端内部使用的审核任务状态对象
|
||||
export interface ReviewTask {
|
||||
reviewId: string
|
||||
review_id: string
|
||||
title?: string
|
||||
status: TaskStatus
|
||||
status: ReviewTaskStatus
|
||||
progress?: number
|
||||
currentStep?: string
|
||||
current_step?: string
|
||||
score?: number
|
||||
summary?: string
|
||||
violations?: Violation[]
|
||||
softWarnings?: SoftWarning[]
|
||||
createdAt: string
|
||||
completedAt?: string
|
||||
soft_warnings?: SoftRiskWarning[]
|
||||
created_at: string
|
||||
completed_at?: string
|
||||
}
|
||||
|
||||
// ==================== 请求/响应类型 ====================
|
||||
|
||||
export interface VideoReviewRequest {
|
||||
videoUrl?: string
|
||||
platform: string
|
||||
brandId?: string
|
||||
creatorId?: string
|
||||
title?: string
|
||||
video_url: string
|
||||
platform: Platform
|
||||
brand_id: string
|
||||
creator_id: string
|
||||
competitors?: string[]
|
||||
requirements?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface VideoReviewResponse {
|
||||
reviewId: string
|
||||
status: TaskStatus
|
||||
review_id: string
|
||||
status: ReviewTaskStatus
|
||||
}
|
||||
|
||||
export interface ReviewProgressResponse {
|
||||
reviewId: string
|
||||
status: TaskStatus
|
||||
review_id: string
|
||||
status: ReviewTaskStatus
|
||||
progress: number
|
||||
currentStep: string
|
||||
current_step: string
|
||||
}
|
||||
|
||||
export interface ReviewResultResponse {
|
||||
reviewId: string
|
||||
status: TaskStatus
|
||||
review_id: string
|
||||
status: ReviewTaskStatus
|
||||
score: number
|
||||
summary: string
|
||||
violations: Violation[]
|
||||
softWarnings: SoftWarning[]
|
||||
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[]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* 规则管理类型定义
|
||||
* 与后端 api/rules.py 对齐
|
||||
*/
|
||||
|
||||
// ===== 违禁词 =====
|
||||
|
||||
export interface ForbiddenWordCreate {
|
||||
word: string
|
||||
category: string
|
||||
severity: string
|
||||
}
|
||||
|
||||
export interface ForbiddenWordResponse {
|
||||
id: string
|
||||
word: string
|
||||
category: string
|
||||
severity: string
|
||||
}
|
||||
|
||||
export interface ForbiddenWordListResponse {
|
||||
items: ForbiddenWordResponse[]
|
||||
total: number
|
||||
}
|
||||
|
||||
// ===== 白名单 =====
|
||||
|
||||
export interface WhitelistCreate {
|
||||
term: string
|
||||
reason: string
|
||||
brand_id: string
|
||||
}
|
||||
|
||||
export interface WhitelistResponse {
|
||||
id: string
|
||||
term: string
|
||||
reason: string
|
||||
brand_id: string
|
||||
}
|
||||
|
||||
export interface WhitelistListResponse {
|
||||
items: WhitelistResponse[]
|
||||
total: number
|
||||
}
|
||||
|
||||
// ===== 竞品 =====
|
||||
|
||||
export interface CompetitorCreate {
|
||||
name: string
|
||||
brand_id: string
|
||||
logo_url?: string
|
||||
keywords: string[]
|
||||
}
|
||||
|
||||
export interface CompetitorResponse {
|
||||
id: string
|
||||
name: string
|
||||
brand_id: string
|
||||
logo_url?: string | null
|
||||
keywords: string[]
|
||||
}
|
||||
|
||||
export interface CompetitorListResponse {
|
||||
items: CompetitorResponse[]
|
||||
total: number
|
||||
}
|
||||
|
||||
// ===== 平台规则 =====
|
||||
|
||||
export interface PlatformRuleResponse {
|
||||
platform: string
|
||||
rules: Record<string, unknown>[]
|
||||
version: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface PlatformListResponse {
|
||||
items: PlatformRuleResponse[]
|
||||
total: number
|
||||
}
|
||||
|
||||
// ===== 规则冲突检测 =====
|
||||
|
||||
export interface RuleValidateRequest {
|
||||
brand_id: string
|
||||
platform: string
|
||||
brief_rules: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface RuleConflict {
|
||||
brief_rule: string
|
||||
platform_rule: string
|
||||
suggestion: string
|
||||
}
|
||||
|
||||
export interface RuleValidateResponse {
|
||||
conflicts: RuleConflict[]
|
||||
}
|
||||
Reference in New Issue
Block a user