feat(short-drama-agent-front): 完善分镜审核与制作准备流程
This commit is contained in:
1 parent
c4b43b9725
commit
1da56e0d46
72 files changed
+2801
-528
No files matched your search
@@ -6,6 +6,8 @@ import { useQuery } from '../../composables/useQuery'
|
||||
import { useProjectContext } from '../projects/context'
|
||||
import { formalBreakdownSnapshot } from '../workflows/selectors'
|
||||
import { getOperation, runOperation } from '../workflows/operations'
|
||||
import { preparationApi } from '../storyboard-preparation/api'
|
||||
import { currentStoryboardApproval } from '../storyboard-preparation/model'
|
||||
import { storyboardApi } from './api'
|
||||
import {
|
||||
currentEpisodeSource,
|
||||
@@ -75,6 +77,12 @@ export function useStoryboard() {
|
||||
return { directions, visualStates }
|
||||
})
|
||||
const data = query.data
|
||||
/** 镜头设计与画面状态的新接口要求当前整体审核,独立读取而不影响只读查看。 */
|
||||
const approval = useQuery(id, (projectId, signal) => projectId ? preparationApi.approval(projectId, signal) : Promise.resolve(null))
|
||||
/** 有效审核必须绑定正式内容;旧记录或未知状态不放行。 */
|
||||
const approved = computed(() => !approval.loading.value && !approval.error.value && currentStoryboardApproval(approval.data.value, id.value))
|
||||
/** 正式修订或审核后随项目数据刷新核对凭据,避免沿用旧权限。 */
|
||||
watch(context.checkpoints, () => { if (approval.data.value || approval.error.value) void approval.refresh() })
|
||||
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||
const session = computed(() => getStoryboardSession(id.value))
|
||||
/** 单集重生成返回的是最新镜头正文,优先于不会随局部覆盖更新的历史 Breakdown 快照。 */
|
||||
@@ -118,14 +126,14 @@ export function useStoryboard() {
|
||||
() =>
|
||||
!!data.value?.directions.shotCount &&
|
||||
data.value.directions.directionCount === data.value.directions.shotCount &&
|
||||
data.value.directions.coverage === 1
|
||||
data.value.directions.coverage === 1 && data.value.directions.staleCount === 0
|
||||
)
|
||||
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||
const visualStateComplete = computed(
|
||||
() =>
|
||||
!!data.value?.visualStates.shotCount &&
|
||||
data.value.visualStates.visualStateCount === data.value.visualStates.shotCount &&
|
||||
data.value.visualStates.coverage === 1
|
||||
data.value.visualStates.coverage === 1 && data.value.visualStates.staleCount === 0
|
||||
)
|
||||
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||
const hasCurrentEpisodeShots = computed(
|
||||
@@ -133,8 +141,8 @@ export function useStoryboard() {
|
||||
)
|
||||
const allowed = computed<Record<StoryboardCommand, boolean>>(() => ({
|
||||
'shots-current': !blocked.value && episodeNo.value > 0 && hasCurrentEpisodeShots.value,
|
||||
'direction-all': !blocked.value && prerequisites.value.directionProject && batchValid.value,
|
||||
'visual-all': !blocked.value && prerequisites.value.visualProject && batchValid.value && repairsValid.value,
|
||||
'direction-all': approved.value && !blocked.value && prerequisites.value.directionProject && batchValid.value,
|
||||
'visual-all': approved.value && !blocked.value && prerequisites.value.visualProject && batchValid.value && repairsValid.value,
|
||||
prompts: !blocked.value && shots.value.length > 0 && batchValid.value
|
||||
}))
|
||||
|
||||
@@ -194,6 +202,7 @@ export function useStoryboard() {
|
||||
const repairs = maxRepairAttempts.value
|
||||
const targetEpisode = episodeNo.value
|
||||
const target = getStoryboardSession(projectId)
|
||||
const expectedApproval = JSON.stringify(approval.data.value?.evidence)
|
||||
const titles: Record<StoryboardCommand, string> = {
|
||||
'shots-current': `第 ${targetEpisode} 集镜头`,
|
||||
'direction-all': '项目导演设计',
|
||||
@@ -202,6 +211,11 @@ export function useStoryboard() {
|
||||
}
|
||||
target.receipt = null
|
||||
await runOperation(projectId, `生成${titles[command]}`, async () => {
|
||||
if (command === 'direction-all' || command === 'visual-all') {
|
||||
const latest = await preparationApi.approval(projectId)
|
||||
if (id.value !== projectId || !currentStoryboardApproval(latest, projectId) || JSON.stringify(latest.evidence) !== expectedApproval)
|
||||
throw new Error('正式分镜审核已变化,请重新进行制作前检查并核对费用。')
|
||||
}
|
||||
if (command === 'shots-current') {
|
||||
const started = await storyboardApi.regenerateEpisodeShots(projectId, targetEpisode)
|
||||
await executions[0]!.observer.track(started.executionId, projectId)
|
||||
@@ -246,6 +260,8 @@ export function useStoryboard() {
|
||||
repairsValid,
|
||||
blocked,
|
||||
directionComplete,
|
||||
approval,
|
||||
approved,
|
||||
visualStateComplete,
|
||||
hasCurrentEpisodeShots,
|
||||
executions,
|
||||
|
||||
Reference in new issue
Block a user