feat(short-drama-agent-front): 同步拆解候选审核与安全提交
This commit is contained in:
1 parent
cc27d463e0
commit
190333d4f9
26 files changed
+1495
-249
No files matched your search
@@ -1,9 +1,37 @@
|
||||
import type { BreakdownState } from './types'
|
||||
import type { CandidateCommitPreview } from './candidate.types'
|
||||
|
||||
/** 安全检查项与用户可理解的阻断原因共用一份映射。 */
|
||||
export const candidateCheckLabels: Record<keyof CandidateCommitPreview['checks'], string> = {
|
||||
episodeNumbersMatch: '剧集范围与候选一致',
|
||||
episodeFingerprintsMatch: '剧本正文版本未变化',
|
||||
noActiveExecutions: '没有正在执行的制作任务',
|
||||
noActiveVideos: '没有正在生成的视频',
|
||||
noSubjectIdentities: '没有需要保护的主体身份',
|
||||
noSubjectImages: '没有需要保护的主体图片',
|
||||
noProtectedShots: '没有需要保护的镜头资产'
|
||||
}
|
||||
/** 必须逐项校验的固定安全门禁,不根据响应动态减少检查项。 */
|
||||
export const candidateCheckKeys = ['episodeNumbersMatch', 'episodeFingerprintsMatch', 'noActiveExecutions', 'noActiveVideos', 'noSubjectIdentities', 'noSubjectImages', 'noProtectedShots'] as const
|
||||
|
||||
/**
|
||||
* 安全预检查必须逐项通过且属于当前项目和候选,不能只相信 ready。
|
||||
* @param preview 安全预检查回执
|
||||
* @param projectId 当前项目
|
||||
* @param checkpointId 当前候选版本
|
||||
* @returns 是否可进入最终确认
|
||||
*/
|
||||
export function candidatePreviewReady(preview: CandidateCommitPreview | null, projectId: string, checkpointId?: string): boolean {
|
||||
if (!preview || preview.projectId !== projectId || preview.checkpointId !== checkpointId) return false
|
||||
// 外部 JSON 的布尔值必须严格为 true,不接受缺失值或字符串等真值。
|
||||
const flags: unknown[] = [preview.readOnly, preview.ready, ...candidateCheckKeys.map(key => preview.checks?.[key])]
|
||||
return flags.every(value => value === true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅用最新原始快照提示提交条件,实际替换权限仍由后端事务判断。
|
||||
* @param state 最新原始拆解快照,禁止传入历史回退拼接结果
|
||||
* @returns 提交前需要处理的问题,空字符串表示可以请求后端提交
|
||||
* @returns 完整性阻断原因,空字符串只表示可继续安全预检查,不是提交许可
|
||||
*/
|
||||
export function candidateCommitIssue(state: BreakdownState | null | undefined): string {
|
||||
if (state?.candidateOnly !== true) return '当前最新结果不是候选模式。'
|
||||
|
||||
Reference in new issue
Block a user