feat(short-drama-agent-front): 新增诊断抽屉并优化项目弹窗
This commit is contained in:
1 parent
97dc784c8b
commit
49ad08a63e
21 files changed
+1479
-363
No files matched your search
@@ -0,0 +1,81 @@
|
||||
import type { LegacyActionDiagnosisResults } from './types'
|
||||
|
||||
/** 诊断及定位共用的镜头坐标。 */
|
||||
export interface DiagnosisLocation {
|
||||
/** 正式剧集编号。 */
|
||||
episodeNo: number
|
||||
/** 集内节拍编号。 */
|
||||
beatNo: number
|
||||
/** 节拍内镜头编号;省略时表示整个节拍。 */
|
||||
shotNo?: number
|
||||
}
|
||||
|
||||
/** 诊断范围按层级约束,避免全项目请求遗留镜头条件。 */
|
||||
export type DiagnosisScope =
|
||||
| { /** 全项目范围。 */ kind: 'project' }
|
||||
| { /** 单集范围。 */ kind: 'episode'; /** 正式集号。 */ episodeNo: number }
|
||||
| ({ /** 单节拍范围。 */ kind: 'beat' } & Omit<DiagnosisLocation, 'shotNo'>)
|
||||
| ({ /** 单镜头范围,必须包含镜头编号。 */ kind: 'shot' } & Required<DiagnosisLocation>)
|
||||
|
||||
/**
|
||||
* 从后端整集或全项目结果中取得当前诊断范围。
|
||||
* @param shots 后端镜头诊断记录
|
||||
* @param scope 当前诊断范围
|
||||
* @returns 当前范围内的镜头记录
|
||||
*/
|
||||
export function scopeDiagnosisShots(shots: LegacyActionDiagnosisResults['shots'], scope: DiagnosisScope) {
|
||||
return shots.filter(
|
||||
shot =>
|
||||
scope.kind === 'project' ||
|
||||
(shot.episodeNo === scope.episodeNo &&
|
||||
(scope.kind === 'episode' ||
|
||||
(shot.beatNo === scope.beatNo && (scope.kind === 'beat' || shot.shotNo === scope.shotNo))))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 按镜头真实诊断状态重新统计,缺少证据不能算作检查通过。
|
||||
* @param shots 当前范围镜头记录
|
||||
* @returns 各状态镜头数量
|
||||
*/
|
||||
export function summarizeDiagnosis(shots: LegacyActionDiagnosisResults['shots']) {
|
||||
const counts = { total: shots.length, conflict: 0, clear: 0, insufficient: 0, invalid: 0, stale: 0, pending: 0 }
|
||||
for (const shot of shots) counts[diagnosisCountKeys[shot.status]]++
|
||||
return counts
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成与已确认范围一致的批量诊断请求。
|
||||
* @param scope 已预览的诊断范围
|
||||
* @param concurrency 模型任务并发数
|
||||
* @returns 后端批量诊断请求参数
|
||||
*/
|
||||
export function diagnosisInput(scope: DiagnosisScope, concurrency: number) {
|
||||
return {
|
||||
confirmed: true as const,
|
||||
concurrency,
|
||||
...(scope.kind !== 'project' ? { episodeNo: scope.episodeNo } : {}),
|
||||
...(scope.kind === 'beat' || scope.kind === 'shot' ? { beatNo: scope.beatNo } : {}),
|
||||
...(scope.kind === 'shot' ? { shotNo: scope.shotNo } : {})
|
||||
}
|
||||
}
|
||||
|
||||
/** 后端诊断状态对应的统计字段。 */
|
||||
const diagnosisCountKeys = {
|
||||
conflict_found: 'conflict',
|
||||
no_conflict_found: 'clear',
|
||||
insufficient_evidence: 'insufficient',
|
||||
invalid_evidence: 'invalid',
|
||||
stale: 'stale',
|
||||
not_diagnosed: 'pending'
|
||||
} as const
|
||||
|
||||
/** 状态始终保留文字,避免仅通过颜色区分问题。 */
|
||||
export const diagnosisStatusLabels = {
|
||||
conflict_found: '手部冲突',
|
||||
no_conflict_found: '未发现冲突',
|
||||
insufficient_evidence: '证据不足',
|
||||
invalid_evidence: '证据无效',
|
||||
stale: '诊断过期',
|
||||
not_diagnosed: '尚未诊断'
|
||||
} as const
|
||||
Reference in new issue
Block a user