feat(short-drama-agent-front): 接入摄影审核与首帧制作
This commit is contained in:
1 parent
3503926d62
commit
751106985e
32 files changed
+1970
-153
No files matched your search
@@ -161,7 +161,7 @@ export const productionApi = {
|
||||
/** 按本次请求选择的图片模型与参数预览最终输入,不创建首帧任务。 */
|
||||
previewKeyframe: (
|
||||
shotId: string,
|
||||
input: Pick<GenerateKeyframeInput, 'provider' | 'generationOptions'>,
|
||||
input: Pick<GenerateKeyframeInput, 'provider' | 'generationOptions' | 'width' | 'height'>,
|
||||
signal?: AbortSignal
|
||||
) =>
|
||||
request<KeyframeGenerationPreview>(`${shotPath(shotId)}/keyframe/preview`, {
|
||||
|
||||
@@ -3,7 +3,8 @@ import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
|
||||
import IssueHint from '../../../components/ui/IssueHint.vue'
|
||||
import { productionMessage } from '../production-messages'
|
||||
import { computed } from 'vue'
|
||||
import { useKeyframeVision } from '../keyframe-vision'
|
||||
import { computed, watch } from 'vue'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { qualityApi } from '../quality-api'
|
||||
import { NButton, NTag } from 'naive-ui'
|
||||
@@ -29,7 +30,29 @@ const props = defineProps<{
|
||||
confirming: boolean
|
||||
}>()
|
||||
/** 用户显式触发候选审核、确认或免费恢复。 */
|
||||
const emit = defineEmits<{ recover: []; quality: []; edit: []; select: []; confirm: []; cancel: []; history: [] }>()
|
||||
const emit = defineEmits<{
|
||||
recover: []
|
||||
quality: []
|
||||
edit: []
|
||||
select: []
|
||||
confirm: []
|
||||
cancel: []
|
||||
history: []
|
||||
settled: []
|
||||
}>()
|
||||
/** 每张可见候选可独立找回自己的审核任务。 */
|
||||
const visionKey = computed(() =>
|
||||
props.item.status === 'completed' ? JSON.stringify([props.shotId, props.item.id]) : ''
|
||||
)
|
||||
const vision = useKeyframeVision(visionKey)
|
||||
watch(
|
||||
() => vision.state.value.active,
|
||||
(active, previous) => {
|
||||
if (previous && !active && visionKey.value) emit('settled')
|
||||
}
|
||||
)
|
||||
/** 画幅不符的历史图保留浏览和只读审核记录。 */
|
||||
const wrongCanvas = computed(() => props.item.canvasDiagnosis?.status === 'mismatch')
|
||||
/** 质量状态以数据库为准;会话内检查仅在历史状态未知时兜底。 */
|
||||
const reviewKey = computed(() =>
|
||||
props.item.status === 'completed' ? JSON.stringify([props.shotId, props.item.id, props.reviewRevision ?? 0]) : ''
|
||||
@@ -51,11 +74,11 @@ const reviewLabels: Record<string, string> = {
|
||||
const isPassed = computed(
|
||||
() =>
|
||||
!props.stale &&
|
||||
!wrongCanvas.value &&
|
||||
props.item.inputSnapshotStatus !== 'invalid' &&
|
||||
(effectiveStatus.value === 'passed' ||
|
||||
effectiveStatus.value === 'manual_accepted' ||
|
||||
(effectiveStatus.value === 'unknown' && props.validationPassed === true))
|
||||
(effectiveStatus.value === 'passed' || effectiveStatus.value === 'manual_accepted')
|
||||
)
|
||||
/** 晋升入口只接受持久化通过和已结算审核。 */
|
||||
const canSelect = computed(
|
||||
() =>
|
||||
props.item.status === 'completed' &&
|
||||
@@ -64,7 +87,10 @@ const canSelect = computed(
|
||||
!props.item.isPrimary &&
|
||||
!props.stale &&
|
||||
props.item.inputSnapshotStatus !== 'invalid' &&
|
||||
isPassed.value
|
||||
isPassed.value &&
|
||||
!reviewQuery.error.value &&
|
||||
!vision.blocked.value &&
|
||||
!vision.state.value.resumable
|
||||
)
|
||||
</script>
|
||||
|
||||
@@ -120,6 +146,30 @@ const canSelect = computed(
|
||||
>{{ item.width }} × {{ item.height }}</span
|
||||
>
|
||||
</div>
|
||||
<!-- 以下是候选的来源、画幅与后台审核状态 -->
|
||||
<p v-if="item.provider || item.model" class="mt-2 wrap-anywhere text-xs text-muted">
|
||||
{{ [item.provider, item.model].filter(Boolean).join(' / ') }}
|
||||
</p>
|
||||
<p
|
||||
v-if="item.canvasDiagnosis && item.status === 'completed'"
|
||||
class="mt-2 text-xs"
|
||||
:class="wrongCanvas ? 'text-danger' : 'text-muted'"
|
||||
>
|
||||
{{
|
||||
wrongCanvas
|
||||
? `历史画幅 ${item.canvasDiagnosis.actual ?? '未知'} 与交付画幅 ${item.canvasDiagnosis.expected ?? '未知'} 不符,仅供查看。`
|
||||
: item.canvasDiagnosis.status === 'matched'
|
||||
? `匹配交付画幅 ${item.canvasDiagnosis.expected}`
|
||||
: '画幅尚未确认'
|
||||
}}
|
||||
</p>
|
||||
<p
|
||||
v-if="vision.state.value.active || vision.state.value.unknown || vision.uncertain.value"
|
||||
role="status"
|
||||
class="mt-2 text-xs text-muted"
|
||||
>
|
||||
{{ vision.state.value.active?.executionId ? '质量审核在后台进行' : '审核结果或费用待核查' }}
|
||||
</p>
|
||||
<IssueHint v-if="item.error" :messages="[productionMessage(item.error)]" type="error" />
|
||||
<!-- 以下是来源记录与独立的免费恢复入口 -->
|
||||
<p v-if="item.inputSnapshotStatus" class="mt-2 text-xs text-muted">
|
||||
@@ -153,11 +203,15 @@ const canSelect = computed(
|
||||
>
|
||||
<p class="mt-2 text-[10px] text-muted">{{ formatDate(item.createdAt) }}</p>
|
||||
<div v-if="item.status === 'completed' && item.imageUrl" class="mt-2 flex flex-wrap items-center gap-3">
|
||||
<NButton text size="small" @click="emit('quality')">
|
||||
{{ validationPassed === null ? '质量检查' : '重新检查' }}
|
||||
<NButton v-if="!wrongCanvas && !stale" text size="small" @click="emit('quality')">
|
||||
{{
|
||||
vision.state.value.active || vision.state.value.unknown || vision.uncertain.value
|
||||
? '查看审核进度'
|
||||
: '质量检查'
|
||||
}}
|
||||
</NButton>
|
||||
<NButton
|
||||
v-if="item.source !== 'provider_variant'"
|
||||
v-if="item.source !== 'provider_variant' && !wrongCanvas && !stale"
|
||||
text
|
||||
size="small"
|
||||
:disabled="blocked"
|
||||
@@ -172,10 +226,10 @@ const canSelect = computed(
|
||||
设为主首帧
|
||||
</NButton>
|
||||
</div>
|
||||
<ContextNotice v-if="confirming" type="info" :show-icon="false" class="mt-2 text-xs">
|
||||
<ContextNotice v-if="confirming && canSelect" type="info" :show-icon="false" class="mt-2 text-xs">
|
||||
<p>该候选已满足当前质量要求。确认让后续视频使用此首帧?</p>
|
||||
<div class="mt-2 flex gap-3">
|
||||
<NButton type="primary" @click="emit('confirm')">确认切换</NButton>
|
||||
<NButton type="primary" :disabled="blocked" @click="emit('confirm')">确认切换</NButton>
|
||||
<NButton text size="small" @click="emit('cancel')">取消</NButton>
|
||||
</div>
|
||||
</ContextNotice>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { userFacingText } from '../../../lib/user-facing-text'
|
||||
import KeyframePreviewChecks from './KeyframePreviewChecks.vue'
|
||||
import ImageGenerationPreview from '../../subject-images/components/ImageGenerationPreview.vue'
|
||||
import { useImageGenerationPreview, type ImageGenerationSubmission } from '../../subject-images/generation-preview'
|
||||
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
|
||||
import AppForm from '../../../components/ui/AppForm.vue'
|
||||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NTag } from 'naive-ui'
|
||||
import { NButton, NCheckbox, NCollapse, NCollapseItem } from 'naive-ui'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { generationConfigApi } from '../../generation-config/api'
|
||||
import type {
|
||||
@@ -20,7 +20,7 @@ import { errorMessage } from '../../../lib/http'
|
||||
import { productionApi } from '../api'
|
||||
import { directionLabel } from '../../storyboard/model'
|
||||
import type { ShotDirection, ShotVisualState } from '../../storyboard/types'
|
||||
import type { GenerateKeyframeInput } from '../types'
|
||||
import type { GenerateKeyframeInput, KeyframeGenerationPreview } from '../types'
|
||||
|
||||
/** 单镜头首帧表单;所有新图先生成候选,通过质量检查后再人工晋升。 */
|
||||
const props = defineProps<{
|
||||
@@ -38,6 +38,9 @@ const props = defineProps<{
|
||||
/** 仅发送已经确认的当前快照。 */
|
||||
submitGeneration: (input: GenerateKeyframeInput) => Promise<ImageGenerationSubmission>
|
||||
}>()
|
||||
/** 只读提供当次正式预览,候选必须匹配输入指纹才能展示。 */
|
||||
const emit = defineEmits<{ previewed: [preview: KeyframeGenerationPreview] }>()
|
||||
/** 当前候选生成窗口。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 生成参数表单,用于复用字段校验。 */
|
||||
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||||
@@ -71,7 +74,7 @@ const {
|
||||
recoveryNotice,
|
||||
canSubmit,
|
||||
loadPreview,
|
||||
submit
|
||||
submit: submitPreview
|
||||
} = useImageGenerationPreview({
|
||||
open,
|
||||
recoveryTarget: () => (props.shotId ? 'keyframe:' + props.shotId : ''),
|
||||
@@ -83,11 +86,18 @@ const {
|
||||
const shotId = props.shotId
|
||||
const result = await productionApi.previewKeyframe(shotId, input, signal)
|
||||
if (result?.shotId !== shotId) throw new Error('预览结果与当前镜头不匹配。')
|
||||
if (!signal.aborted && shotId === props.shotId) emit('previewed', result)
|
||||
return result
|
||||
},
|
||||
generate: input => props.submitGeneration({ ...input, setPrimary: false })
|
||||
})
|
||||
|
||||
/** 正式预览返回连续性阻断时,键盘和底栏提交均不可继续。 */
|
||||
async function submit() {
|
||||
if (preview.value?.specConsistencySummary?.blocking) return
|
||||
await submitPreview()
|
||||
}
|
||||
|
||||
/** 切换镜头或重新打开时只读取模型配置,忽略已关闭弹窗的结果。 */
|
||||
watch(
|
||||
[() => props.shotId, () => props.projectId, open],
|
||||
@@ -149,7 +159,7 @@ watch(
|
||||
:provider="imageProvider"
|
||||
:options="imageGenerationOptions"
|
||||
:aspect-ratio="projectAspectRatio"
|
||||
:disabled="disabled || submitting"
|
||||
:disabled="submitting"
|
||||
@update:provider="imageProvider = $event"
|
||||
@update:options="imageGenerationOptions = $event"
|
||||
/>
|
||||
@@ -203,55 +213,23 @@ watch(
|
||||
:stale-notice="staleNotice || recoveryNotice"
|
||||
@load="loadPreview"
|
||||
/>
|
||||
<div v-if="preview" class="mt-3 text-xs leading-6">
|
||||
<!-- 规格审计仅提示导演约束风险,不阻止首帧生成。 -->
|
||||
<section
|
||||
v-if="preview.specConsistencySummary"
|
||||
class="mt-3 bg-muted/10 p-3"
|
||||
aria-label="生成规格一致性检查"
|
||||
>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<strong>生成规格检查</strong>
|
||||
<NTag
|
||||
size="small"
|
||||
:bordered="false"
|
||||
:type="preview.specConsistencySummary?.hasWarnings ? 'warning' : 'success'"
|
||||
>
|
||||
{{
|
||||
preview.specConsistencySummary?.hasWarnings
|
||||
? `发现 ${preview.specConsistencySummary.warningCount} 项预警`
|
||||
: '检查通过'
|
||||
}}
|
||||
</NTag>
|
||||
<span class="text-muted">仅提示,不阻止生成</span>
|
||||
</div>
|
||||
<NCollapse v-if="preview.specConsistencyIssues?.length" class="mt-2">
|
||||
<NCollapseItem name="issues" title="查看规格预警与处理建议">
|
||||
<div
|
||||
v-for="(issue, index) in preview.specConsistencyIssues"
|
||||
:key="`${issue.code}:${issue.subjectRef ?? index}`"
|
||||
class="mt-3 bg-muted/10 p-3"
|
||||
>
|
||||
<p class="font-medium">{{ userFacingText(issue.message) }}</p>
|
||||
<p v-if="issue.subjectRef" class="mt-1 text-muted">主体:{{ issue.subjectRef }}</p>
|
||||
<p class="mt-1 text-muted">涉及字段:{{ issue.fieldPaths.join('、') }}</p>
|
||||
<p class="mt-1">建议:{{ issue.suggestion }}</p>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</section>
|
||||
</div>
|
||||
<!-- 以下是正式画幅、尺寸及连续性诊断 -->
|
||||
<KeyframePreviewChecks v-if="preview" :preview="preview" class="mt-3" />
|
||||
<NCheckbox
|
||||
id="confirm-keyframe-cost"
|
||||
v-model:checked="acknowledged"
|
||||
:disabled="!preview || submitting || !!recoveryNotice"
|
||||
:disabled="!preview || preview.specConsistencySummary?.blocking || submitting || !!recoveryNotice"
|
||||
class="mt-5 flex items-start gap-3 text-sm leading-6"
|
||||
>我已核对实际输入,并确认本次图片生成可能产生费用。
|
||||
</NCheckbox>
|
||||
</AppForm>
|
||||
<template #footer>
|
||||
<NButton :disabled="submitting" @click="open = false">取消</NButton>
|
||||
<NButton :disabled="!canSubmit" :loading="submitting" @click="formRef?.validate(submit)" type="primary"
|
||||
<NButton
|
||||
:disabled="!canSubmit || preview?.specConsistencySummary?.blocking"
|
||||
:loading="submitting"
|
||||
@click="formRef?.validate(submit)"
|
||||
type="primary"
|
||||
>确认生成首帧</NButton
|
||||
>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { NCollapse, NCollapseItem, NTag } from 'naive-ui'
|
||||
import { userFacingText } from '../../../lib/user-facing-text'
|
||||
import type { KeyframeGenerationPreview } from '../types'
|
||||
|
||||
/** 只展示服务端返回的画幅、尺寸和一致性门禁。 */
|
||||
const props = defineProps<{
|
||||
/** 草案和正式预览共用的检查字段。 */
|
||||
preview: Pick<
|
||||
KeyframeGenerationPreview,
|
||||
'deliveryCanvas' | 'generationConfig' | 'continuity' | 'specConsistencySummary' | 'specConsistencyIssues'
|
||||
>
|
||||
}>()
|
||||
/** 实际使用的模型尺寸来自本次服务端配置。 */
|
||||
const size = computed(() => {
|
||||
const options = props.preview.generationConfig.options
|
||||
return options && typeof options === 'object' && 'size' in options && typeof options.size === 'string'
|
||||
? options.size
|
||||
: ''
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是交付画幅与本次实际模型尺寸 -->
|
||||
<section class="space-y-2 text-xs leading-6" aria-label="首帧画幅与连续性">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<NTag v-if="preview.deliveryCanvas" size="small" :bordered="false"
|
||||
>交付画幅 {{ preview.deliveryCanvas }}</NTag
|
||||
>
|
||||
<NTag v-if="size" size="small" :bordered="false">实际尺寸 {{ size }}</NTag>
|
||||
<NTag v-if="preview.specConsistencySummary?.blocking" type="warning" size="small" :bordered="false"
|
||||
>连续性待确认 · 暂不能生成</NTag
|
||||
>
|
||||
</div>
|
||||
<!-- 以下是具体待确认主体与规格检查问题 -->
|
||||
<ul v-if="preview.continuity?.reviewIssues.length" class="text-muted">
|
||||
<li v-for="issue in preview.continuity.reviewIssues" :key="issue.subjectRef + issue.code">
|
||||
{{ issue.subjectRef }}:{{
|
||||
issue.code === 'scene_state_transition_unconfirmed'
|
||||
? '场景即时状态衔接待确认'
|
||||
: '角色形态变化待确认'
|
||||
}}
|
||||
</li>
|
||||
</ul>
|
||||
<NCollapse v-if="preview.specConsistencyIssues?.length">
|
||||
<NCollapseItem
|
||||
name="spec-issues"
|
||||
:title="`生成规格提示(${preview.specConsistencySummary?.warningCount ?? preview.specConsistencyIssues.length})`"
|
||||
>
|
||||
<ul class="space-y-2">
|
||||
<li v-for="(issue, index) in preview.specConsistencyIssues" :key="index">
|
||||
{{ issue.subjectRef }} {{ userFacingText(issue.message) }}
|
||||
{{ userFacingText(issue.suggestion) }}
|
||||
</li>
|
||||
</ul>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</section>
|
||||
</template>
|
||||
@@ -4,12 +4,13 @@ import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
|
||||
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { NButton, NCollapse, NCollapseItem, NInput } from 'naive-ui'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { formatDate } from '../../../lib/format'
|
||||
import { useKeyframeVision } from '../keyframe-vision'
|
||||
import { qualityApi } from '../quality-api'
|
||||
import { parseKeyframeValidationOutput } from '../quality'
|
||||
|
||||
@@ -26,6 +27,7 @@ const props = defineProps<{
|
||||
/** 在独立弹窗内直接展示内容,并隐藏内部标题、说明与操作栏。 */
|
||||
initialOpen?: boolean
|
||||
}>()
|
||||
/** 通知候选重新读取当前质量状态。 */
|
||||
const emit = defineEmits<{ reviewed: [] }>()
|
||||
/** 普通入口展开后查询,独立弹窗打开时直接查询。 */
|
||||
const open = ref(props.initialOpen ?? false)
|
||||
@@ -35,13 +37,32 @@ const key = computed(() =>
|
||||
? JSON.stringify([props.projectId, props.shotId, props.keyframeId])
|
||||
: ''
|
||||
)
|
||||
/** 后端历史查询支持取消,空目标不请求。 */
|
||||
const query = useQuery(key, (value, signal) => {
|
||||
if (!value) return Promise.resolve([])
|
||||
const [, shotId, keyframeId] = JSON.parse(value) as [string | undefined, string, string]
|
||||
return qualityApi.keyframeHistory(shotId, keyframeId, signal)
|
||||
})
|
||||
/** 仅真实结构化结论可以显示通过,调用完成不等于视觉通过。 */
|
||||
/** 独立打开历史后恢复后台观察。 */
|
||||
const visionKey = computed(() => (key.value ? JSON.stringify([props.shotId, props.keyframeId]) : ''))
|
||||
const { history: query, execution, state, uncertain } = useKeyframeVision(visionKey)
|
||||
/** 后台结束时同步刷新人工复核与候选状态。 */
|
||||
watch(
|
||||
() => state.value.active,
|
||||
(active, previous) => {
|
||||
if (previous && !active && key.value) {
|
||||
void reviewQuery.refresh()
|
||||
emit('reviewed')
|
||||
}
|
||||
}
|
||||
)
|
||||
/** 公开步骤状态的中文名称。 */
|
||||
const stepLabels: Record<string, string> = {
|
||||
pending: '等待',
|
||||
running: '执行中',
|
||||
received: '已收到回执',
|
||||
completed: '完成',
|
||||
failed: '失败',
|
||||
needs_review: '需要人工核查'
|
||||
}
|
||||
/** 不显示内部模型名称作为审核步骤。 */
|
||||
const stepNames = { general: '通用画面', physical: '物理关系', gaze: '视线' }
|
||||
/** 仅显示公开词元计量。 */
|
||||
const usageLabels = { inputTokens: '输入', outputTokens: '输出', totalTokens: '合计', reasoningTokens: '推理' }
|
||||
/** 复核证据仅在展开历史时读取,不触发 Vision 或写入审核结论。 */
|
||||
const reviewQuery = useQuery(key, (value, signal) => {
|
||||
if (!value) return Promise.resolve(null)
|
||||
@@ -72,7 +93,10 @@ async function submitReview() {
|
||||
!reviewReason.value.trim() ||
|
||||
!reviewer.value.trim() ||
|
||||
submitting.value ||
|
||||
props.disabled
|
||||
props.disabled ||
|
||||
state.value.active ||
|
||||
state.value.unknown ||
|
||||
uncertain.value
|
||||
)
|
||||
return
|
||||
submitting.value = true
|
||||
@@ -158,10 +182,16 @@ const records = computed(() =>
|
||||
<p class="font-semibold">人工复核</p>
|
||||
<p class="mt-2 text-muted">请先预览候选图片并确认视觉效果。接受会替换当前主首帧,拒绝只保存审核记录。</p>
|
||||
<div class="mt-3 flex flex-wrap gap-2">
|
||||
<NButton size="small" :disabled="disabled || submitting" @click="reviewAction = 'accepted'"
|
||||
<NButton
|
||||
size="small"
|
||||
:disabled="disabled || submitting || !!state.active || !!state.unknown || uncertain"
|
||||
@click="reviewAction = 'accepted'"
|
||||
>人工接受</NButton
|
||||
>
|
||||
<NButton size="small" :disabled="disabled || submitting" @click="reviewAction = 'rejected'"
|
||||
<NButton
|
||||
size="small"
|
||||
:disabled="disabled || submitting || !!state.active || !!state.unknown || uncertain"
|
||||
@click="reviewAction = 'rejected'"
|
||||
>人工拒绝</NButton
|
||||
>
|
||||
</div>
|
||||
@@ -198,11 +228,24 @@ const records = computed(() =>
|
||||
submitSuccess
|
||||
}}</ContextNotice>
|
||||
<p v-if="reviewQuery.error.value" class="text-danger">{{ reviewQuery.error.value }}</p>
|
||||
<!-- 以下是当前审核任务和费用核查状态 -->
|
||||
<p
|
||||
v-if="state.unknown || uncertain || (state.active && !state.active.executionId)"
|
||||
role="status"
|
||||
class="text-sm text-muted"
|
||||
>
|
||||
审核结果或费用待核查,请勿重复提交。
|
||||
</p>
|
||||
<p v-else-if="state.active" role="status" class="text-sm text-muted">
|
||||
审核{{ execution.data.value?.status === 'pending' ? '等待开始' : '在后台进行' }},关闭页面后仍会保存记录。
|
||||
</p>
|
||||
<p v-else-if="state.resumable" class="text-sm text-muted">可在质量检查中使用原参数继续;已保存的步骤会复用。</p>
|
||||
<p v-if="!records.length" class="text-muted">暂无校验记录。</p>
|
||||
<!-- 以下是实际校验结论、问题与调用错误模块 -->
|
||||
<article v-for="record in records" :key="record.id" class="panel mt-3 p-3">
|
||||
<p>
|
||||
{{ formatDate(record.finishedAt || record.startedAt || record.createdAt) }} · {{ record.status }} ·
|
||||
{{ formatDate(record.finishedAt || record.startedAt || record.createdAt) }} ·
|
||||
{{ stepLabels[record.status] ?? '待确认' }} ·
|
||||
{{
|
||||
record.status === 'completed' && record.validation
|
||||
? record.validation.passed
|
||||
@@ -218,10 +261,24 @@ const records = computed(() =>
|
||||
{{ userFacingText(issue.description) }}
|
||||
</p>
|
||||
</template>
|
||||
<!-- 以下是原始校验结果的 Naive 折叠模块 -->
|
||||
<NCollapse class="mt-2 text-muted">
|
||||
<NCollapseItem name="raw-record" title="原始记录">
|
||||
<pre class="whitespace-pre-wrap wrap-anywhere">{{ JSON.stringify(record.output, null, 2) }}</pre>
|
||||
<!-- 以下是公开步骤进度和计量,不展示模型回执 -->
|
||||
<NCollapse v-if="record.steps?.length" class="mt-2">
|
||||
<NCollapseItem
|
||||
v-for="step in record.steps"
|
||||
:key="step.name"
|
||||
:name="step.name"
|
||||
:title="`${stepNames[step.name]} · ${stepLabels[step.status]}`"
|
||||
>
|
||||
<dl class="grid gap-1 wrap-anywhere text-xs text-muted">
|
||||
<div v-if="step.startedAt">开始:{{ formatDate(step.startedAt) }}</div>
|
||||
<div v-if="step.finishedAt">完成:{{ formatDate(step.finishedAt) }}</div>
|
||||
<div v-if="step.requestId">请求编号:{{ step.requestId }}</div>
|
||||
<div v-if="step.providerRequestId">模型服务请求编号:{{ step.providerRequestId }}</div>
|
||||
<div v-for="(count, unit) in step.usage" :key="unit">
|
||||
{{ usageLabels[unit] }}词元:{{ count }}
|
||||
</div>
|
||||
</dl>
|
||||
<p v-if="step.error" class="mt-2 text-danger">{{ userFacingText(step.error) }}</p>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</article>
|
||||
|
||||
@@ -11,6 +11,7 @@ import { integerRule, sizeRules } from '../../../lib/form-rules'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NInputNumber, NRadioButton, NRadioGroup } from 'naive-ui'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import { useKeyframeVision } from '../keyframe-vision'
|
||||
import { allowedTextLines, validQualityInput } from '../quality'
|
||||
import type { QualityAction, QualityInput, QualityTarget } from '../quality.types'
|
||||
import { useQuality } from '../useQuality'
|
||||
@@ -51,6 +52,13 @@ const { key, session, operation, execution, blocked, run } = useQuality(
|
||||
},
|
||||
id => emit('started', id)
|
||||
)
|
||||
/** 打开首帧质量弹窗时读取正式审核状态。 */
|
||||
const visionKey = computed(() =>
|
||||
open.value && props.target?.kind === 'keyframe' ? JSON.stringify([props.target.shotId, props.target.assetId]) : ''
|
||||
)
|
||||
const vision = useKeyframeVision(visionKey)
|
||||
/** 有原参数时继续;没有原参数时保留只读核查。 */
|
||||
const visionBlocked = computed(() => !!visionKey.value && vision.blocked.value)
|
||||
/** 质量弹窗重新读取所选候选自身的权限,不以会话历史代替后端事实。 */
|
||||
const videoKey = computed(() =>
|
||||
open.value && props.target?.kind === 'video' ? JSON.stringify([props.target.shotId, props.target.assetId]) : ''
|
||||
@@ -135,7 +143,7 @@ const input = computed<QualityInput>(() => ({
|
||||
maxRepairAttempts: action.value === 'validate' ? 0 : (attempts.value ?? -1),
|
||||
force: force.value,
|
||||
episodeNo: props.target?.kind === 'batch' ? props.target.episodeNo : 1,
|
||||
allowedTexts: allowedTextLines(texts.value),
|
||||
allowedTexts: vision.resumeTexts.value ?? allowedTextLines(texts.value),
|
||||
...(action.value === 'validate' || width.value === null ? {} : { width: width.value }),
|
||||
...(action.value === 'validate' || height.value === null ? {} : { height: height.value })
|
||||
}))
|
||||
@@ -229,7 +237,15 @@ watch(
|
||||
)
|
||||
/** 付费入口保留明确确认,不因菜单选择或查看历史自动提交。 */
|
||||
async function submit() {
|
||||
if (!acknowledged.value || !valid.value || blocked.value || !repairAvailable.value) return
|
||||
if (
|
||||
!acknowledged.value ||
|
||||
!valid.value ||
|
||||
blocked.value ||
|
||||
visionBlocked.value ||
|
||||
!repairAvailable.value ||
|
||||
(!!vision.resumeTexts.value && action.value !== 'validate')
|
||||
)
|
||||
return
|
||||
acknowledged.value = false
|
||||
await run(action.value, input.value)
|
||||
}
|
||||
@@ -358,8 +374,9 @@ const optionsExpanded = ref<string[]>(['options'])
|
||||
</div>
|
||||
<NFormItem class="mt-4 block" path="texts" label="额外允许的画面文字(一行一项,可留空)"
|
||||
><NInput
|
||||
v-model:value="texts"
|
||||
:disabled="pending"
|
||||
:value="vision.resumeTexts.value?.join('\n') ?? texts"
|
||||
@update:value="texts = $event"
|
||||
:disabled="pending || !!vision.resumeTexts.value"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 5 }"
|
||||
:input-props="{ 'aria-label': '额外允许的画面文字' }"
|
||||
@@ -427,11 +444,18 @@ const optionsExpanded = ref<string[]>(['options'])
|
||||
@refresh="execution.query.refresh"
|
||||
@dismiss="execution.dismiss"
|
||||
/>
|
||||
<p v-if="vision.state.value.resumable && !vision.resumeTexts.value" class="mt-3 text-xs text-muted">
|
||||
此窗口没有原审核参数,暂不能安全继续。
|
||||
</p>
|
||||
<KeyframeValidationHistory
|
||||
v-if="target?.kind === 'keyframe'"
|
||||
v-if="open && target?.kind === 'keyframe'"
|
||||
:project-id="projectId"
|
||||
:shot-id="target.shotId"
|
||||
:key="target.assetId"
|
||||
:keyframe-id="target.assetId"
|
||||
:disabled="disabled || pending"
|
||||
initial-open
|
||||
@reviewed="emit('changed')"
|
||||
/>
|
||||
<QualityResult v-if="session.receipt" :receipt="session.receipt" @locate="emit('locate', $event)" />
|
||||
<NCollapse v-else-if="saved" class="mt-4" :default-expanded-names="['saved']"
|
||||
@@ -457,9 +481,15 @@ const optionsExpanded = ref<string[]>(['options'])
|
||||
<NButton
|
||||
type="primary"
|
||||
:loading="pending"
|
||||
:disabled="blocked || !acknowledged || !repairAvailable"
|
||||
:disabled="
|
||||
blocked ||
|
||||
visionBlocked ||
|
||||
!acknowledged ||
|
||||
!repairAvailable ||
|
||||
(!!vision.resumeTexts.value && action !== 'validate')
|
||||
"
|
||||
@click="formRef?.validate(submit)"
|
||||
>{{ label }}</NButton
|
||||
>{{ vision.resumeTexts.value && action === 'validate' ? '继续原审核' : label }}</NButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,6 +28,7 @@ import type {
|
||||
GenerateKeyframeInput,
|
||||
KeyframeReadinessItem,
|
||||
KeyframeSpec,
|
||||
KeyframeGenerationPreview,
|
||||
PromptReadinessItem,
|
||||
VideoGenerationSpec,
|
||||
VideoReadinessItem
|
||||
@@ -47,6 +48,8 @@ import KeyframeValidationHistory from './KeyframeValidationHistory.vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import ModelCapabilities from './ModelCapabilities.vue'
|
||||
import type { QualityTarget } from '../quality.types'
|
||||
import ImageGenerationPreview from '../../subject-images/components/ImageGenerationPreview.vue'
|
||||
import { visionState } from '../keyframe-vision'
|
||||
import { clearVideoConflict, clearVideoQualification, sessionKeyframePassed, sessionVideoValidation } from '../quality'
|
||||
import { useProjectGenerationRevision } from '../../generation-config/context'
|
||||
import { generationConfigApi } from '../../generation-config/api'
|
||||
@@ -98,6 +101,8 @@ const props = defineProps<{
|
||||
keyframeReadiness?: KeyframeReadinessItem
|
||||
/** 视频就绪项。 */
|
||||
videoReadiness?: VideoReadinessItem
|
||||
/** 分镜工作台只展示单镜头首帧,不进入项目级制作。 */
|
||||
keyframeOnly?: boolean
|
||||
/** 是否从深链接打开首帧生成。 */
|
||||
openKeyframe?: boolean
|
||||
/** 页面上游状态是否阻断操作。 */
|
||||
@@ -136,6 +141,18 @@ const assetPollInterval = computed(() => {
|
||||
query = usePolling(
|
||||
key,
|
||||
async (shotId, signal) => {
|
||||
if (props.keyframeOnly) {
|
||||
const keyframes = await productionApi.listKeyframes(shotId, signal)
|
||||
if (keyframes.some(item => item.shotId !== shotId)) throw new Error('候选与当前镜头不匹配。')
|
||||
return {
|
||||
keyframes,
|
||||
videos: [],
|
||||
qualityStatus: null,
|
||||
qualityStatusError: '',
|
||||
inputPlan: null,
|
||||
inputPlanError: ''
|
||||
}
|
||||
}
|
||||
const [keyframes, videos, qualityState, inputPlanState] = await Promise.all([
|
||||
productionApi.listKeyframes(shotId, signal),
|
||||
productionApi.listVideos(shotId, signal),
|
||||
@@ -164,10 +181,19 @@ query = usePolling(
|
||||
assetPollInterval
|
||||
)
|
||||
/** 单独读取已保存的提示词,查询失败不影响首帧和视频资产展示。 */
|
||||
const promptQuery = usePolling(key, (shotId, signal) => storyboardApi.videoPrompt(shotId, signal), false)
|
||||
const promptQuery = usePolling(
|
||||
key,
|
||||
(shotId, signal) => (props.keyframeOnly ? Promise.resolve(null) : storyboardApi.videoPrompt(shotId, signal)),
|
||||
false
|
||||
)
|
||||
const savedPrompt = computed(() => (promptQuery.data.value?.shotId === key.value ? promptQuery.data.value : null))
|
||||
/** 当前视频生成规格的首帧和主体参考图,独立查询避免影响资产列表。 */
|
||||
const videoInputQuery = usePolling(key, (shotId, signal) => productionApi.videoGenerationSpec(shotId, signal), false)
|
||||
const videoInputQuery = usePolling(
|
||||
key,
|
||||
(shotId, signal) =>
|
||||
props.keyframeOnly ? Promise.resolve(null) : productionApi.videoGenerationSpec(shotId, signal),
|
||||
false
|
||||
)
|
||||
/** 素材查询问题与就绪检查使用同一中文说明,避免重复展示后端术语。 */
|
||||
const videoInputError = computed(() => productionMessage(videoInputQuery.error.value))
|
||||
/** 视频准备问题按实际含义去重,保留所有不同的处理建议。 */
|
||||
@@ -322,6 +348,30 @@ function openShotKeyframeQuality() {
|
||||
}
|
||||
/** 当前查看历史的候选 ID;历史记录在独立弹窗内按候选隔离。 */
|
||||
const historyKeyframeId = ref('')
|
||||
/** 当前会话保留最近一次真实正式预览,只用于相同候选输入的证据展示。 */
|
||||
const latestKeyframePreview = ref<KeyframeGenerationPreview | null>(null)
|
||||
/** 历史候选的实际输入只有指纹完全一致时才能显示。 */
|
||||
const historyInput = computed(() => {
|
||||
const preview = latestKeyframePreview.value
|
||||
const item = keyframes.value.find(candidate => candidate.id === historyKeyframeId.value)
|
||||
return preview &&
|
||||
item &&
|
||||
item.shotId === preview.shotId &&
|
||||
preview.previewFingerprint === item.providerInputFingerprint
|
||||
? preview
|
||||
: null
|
||||
})
|
||||
/** 历史候选画幅或来源失效时保留浏览、禁止人工采用。 */
|
||||
const historyBlocked = computed(() => {
|
||||
const item = keyframes.value.find(candidate => candidate.id === historyKeyframeId.value)
|
||||
return (
|
||||
assetBlocked.value ||
|
||||
!item ||
|
||||
item.canvasDiagnosis?.status === 'mismatch' ||
|
||||
item.inputSnapshotStatus === 'invalid' ||
|
||||
(item.isPrimary && keyframeStale.value)
|
||||
)
|
||||
})
|
||||
/** 首帧校验历史弹窗的显示状态。 */
|
||||
const historyOpen = ref(false)
|
||||
/**
|
||||
@@ -341,6 +391,7 @@ const videoSpec = ref<VideoGenerationSpec | null>(null)
|
||||
const canGeneratePrompt = computed(
|
||||
() => !assetBlocked.value && !!props.promptReadiness && props.promptReadiness.issues.length === 0
|
||||
)
|
||||
/** 付费生成同时要求当前镜头就绪和有效正式预览。 */
|
||||
const canGenerateKeyframe = computed(
|
||||
() =>
|
||||
!assetBlocked.value &&
|
||||
@@ -518,14 +569,28 @@ async function setPrimaryKeyframe() {
|
||||
if (
|
||||
assetBlocked.value ||
|
||||
!keyframeId ||
|
||||
keyframes.value.find(item => item.id === keyframeId)?.source === 'provider_variant'
|
||||
!keyframes.value.some(
|
||||
item =>
|
||||
item.id === keyframeId &&
|
||||
item.source !== 'provider_variant' &&
|
||||
item.status === 'completed' &&
|
||||
!!item.imageUrl &&
|
||||
item.canvasDiagnosis?.status !== 'mismatch' &&
|
||||
item.inputSnapshotStatus !== 'invalid' &&
|
||||
!item.recoveryRequired
|
||||
)
|
||||
)
|
||||
return
|
||||
const shotId = props.shot.shotId
|
||||
confirmingKeyframe.value = ''
|
||||
await runOperation(props.projectId, `设置镜头 ${props.shot.shotNo} 主首帧`, async () => {
|
||||
// 晋升前重新读取持久化质量结论,刷新页面后也认可真实历史通过。
|
||||
const review = await qualityApi.keyframeQualityReview(shotId, keyframeId)
|
||||
const [review, history] = await Promise.all([
|
||||
qualityApi.keyframeQualityReview(shotId, keyframeId),
|
||||
qualityApi.keyframeHistory(shotId, keyframeId)
|
||||
])
|
||||
const vision = visionState(history)
|
||||
if (vision.active || vision.unknown || vision.resumable) throw new Error('审核尚未结算,暂不能设为主首帧。')
|
||||
if (!['passed', 'manual_accepted'].includes(review.effectiveQualityStatus))
|
||||
throw new Error('此候选尚未通过当前质量要求,请先完成质量检查或有效人工复核。')
|
||||
const result = await productionApi.setPrimaryKeyframe(shotId, keyframeId)
|
||||
@@ -620,7 +685,8 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
>{{ query.error.value }} 当前保留上次成功读取的资产,操作已暂停。
|
||||
</ContextNotice>
|
||||
|
||||
<div class="production-stage">
|
||||
<!-- 以下是项目制作中的视频提示词模块 -->
|
||||
<div v-if="!keyframeOnly" class="production-stage">
|
||||
<div class="production-stage-heading">
|
||||
<div>
|
||||
<h5 class="text-sm font-medium">01 · 视频提示词</h5>
|
||||
@@ -681,7 +747,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
<div class="production-stage">
|
||||
<div class="production-stage-heading">
|
||||
<div>
|
||||
<h5 class="text-sm font-medium">02 · 首帧</h5>
|
||||
<h5 class="text-sm font-medium">{{ keyframeOnly ? '本镜首帧' : '02 · 首帧' }}</h5>
|
||||
</div>
|
||||
<!-- 以下是首帧状态与对应原因入口模块,过期使用警告色 -->
|
||||
<ProductionStageStatus
|
||||
@@ -709,6 +775,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
@quality="openQuality('keyframe', currentKeyframe.id)"
|
||||
@edit="openEdit(currentKeyframe)"
|
||||
@history="openKeyframeHistory(currentKeyframe.id)"
|
||||
@settled="refreshAfterReview"
|
||||
/>
|
||||
</div>
|
||||
<p v-else class="mt-4 text-xs text-muted">尚无已确认主首帧。请生成候选,完成质量检查后再设为主首帧。</p>
|
||||
@@ -729,7 +796,10 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
视频质量链状态暂时无法读取;视频资产仍可查看。请稍后刷新。
|
||||
</ContextNotice>
|
||||
<div class="production-stage-actions">
|
||||
<NButton :disabled="!episodeNo || !canGenerateKeyframe" @click="openShotKeyframeQuality"
|
||||
<NButton
|
||||
v-if="!keyframeOnly"
|
||||
:disabled="!episodeNo || !canGenerateKeyframe"
|
||||
@click="openShotKeyframeQuality"
|
||||
>本镜首帧质量重跑</NButton
|
||||
>
|
||||
<NButton v-if="keyframeCandidates.length" @click="candidatesOpen = true">
|
||||
@@ -741,7 +811,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
</NTag>
|
||||
<NButton
|
||||
:loading="isOperationRunning(getOperation(projectId), `生成镜头 ${shot.shotNo} 首帧`)"
|
||||
:disabled="!canGenerateKeyframe"
|
||||
:disabled="!query.data.value"
|
||||
@click="keyframeOpen = true"
|
||||
><ImagePlus :size="14" />{{
|
||||
keyframeStale ? '生成替代候选' : currentKeyframe ? '再生成一张候选' : '生成首帧候选'
|
||||
@@ -750,7 +820,8 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="production-stage">
|
||||
<!-- 以下是项目制作中的视频资产模块 -->
|
||||
<div v-if="!keyframeOnly" class="production-stage">
|
||||
<div class="production-stage-heading">
|
||||
<div>
|
||||
<h5 class="text-sm font-medium">03 · 视频</h5>
|
||||
@@ -1039,6 +1110,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
@quality="openQuality('keyframe', item.id)"
|
||||
@edit="openEdit(item)"
|
||||
@history="openKeyframeHistory(item.id)"
|
||||
@settled="refreshAfterReview"
|
||||
@select="confirmingKeyframe = item.id"
|
||||
@confirm="setPrimaryKeyframe"
|
||||
@cancel="confirmingKeyframe = ''"
|
||||
@@ -1094,17 +1166,33 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
</AppDialog>
|
||||
<AppDialog
|
||||
v-model:open="historyOpen"
|
||||
title="首帧校验历史"
|
||||
description="查看当前候选的质量证据、历史记录和人工复核操作。"
|
||||
title="首帧记录"
|
||||
description="核对当前候选的生成输入、视觉审核与人工复核。"
|
||||
wide
|
||||
>
|
||||
<!-- 以下是同指纹的实际输入,历史无法取得时如实说明 -->
|
||||
<NCollapse v-if="historyOpen" class="mb-4">
|
||||
<NCollapseItem name="generation" title="当次参考图和画面描述">
|
||||
<ImageGenerationPreview
|
||||
v-if="historyInput"
|
||||
:preview="historyInput"
|
||||
:loading="false"
|
||||
error=""
|
||||
stale-notice=""
|
||||
display-only
|
||||
/>
|
||||
<p v-else class="text-xs text-muted">
|
||||
当前无法读取这张图的原始生成输入。可查看候选原图和已有审核记录。
|
||||
</p>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
<KeyframeValidationHistory
|
||||
v-if="historyOpen && historyKeyframeId"
|
||||
:key="historyKeyframeId"
|
||||
:project-id="projectId"
|
||||
:shot-id="shot.shotId"
|
||||
:keyframe-id="historyKeyframeId"
|
||||
:disabled="assetBlocked"
|
||||
:disabled="historyBlocked"
|
||||
initial-open
|
||||
@reviewed="refreshAfterReview"
|
||||
/>
|
||||
@@ -1120,6 +1208,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
:disabled="!canGenerateKeyframe"
|
||||
:previous-candidate-ids="keyframes.map(item => item.id)"
|
||||
:submit-generation="generateKeyframe"
|
||||
@previewed="latestKeyframePreview = $event"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
import { computed, onScopeDispose, ref, watch, type Ref } from 'vue'
|
||||
import { useQuery } from '../../composables/useQuery'
|
||||
import { ApiError } from '../../lib/http'
|
||||
import { workflowExecutionApi } from '../workflows/execution-api'
|
||||
import { qualityApi } from './quality-api'
|
||||
import { isVisualValidation } from './quality'
|
||||
import type { KeyframeValidationHistoryItem } from './quality.types'
|
||||
|
||||
/** 当前候选的最近一次客户端提交,用于断线后只读恢复。 */
|
||||
interface Submission {
|
||||
/** 本次确认的文字授权。 */
|
||||
texts: string[]
|
||||
/** 请求前已存在的最近记录。 */
|
||||
before: string | null
|
||||
/** 同一任务继续时,原执行编号用于识别新一轮。 */
|
||||
beforeExecutionId?: string
|
||||
/** 服务确认的任务编号。 */
|
||||
taskId?: string
|
||||
/** 服务确认的执行编号。 */
|
||||
executionId?: string
|
||||
/** 任务属于其他提交,当前文字不能用于继续。 */
|
||||
external?: boolean
|
||||
/** 已明确结算,仅保留原参数供显式继续。 */
|
||||
settled?: boolean
|
||||
}
|
||||
|
||||
/** 同一窗口内的各入口共享候选提交状态。 */
|
||||
const submissions = ref<Record<string, Submission | undefined>>({})
|
||||
|
||||
/**
|
||||
* 读取原提交,刷新后仍禁止因连接中断直接重发。
|
||||
* @param key 镜头及候选查询键
|
||||
* @returns 原提交
|
||||
*/
|
||||
function readSubmission(key: string) {
|
||||
const memory = submissions.value[key]
|
||||
if (!key) return undefined
|
||||
try {
|
||||
const saved = sessionStorage.getItem('keyframe-vision:' + key)
|
||||
return saved ? (JSON.parse(saved) as Submission) : undefined
|
||||
} catch {
|
||||
return memory
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存观察位置,不发起审核。
|
||||
* @param key 镜头及候选查询键
|
||||
* @param value 原提交;缺省时清除
|
||||
*/
|
||||
function saveSubmission(key: string, value?: Submission) {
|
||||
try {
|
||||
const storageKey = 'keyframe-vision:' + key
|
||||
if (value) sessionStorage.setItem(storageKey, JSON.stringify(value))
|
||||
else sessionStorage.removeItem(storageKey)
|
||||
} catch {
|
||||
// 存储不可用时保留内存状态。
|
||||
}
|
||||
submissions.value[key] = value
|
||||
}
|
||||
|
||||
/**
|
||||
* 从公开审核历史判断是否应观察、阻断或显式继续。
|
||||
* @param records 按新到旧排列的候选历史
|
||||
* @returns 与写入安全相关的当前记录
|
||||
*/
|
||||
export function visionState(records: KeyframeValidationHistoryItem[]) {
|
||||
const active = records.find(item => item.status === 'pending' || item.status === 'running')
|
||||
const unknown = records.find(item => item.status === 'failed' && visionOutput(item).recoveryRequired !== false)
|
||||
const resumable = records.find(item => item.status === 'failed' && visionOutput(item).resumeAvailable === true)
|
||||
return { active, unknown, resumable }
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取历史公开输出中的状态字段。
|
||||
* @param record 历史记录
|
||||
* @returns 审核恢复状态及公开质量结论对象
|
||||
*/
|
||||
function visionOutput(record: KeyframeValidationHistoryItem): Record<string, unknown> {
|
||||
try {
|
||||
const value: unknown = typeof record.output === 'string' ? JSON.parse(record.output) : record.output
|
||||
return value && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : {}
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按候选发现后台任务,轮询仅查询历史和正式执行记录。
|
||||
* @param key 镜头和候选 ID 的 JSON 查询键
|
||||
* @returns 观察状态和一次性提交凭据操作
|
||||
*/
|
||||
export function useKeyframeVision(key: Ref<string>) {
|
||||
/** 当前候选的客户端凭据。 */
|
||||
const submission = computed(() => readSubmission(key.value))
|
||||
/** 公开审核记录是刷新恢复的正式来源。 */
|
||||
const history = useQuery(key, (value, signal) => {
|
||||
if (!value) return Promise.resolve([])
|
||||
const [shotId, keyframeId] = JSON.parse(value) as [string, string]
|
||||
return qualityApi.keyframeHistory(shotId, keyframeId, signal)
|
||||
})
|
||||
/** 当前活跃、未结或可继续的记录。 */
|
||||
const state = computed(() => visionState(history.data.value ?? []))
|
||||
/** 旧版活跃记录没有执行编号,仍只能观察和核查。 */
|
||||
const executionKey = computed(
|
||||
() => state.value.active?.executionId ?? (submission.value?.settled ? '' : submission.value?.executionId) ?? ''
|
||||
)
|
||||
/** 只读取执行状态,不展示工作流内部原始结果。 */
|
||||
const execution = useQuery(executionKey, (id, signal) =>
|
||||
id ? workflowExecutionApi.get(id, signal) : Promise.resolve(null)
|
||||
)
|
||||
/** 未明确结算的断线状态禁止再次写入。 */
|
||||
const uncertain = computed(() => !!submission.value && !submission.value.settled && !state.value.active)
|
||||
/** 只有本次会话确知原文字授权时才能安全继续。 */
|
||||
const resumeTexts = computed(() => {
|
||||
const saved = submission.value
|
||||
return saved?.settled && !saved.external && saved.taskId && saved.taskId === state.value.resumable?.id
|
||||
? saved.texts
|
||||
: null
|
||||
})
|
||||
/** 初次读取或失败时不允许盲目启动,轮询期间不清空旧状态。 */
|
||||
const blocked = computed(
|
||||
() =>
|
||||
!history.data.value ||
|
||||
!!history.error.value ||
|
||||
!!state.value.active ||
|
||||
!!state.value.unknown ||
|
||||
uncertain.value ||
|
||||
(!!state.value.resumable && !resumeTexts.value)
|
||||
)
|
||||
|
||||
watch([history.data, submission], ([records, saved]) => {
|
||||
if (!records || !saved || saved.settled) return
|
||||
const latest = records[0]
|
||||
const found = saved.taskId
|
||||
? records.find(item => item.id === saved.taskId)
|
||||
: latest && (latest.id !== saved.before || latest.executionId !== saved.beforeExecutionId)
|
||||
? latest
|
||||
: undefined
|
||||
if (!found || !['failed', 'completed'].includes(found.status)) return
|
||||
if (saved.executionId && found.executionId !== saved.executionId) return
|
||||
saveSubmission(key.value, { ...saved, settled: true, taskId: found.id })
|
||||
})
|
||||
|
||||
const timer = setInterval(() => {
|
||||
if (key.value && (state.value.active || uncertain.value)) {
|
||||
if (!history.loading.value) void history.refresh()
|
||||
if (executionKey.value && !execution.loading.value) void execution.refresh()
|
||||
}
|
||||
}, 2500)
|
||||
onScopeDispose(() => clearInterval(timer))
|
||||
return { history, state, execution, uncertain, blocked, resumeTexts }
|
||||
}
|
||||
|
||||
/**
|
||||
* 只提交一次审核;冲突和断线回到只读观察。
|
||||
* @param shotId 正式镜头
|
||||
* @param assetId 当前候选
|
||||
* @param texts 已明确确认的文字授权
|
||||
* @param records 提交前读取的审核历史
|
||||
* @returns 已复用的质量结论,或后台受理时返回空
|
||||
*/
|
||||
export async function submitKeyframeVision(
|
||||
shotId: string,
|
||||
assetId: string,
|
||||
texts: string[],
|
||||
records: KeyframeValidationHistoryItem[]
|
||||
) {
|
||||
const key = JSON.stringify([shotId, assetId])
|
||||
const previous = readSubmission(key)
|
||||
const current = visionState(records)
|
||||
if (current.active || current.unknown || (previous && !previous.settled))
|
||||
throw new Error('已有审核或费用待核查,请查看审核记录。')
|
||||
if (
|
||||
current.resumable &&
|
||||
(!previous ||
|
||||
previous.external ||
|
||||
previous.taskId !== current.resumable.id ||
|
||||
JSON.stringify(texts) !== JSON.stringify(previous.texts))
|
||||
)
|
||||
throw new Error('继续审核需要原审核参数,请核对原操作记录。')
|
||||
const pending: Submission = {
|
||||
texts: [...texts],
|
||||
before: records[0]?.id ?? null,
|
||||
beforeExecutionId: records[0]?.executionId
|
||||
}
|
||||
saveSubmission(key, pending)
|
||||
try {
|
||||
const result = await qualityApi.validateKeyframe(shotId, assetId, texts)
|
||||
if (result.shotId !== shotId || result.keyframeId !== assetId || !result.validationTaskId)
|
||||
throw new Error('审核回执与当前候选不一致,请刷新审核记录。')
|
||||
if ('executionId' in result && result.status === 'pending' && result.executionId) {
|
||||
saveSubmission(key, { ...pending, taskId: result.validationTaskId, executionId: result.executionId })
|
||||
return null
|
||||
}
|
||||
if ('passed' in result && isVisualValidation(result)) {
|
||||
saveSubmission(key, { ...pending, taskId: result.validationTaskId, settled: true })
|
||||
return result
|
||||
}
|
||||
throw new Error('审核回执不完整,请刷新审核记录。')
|
||||
} catch (cause) {
|
||||
if (cause instanceof ApiError && cause.status === 409) {
|
||||
const details = cause.details as { code?: string; taskId?: string; executionId?: string } | null
|
||||
const code = details?.code ?? cause.code ?? cause.message.split(':')[0]
|
||||
if (code === 'KEYFRAME_VALIDATION_ACTIVE') {
|
||||
saveSubmission(key, {
|
||||
...pending,
|
||||
taskId: details?.taskId,
|
||||
executionId: details?.executionId,
|
||||
external: true
|
||||
})
|
||||
return null
|
||||
}
|
||||
if (code === 'KEYFRAME_VALIDATION_RECOVERY_REQUIRED') {
|
||||
saveSubmission(key, { ...pending, taskId: details?.taskId, external: true })
|
||||
throw new Error('原审核结果或费用待核查,请查看审核记录。', { cause })
|
||||
}
|
||||
saveSubmission(key, previous)
|
||||
throw new Error('候选或审核输入可能已变化,请刷新正式候选后核对。', { cause })
|
||||
}
|
||||
if (cause instanceof ApiError && cause.status >= 400 && cause.status < 500) saveSubmission(key, previous)
|
||||
throw cause
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import type {
|
||||
ImageProviderCapability,
|
||||
KeyframeRepair,
|
||||
KeyframeValidation,
|
||||
KeyframeValidationAccepted,
|
||||
KeyframeQualityStart,
|
||||
KeyframeValidationHistoryItem,
|
||||
QualityInput,
|
||||
@@ -34,7 +35,7 @@ export interface KeyframeQualityReview {
|
||||
manualReviewAvailable: boolean
|
||||
}
|
||||
|
||||
/** 校验会调用视觉模型,POST 不设短超时、不自动重试;能力检查只读。 */
|
||||
/** 视觉审核提交不自动重试;首帧后台受理有连接超时,长同步操作等候实际结论。 */
|
||||
export const qualityApi = {
|
||||
repairVideo: (shotId: string, videoId: string, maxRepairAttempts: number) =>
|
||||
request<VideoRepair>(
|
||||
@@ -55,10 +56,11 @@ export const qualityApi = {
|
||||
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframe-provider-capability${provider ? `?provider=${encodeURIComponent(provider)}` : ''}`,
|
||||
{ signal }
|
||||
),
|
||||
/** 显式请求一次审核,返回后台受理或既有质量结果。 */
|
||||
validateKeyframe: (shotId: string, assetId: string, allowedTexts: string[]) =>
|
||||
request<KeyframeValidation>(
|
||||
request<KeyframeValidation | KeyframeValidationAccepted>(
|
||||
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframes/${encodeURIComponent(assetId)}/validate`,
|
||||
{ method: 'POST', body: { allowedTexts }, timeoutMs: 0 }
|
||||
{ method: 'POST', body: { allowedTexts } }
|
||||
),
|
||||
repair: (
|
||||
shotId: string,
|
||||
|
||||
@@ -205,6 +205,40 @@ export interface KeyframeQualityStart {
|
||||
total: number
|
||||
}
|
||||
|
||||
/** 正式 Vision 后台受理回执,不表示质量已通过。 */
|
||||
export interface KeyframeValidationAccepted {
|
||||
/** 工作流执行编号。 */
|
||||
executionId: string
|
||||
/** 已保存的审核任务。 */
|
||||
validationTaskId: string
|
||||
/** 镜头编号。 */
|
||||
shotId: string
|
||||
/** 候选编号。 */
|
||||
keyframeId: string
|
||||
/** 正在等待执行。 */
|
||||
status: 'pending'
|
||||
}
|
||||
|
||||
/** 审核历史中公开的步骤证据。 */
|
||||
export interface KeyframeValidationStep {
|
||||
/** 审核范围。 */
|
||||
name: 'general' | 'physical' | 'gaze'
|
||||
/** 已保存的实际步骤状态。 */
|
||||
status: 'pending' | 'running' | 'received' | 'completed' | 'failed' | 'needs_review'
|
||||
/** 请求编号。 */
|
||||
requestId?: string
|
||||
/** 模型服务请求编号。 */
|
||||
providerRequestId?: string
|
||||
/** 开始时间。 */
|
||||
startedAt?: string
|
||||
/** 完成时间。 */
|
||||
finishedAt?: string
|
||||
/** 可取得的词元计量。 */
|
||||
usage?: Partial<Record<'inputTokens' | 'outputTokens' | 'totalTokens' | 'reasoningTokens', number>>
|
||||
/** 公开错误说明。 */
|
||||
error?: string
|
||||
}
|
||||
|
||||
/** 已保存的只读首帧校验任务记录。 */
|
||||
export interface KeyframeValidationHistoryItem {
|
||||
/** 校验任务编号 */
|
||||
@@ -213,6 +247,10 @@ export interface KeyframeValidationHistoryItem {
|
||||
status: string
|
||||
/** 数据库保存的 JSON 输出 */
|
||||
output: string | Record<string, unknown> | null
|
||||
/** 新版工作流执行编号。 */
|
||||
executionId?: string
|
||||
/** 公开步骤进度。 */
|
||||
steps?: KeyframeValidationStep[]
|
||||
/** 调用错误 */
|
||||
error: string | null
|
||||
/** 开始时间 */
|
||||
|
||||
@@ -142,6 +142,12 @@ export interface VideoReadiness {
|
||||
|
||||
/** 首帧生成记录;成功图片与失败历史都保留。 */
|
||||
export interface ShotKeyframe {
|
||||
/** 当前项目画幅与候选实际像素的诊断。 */
|
||||
canvasDiagnosis?: {
|
||||
/** 项目要求的画幅。 */ expected: string | null
|
||||
/** 候选实际画幅。 */ actual: string | null
|
||||
/** 服务端比较结论。 */ status: 'matched' | 'mismatch' | 'unknown'
|
||||
}
|
||||
/** 持久化的实际输入状态。 */
|
||||
inputSnapshotStatus?: 'recorded' | 'not-recorded' | 'invalid'
|
||||
/** 当次实际输入指纹。 */
|
||||
@@ -207,7 +213,11 @@ export interface KeyframeReference {
|
||||
subjectId: string
|
||||
subjectRef: string
|
||||
module: string
|
||||
role: 'identity-anchor' | 'form-primary'
|
||||
role: ImageReferenceRole
|
||||
/** 该机位参考绑定的场景几何版本。 */
|
||||
spatialLayoutVersion?: string
|
||||
/** 确认的机位说明。 */
|
||||
viewDescription?: string
|
||||
subjectFormId?: string
|
||||
imageId: string
|
||||
imageUrl: string
|
||||
@@ -216,6 +226,12 @@ export interface KeyframeReference {
|
||||
|
||||
/** 后端确定性编译的首帧生成规格,不会在查询时调用图片模型。 */
|
||||
export interface KeyframeSpec {
|
||||
/** 当前正式来源指纹。 */
|
||||
formalSourceFingerprint: string
|
||||
/** 项目交付画幅。 */
|
||||
deliveryCanvas?: string
|
||||
/** 只读相邻镜头依据。 */
|
||||
continuity?: import('../storyboard/generation-spec.types').ShotContinuityEvidence | null
|
||||
projectId: string
|
||||
shotId: string
|
||||
episodeNo: number
|
||||
@@ -257,6 +273,10 @@ export interface KeyframeSpecConsistencyIssue {
|
||||
|
||||
/** 正式镜头的最终图片输入与导演约束检查。 */
|
||||
export interface KeyframeGenerationPreview extends ImageGenerationPreview {
|
||||
/** 项目正式交付画幅。 */
|
||||
deliveryCanvas?: string
|
||||
/** 只读相邻镜头依据与待确认事项。 */
|
||||
continuity?: import('../storyboard/generation-spec.types').ShotContinuityEvidence | null
|
||||
specConsistencyIssues?: KeyframeSpecConsistencyIssue[]
|
||||
specConsistencySummary?: {
|
||||
warningCount: number
|
||||
@@ -328,9 +348,11 @@ export interface GenerateKeyframesInput {
|
||||
export interface GenerateKeyframeInput {
|
||||
/** 用户确认的最终输入版本。 */
|
||||
expectedPreviewFingerprint?: string
|
||||
setPrimary: boolean
|
||||
provider?: string
|
||||
generationOptions?: Record<string, string | number | boolean>
|
||||
/** 单镜头生成总是先生成候选。 */ setPrimary: boolean
|
||||
/** 图片模型供应方。 */ provider?: string
|
||||
/** 本次已核对的图片参数。 */ generationOptions?: Record<string, string | number | boolean>
|
||||
/** 旧版显式尺寸宽度,仍由项目画幅限制。 */ width?: number
|
||||
/** 旧版显式尺寸高度,仍由项目画幅限制。 */ height?: number
|
||||
}
|
||||
|
||||
/** 首帧批量生成回执;详细阻塞原因应配合 readiness 查看。 */
|
||||
|
||||
@@ -6,6 +6,8 @@ import { projectsApi } from '../projects/api'
|
||||
import { hasRunningWorkflow } from '../workflows/selectors'
|
||||
import { getOperation, runOperation } from '../workflows/operations'
|
||||
import { productionApi } from './api'
|
||||
import { preparationApi } from '../storyboard-preparation/api'
|
||||
import { submitKeyframeVision } from './keyframe-vision'
|
||||
import { qualityApi } from './quality-api'
|
||||
import {
|
||||
isVisualValidation,
|
||||
@@ -160,6 +162,8 @@ export function useQuality(
|
||||
throw new Error('镜头就绪列表不完整,请刷新。')
|
||||
let receipt: QualityReceipt
|
||||
if (target.kind === 'batch') {
|
||||
const entry = await preparationApi.entry(projectId)
|
||||
if (entry.ready !== true) throw new Error(entry.reason || '项目制作条件尚未满足。')
|
||||
const targets = qualityTargets(readiness, input)
|
||||
if (!targets.length)
|
||||
throw new Error(
|
||||
@@ -203,6 +207,30 @@ export function useQuality(
|
||||
} else {
|
||||
if (!readiness.items.some(item => item.shotId === target.shotId))
|
||||
throw new Error('指定镜头不属于当前项目,未提交质量任务。')
|
||||
if (target.kind === 'keyframe' && action === 'validate') {
|
||||
const [images, history] = await Promise.all([
|
||||
productionApi.listKeyframes(target.shotId),
|
||||
qualityApi.keyframeHistory(target.shotId, target.assetId)
|
||||
])
|
||||
const image = images.find(item => item.id === target.assetId && item.shotId === target.shotId)
|
||||
if (
|
||||
!image ||
|
||||
image.status !== 'completed' ||
|
||||
!image.imageUrl ||
|
||||
image.canvasDiagnosis?.status === 'mismatch' ||
|
||||
image.inputSnapshotStatus === 'invalid'
|
||||
)
|
||||
throw new Error('首帧未完成、画幅不符或来源过期,不能执行质量检查。')
|
||||
if (!stillCurrent()) throw new Error('已离开原候选,未提交审核。')
|
||||
const result = await submitKeyframeVision(
|
||||
target.shotId,
|
||||
target.assetId,
|
||||
input.allowedTexts ?? [],
|
||||
history
|
||||
)
|
||||
if (result) receiptTarget.receipt = { kind: 'keyframe', result }
|
||||
return
|
||||
}
|
||||
if (target.kind === 'video') {
|
||||
const videos = await productionApi.listVideos(target.shotId)
|
||||
const video = videos.find(item => item.id === target.assetId && item.shotId === target.shotId)
|
||||
@@ -298,19 +326,7 @@ export function useQuality(
|
||||
throw new Error('修复回执不完整,请先核对首帧与主图状态,不要重复生图。')
|
||||
receipt = { kind: 'repair', result }
|
||||
} else {
|
||||
const result = await qualityApi.validateKeyframe(
|
||||
target.shotId,
|
||||
target.assetId,
|
||||
input.allowedTexts ?? []
|
||||
)
|
||||
if (
|
||||
!isVisualValidation(result) ||
|
||||
result.shotId !== target.shotId ||
|
||||
result.keyframeId !== target.assetId ||
|
||||
!result.validationTaskId
|
||||
)
|
||||
throw new Error('首帧检查结果不完整或与所选图片不一致,请刷新检查记录。')
|
||||
receipt = { kind: 'keyframe', result }
|
||||
throw new Error('当前质量操作不可用。')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,10 +49,11 @@ export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<Pro
|
||||
nextLabel: preparationReady ? '前往视觉风格' : '前往剧本拆解'
|
||||
},
|
||||
storyboard: {
|
||||
enabled: Boolean(state?.breakdown.ready && state?.subjectAssets.ready),
|
||||
reason: state?.breakdown.reason || state?.subjectAssets.reason || '请先准备主体素材',
|
||||
nextPath: state?.breakdown.ready ? 'subject-images' : 'breakdown',
|
||||
nextLabel: state?.breakdown.ready ? '前往形态图片' : '前往剧本拆解'
|
||||
// 正式分镜可以先进入核对草案和单镜头;全项目素材缺失仍阻断制作。
|
||||
enabled: preparationReady || state?.breakdown.ready === true,
|
||||
reason: preparationReason || state?.breakdown.reason || '请先完成正式分镜准备',
|
||||
nextPath: 'breakdown',
|
||||
nextLabel: '前往剧本拆解'
|
||||
},
|
||||
production: {
|
||||
enabled: Boolean(state?.breakdown.ready && state?.subjectAssets.ready && state?.storyboard.ready),
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { DiagnosisLocation } from '../breakdown/diagnosis'
|
||||
import type { StoryboardHandRepairHistory } from '../breakdown/types'
|
||||
import type {
|
||||
StoryboardRecheck,
|
||||
StoryboardQualityPreflight,
|
||||
ReviewBaselinePreview,
|
||||
StoryboardApproval,
|
||||
StoryboardApprovalState,
|
||||
@@ -63,7 +64,15 @@ export const preparationApi = {
|
||||
* @returns 正式接口的实际业务回执
|
||||
*/
|
||||
approval: (id: string, signal?: AbortSignal) =>
|
||||
request<StoryboardApprovalState>(`${root(id)}/storyboard/quality-confirmation`, { signal }),
|
||||
request<StoryboardApprovalState>(`${root(id)}/storyboard-quality-confirmation`, { signal }),
|
||||
/**
|
||||
* 同次读取人工确认和当前分镜质量。
|
||||
* @param id 正式项目
|
||||
* @param signal 取消旧读取
|
||||
* @returns 当前版本、质量和覆盖
|
||||
*/
|
||||
qualityPreflight: (id: string, signal?: AbortSignal) =>
|
||||
request<StoryboardQualityPreflight>(`${root(id)}/storyboard-quality-confirmation/preflight`, { signal }),
|
||||
/**
|
||||
* 明确确认当前分镜的整体审核。
|
||||
* @param id 当前项目编号
|
||||
@@ -71,7 +80,7 @@ export const preparationApi = {
|
||||
* @returns 正式接口的实际业务回执
|
||||
*/
|
||||
confirmApproval: (id: string, input: StoryboardReviewInput) =>
|
||||
request<StoryboardApproval>(`${root(id)}/storyboard/quality-confirmation`, { method: 'POST', body: input }),
|
||||
request<StoryboardApproval>(`${root(id)}/storyboard-quality-confirmation`, { method: 'POST', body: input }),
|
||||
/**
|
||||
* 只读制作入口结论,必须在制作计划前核对。
|
||||
* @param id 当前项目编号
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface PreparationIssue extends Omit<DiagnosisLocation, 'shotNo'> {
|
||||
export interface StoryboardRecheck {
|
||||
/** 所属项目。 */
|
||||
projectId: string
|
||||
/** 综合问题状态,当前接口不返回全局通过。 */
|
||||
/** 综合问题状态,确定性检查通过也不代替人工审核。 */
|
||||
status: 'blocked' | 'insufficient_evidence' | 'needs_review'
|
||||
/** 结构检查。 */
|
||||
structure: {
|
||||
@@ -64,8 +64,8 @@ export interface StoryboardRecheck {
|
||||
}
|
||||
/** 可以继续进入人工审核,不能代替正式生产准入。 */
|
||||
preflightEligible: boolean
|
||||
/** 本接口始终不直接确认。 */
|
||||
canConfirm: false
|
||||
/** 是否符合提交人工确认的前置条件;此查询不写入记录。 */
|
||||
canConfirm: boolean
|
||||
}
|
||||
/** 历史分镜缺少规则快照时,明确建立新审核来源的只读预览。 */
|
||||
export interface ReviewBaselinePreview {
|
||||
@@ -230,3 +230,9 @@ export interface BeatSubjectRepairResult {
|
||||
/** 修订后段落内容版本。 */ resultFingerprint: string
|
||||
/** 真实保存状态。 */ written: true
|
||||
}
|
||||
|
||||
/** 人工确认前一次性返回当前来源和质量覆盖。 */
|
||||
export interface StoryboardQualityPreflight {
|
||||
/** 当前人工确认凭据及分镜版本。 */ current: StoryboardApprovalState
|
||||
/** 确定性复检及待核对问题。 */ quality: StoryboardRecheck
|
||||
}
|
||||
@@ -16,6 +16,10 @@ import { EmptyState } from '../../components/ui'
|
||||
import { downloadText } from '../../lib/format'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
import GenerationReceipt from './components/GenerationReceipt.vue'
|
||||
import { useQuery } from '../../composables/useQuery'
|
||||
import { productionApi } from '../production/api'
|
||||
import ShotProductionAssets from '../production/components/ShotProductionAssets.vue'
|
||||
import ShotDerivedReview from './components/ShotDerivedReview.vue'
|
||||
import ShotDesign from './components/ShotDesign.vue'
|
||||
import MotionPlanPanel from './components/MotionPlanPanel.vue'
|
||||
import MotionAuditPanel from './components/MotionAuditPanel.vue'
|
||||
@@ -64,6 +68,7 @@ const {
|
||||
data,
|
||||
episodeSourceUnavailable,
|
||||
prerequisites,
|
||||
projectAssetsReady,
|
||||
session,
|
||||
operation,
|
||||
concurrency,
|
||||
@@ -79,6 +84,16 @@ const {
|
||||
executions,
|
||||
run
|
||||
} = useStoryboard()
|
||||
/** 仅在首帧标签读取项目列表中的本镜就绪结果,独立于项目制作入口。 */
|
||||
const keyframeProject = computed(() => (detailTab.value === 'keyframes' ? id.value : ''))
|
||||
/** 按当前项目读取后端的逐镜头首帧就绪项。 */
|
||||
const keyframeReadiness = useQuery(keyframeProject, (projectId, signal) =>
|
||||
projectId ? productionApi.keyframeReadiness(projectId, true, signal) : Promise.resolve(null)
|
||||
)
|
||||
/** 只使用当前镜头对应的结果。 */
|
||||
const shotReadiness = computed(() =>
|
||||
keyframeReadiness.data.value?.items.find(item => item.shotId === shot.value?.shotId)
|
||||
)
|
||||
/** 切换详情标签后仍观察起点视觉任务,重新进入项目时恢复真实终态。 */
|
||||
useWorkflowExecution(id, 'motion-plan-start-state-validation')
|
||||
const productionReady = computed(() => directionComplete.value && visualStateComplete.value)
|
||||
@@ -634,7 +649,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
||||
<div>
|
||||
<NTabs v-model:value="detailTab" type="line" size="small" aria-label="镜头详情"
|
||||
><NTab name="design">设计与状态</NTab><NTab name="tools">参考图与提示词</NTab
|
||||
><NTab name="motion">动作与视线</NTab></NTabs
|
||||
><NTab name="motion">动作与视线</NTab><NTab name="keyframes">首帧</NTab></NTabs
|
||||
>
|
||||
<!-- 以下是统一标签内容起点与模块间距的动作和视线模块 -->
|
||||
<div
|
||||
@@ -646,25 +661,63 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
||||
:shot-id="shot.shotId"
|
||||
:revision="session.prompts[shot.shotId]?.updatedAt"
|
||||
:project-id="id"
|
||||
:disabled="blocked"
|
||||
:disabled="blocked || !projectAssetsReady"
|
||||
@changed="query.refresh"
|
||||
/>
|
||||
<SpatialBindingsPanel
|
||||
:key="shot.shotId"
|
||||
:project-id="id"
|
||||
:shot-id="shot.shotId"
|
||||
:disabled="blocked"
|
||||
:disabled="blocked || !projectAssetsReady"
|
||||
@changed="query.refresh"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="detailTab === 'design'" class="pt-6"><ShotDesign :shot="shot" /></div>
|
||||
<!-- 以下是正式摄影、即时状态与待审草案入口 -->
|
||||
<div v-if="detailTab === 'design'" class="space-y-5 pt-6">
|
||||
<ShotDerivedReview
|
||||
:key="shot.shotId"
|
||||
:project-id="id"
|
||||
:episode-no="episodeNo"
|
||||
:shot="shot"
|
||||
:shots="shots"
|
||||
:disabled="blocked"
|
||||
@changed="query.refresh"
|
||||
/>
|
||||
<ShotDesign :shot="shot" />
|
||||
</div>
|
||||
<!-- 以下是独立于项目批量制作门禁的单镜头首帧 -->
|
||||
<div v-if="detailTab === 'keyframes'" class="pt-4">
|
||||
<p
|
||||
v-if="keyframeReadiness.loading.value && !keyframeReadiness.data.value"
|
||||
role="status"
|
||||
class="text-xs text-muted"
|
||||
>
|
||||
正在检查本镜生成条件…
|
||||
</p>
|
||||
<NButton
|
||||
v-if="keyframeReadiness.error.value"
|
||||
size="small"
|
||||
@click="keyframeReadiness.refresh"
|
||||
>重新读取生成条件</NButton
|
||||
>
|
||||
<ShotProductionAssets
|
||||
:key="shot.shotId"
|
||||
:project-id="id"
|
||||
:shot="shot"
|
||||
:episode-no="episodeNo"
|
||||
:keyframe-readiness="shotReadiness"
|
||||
keyframe-only
|
||||
:disabled="blocked || !!keyframeReadiness.error.value"
|
||||
@changed="keyframeReadiness.refresh"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="detailTab === 'tools'" class="pt-6">
|
||||
<ShotTools
|
||||
:key="shot.shotId"
|
||||
:project-id="id"
|
||||
:episode-no="episodeNo"
|
||||
:shot="shot"
|
||||
:disabled="blocked"
|
||||
:disabled="blocked || !projectAssetsReady"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,546 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NSelect, NTag } from 'naive-ui'
|
||||
import { AppDrawer, WorkspaceSectionHeading } from '../../../components/ui'
|
||||
import { useActionMessage } from '../../../components/ui/useActionMessage'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { ApiError, errorMessage } from '../../../lib/http'
|
||||
import { userFacingText } from '../../../lib/user-facing-text'
|
||||
import { productionApi } from '../../production/api'
|
||||
import KeyframePreviewChecks from '../../production/components/KeyframePreviewChecks.vue'
|
||||
import ImageGenerationPreview from '../../subject-images/components/ImageGenerationPreview.vue'
|
||||
import { preparationApi } from '../../storyboard-preparation/api'
|
||||
import { getOperation, runOperation } from '../../workflows/operations'
|
||||
import { generationConfigApi } from '../../generation-config/api'
|
||||
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||
import type { GenerationOptions } from '../../generation-config/types'
|
||||
import { storyboardApi } from '../api'
|
||||
import { derivedReviewApi } from '../derived-review-api'
|
||||
import { draftFromFormal } from '../derived-review'
|
||||
import type { DerivedReviewSelection, ShotDraftPreview, ShotReviewDraft } from '../derived-review.types'
|
||||
import { directionLabel } from '../model'
|
||||
import type { DesignedShot } from '../types'
|
||||
|
||||
/** 现有分镜设计区中的无费用摄影预览和人工采用入口。 */
|
||||
const props = defineProps<{
|
||||
/** 当前正式项目。 */ projectId: string
|
||||
/** 当前剧集编号。 */ episodeNo: number
|
||||
/** 当前镜头。 */ shot: DesignedShot
|
||||
/** 现有目录中的镜头,用于显示前镜坐标。 */ shots: DesignedShot[]
|
||||
/** 项目任务是否占用。 */ disabled: boolean
|
||||
}>()
|
||||
/** 采用后刷新现有分镜设计数据。 */
|
||||
const emit = defineEmits<{ changed: [] }>()
|
||||
/** 当前人工审核抽屉。 */
|
||||
const open = ref(false)
|
||||
/** 在同一摄影入口切换受控修订与场景沿用。 */
|
||||
const mode = ref<'camera' | 'scene'>('camera')
|
||||
/** 当前手动核对的构图与机位。 */
|
||||
const composition = ref('')
|
||||
/** 当前手动核对的摄影机位置。 */
|
||||
const cameraPosition = ref('')
|
||||
/** 当前明确选择沿用的场景。 */
|
||||
const selectedScene = ref<string | null>(null)
|
||||
/** 尚无正式派生时,可导入已准备好的待审输入。 */
|
||||
const imported = ref('')
|
||||
/** 本次预览明确选用的模型。 */
|
||||
const provider = ref('')
|
||||
/** 本次预览使用的参数覆盖。 */
|
||||
const options = ref<GenerationOptions>({})
|
||||
/** 人工审核署名。 */
|
||||
const reviewer = ref('')
|
||||
/** 用户已读过本次预览及差异。 */
|
||||
const acknowledged = ref(false)
|
||||
/** 保存时保持抽屉和提交内容稳定。 */
|
||||
const saving = ref(false)
|
||||
/** 当前消息层。 */
|
||||
const message = useActionMessage()
|
||||
/** 关闭或切换镜头后撤销旧读取。 */
|
||||
const key = computed(() => (open.value ? props.shot.shotId : ''))
|
||||
/** 已有正式设计时仅允许受控修改。 */
|
||||
const formal = computed(() => !!props.shot.direction && !!props.shot.visualState)
|
||||
/** 读取服务端正式审核状态和版本。 */
|
||||
const preflight = useQuery(key, (id, signal) =>
|
||||
id ? preparationApi.qualityPreflight(props.projectId, signal) : Promise.resolve(null)
|
||||
)
|
||||
/** 受控修改前重新读取镜头规格、实际参考与新鲜摄影记录。 */
|
||||
const formalQuery = useQuery(key, async (id, signal) => {
|
||||
if (!id || !formal.value) return null
|
||||
const [keyframe, generation, directions, visuals] = await Promise.all([
|
||||
productionApi.keyframeSpec(id, signal),
|
||||
storyboardApi.generationSpec(id, signal),
|
||||
storyboardApi.directions(props.projectId, props.episodeNo, signal),
|
||||
storyboardApi.visualStates(props.projectId, props.episodeNo, signal)
|
||||
])
|
||||
const direction = directions.beats.flatMap(item => item.shots).find(item => item.shotId === id)?.direction
|
||||
const visualState = visuals.beats.flatMap(item => item.shots).find(item => item.shotId === id)?.visualState
|
||||
if (!direction || !visualState || generation.shotId !== id || keyframe.shotId !== id)
|
||||
throw new Error('无法核对当前镜头的正式摄影和即时状态。')
|
||||
return { keyframe, generation, shot: { ...props.shot, direction, visualState } }
|
||||
})
|
||||
/** 只允许目录中当前启用的模型。 */
|
||||
const configuration = useQuery(key, async (id, signal) => {
|
||||
if (!id) return null
|
||||
const [catalog, profile] = await Promise.all([
|
||||
generationConfigApi.catalog(signal),
|
||||
generationConfigApi.profile(props.projectId, signal)
|
||||
])
|
||||
return profile ? { catalog, profile } : null
|
||||
})
|
||||
/** 正式场景衔接证据;不会用前镜首帧冒充尾态。 */
|
||||
const continuity = computed(() => formalQuery.data.value?.generation.continuity)
|
||||
/** 使用现有镜头目录将前镜编号转换为用户可见坐标。 */
|
||||
const previousShot = computed(() => props.shots.find(item => item.shotId === continuity.value?.previousShotId))
|
||||
/** 只列出服务提供同形态、可填写的正式前镜场景状态。 */
|
||||
const scenes = computed(() =>
|
||||
(continuity.value?.subjects ?? []).filter(
|
||||
item =>
|
||||
continuity.value?.sameScene &&
|
||||
item.module === 'scene' &&
|
||||
item.formDecision === 'same_form' &&
|
||||
!!item.previousStartState &&
|
||||
!item.currentStartState
|
||||
)
|
||||
)
|
||||
/** 已选中的具体场景。 */
|
||||
const scene = computed(() => scenes.value.find(item => item.subjectRef === selectedScene.value))
|
||||
/** 当前服务端质量报告中的可操作问题。 */
|
||||
const issues = computed(() => {
|
||||
const quality = preflight.data.value?.quality
|
||||
if (!quality) return []
|
||||
return [
|
||||
...new Set(
|
||||
[
|
||||
quality.structure.reason,
|
||||
...[quality.issues, quality.actionAudit.issues, quality.sourceAudit.issues]
|
||||
.flat()
|
||||
.map(item => item.message)
|
||||
].filter((item): item is string => !!item)
|
||||
)
|
||||
]
|
||||
})
|
||||
/** 绑定预览快照与确切的原请求。 */
|
||||
const reviewed = ref<{ preview: ShotDraftPreview; selection: DerivedReviewSelection } | null>(null)
|
||||
/** 免费预览可以关闭和取消。 */
|
||||
const previewing = ref(false)
|
||||
let previewController: AbortController | undefined
|
||||
|
||||
/** 任何参数或来源改变都撤销旧的审核确认。 */
|
||||
function clearPreview() {
|
||||
previewController?.abort()
|
||||
previewing.value = false
|
||||
reviewed.value = null
|
||||
acknowledged.value = false
|
||||
}
|
||||
|
||||
onScopeDispose(clearPreview)
|
||||
watch(
|
||||
[
|
||||
key,
|
||||
mode,
|
||||
composition,
|
||||
cameraPosition,
|
||||
selectedScene,
|
||||
imported,
|
||||
provider,
|
||||
options,
|
||||
formalQuery.data,
|
||||
preflight.data
|
||||
],
|
||||
clearPreview,
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
watch(key, () => {
|
||||
mode.value = 'camera'
|
||||
selectedScene.value = null
|
||||
imported.value = ''
|
||||
reviewer.value = ''
|
||||
})
|
||||
watch(formalQuery.data, value => {
|
||||
composition.value = value?.shot.direction?.composition ?? ''
|
||||
cameraPosition.value = value?.shot.direction?.cameraPosition ?? ''
|
||||
})
|
||||
watch(configuration.data, value => {
|
||||
const model = value?.catalog.images.find(item => item.enabled && item.provider === value.profile.imageProvider)
|
||||
provider.value = model?.provider ?? ''
|
||||
options.value = value?.profile.imageOptions ?? {}
|
||||
})
|
||||
/** 是否具备提交免费预览的实际输入。 */
|
||||
const canPreview = computed(
|
||||
() =>
|
||||
!!provider.value &&
|
||||
!!preflight.data.value?.current.evidence.shotFingerprint &&
|
||||
!preflight.error.value &&
|
||||
!configuration.error.value &&
|
||||
(formal.value
|
||||
? !!formalQuery.data.value &&
|
||||
!formalQuery.error.value &&
|
||||
(mode.value === 'scene' ? !!scene.value : !!composition.value.trim() && !!cameraPosition.value.trim())
|
||||
: !!imported.value.trim())
|
||||
)
|
||||
/** 展示已预览输入,草案指纹只用于只读公共组件。 */
|
||||
const previewDisplay = computed(() =>
|
||||
reviewed.value
|
||||
? {
|
||||
...reviewed.value.preview,
|
||||
previewFingerprint: reviewed.value.preview.draftFingerprint
|
||||
}
|
||||
: null
|
||||
)
|
||||
|
||||
/**
|
||||
* 构造本镜草案;正式修订只允许触及被选中的字段。
|
||||
* @returns 待审输入
|
||||
*/
|
||||
function buildDraft(): ShotReviewDraft {
|
||||
const fingerprint = preflight.data.value!.current.evidence.shotFingerprint
|
||||
if (!formal.value) {
|
||||
let draft: ShotReviewDraft
|
||||
try {
|
||||
draft = JSON.parse(imported.value) as ShotReviewDraft
|
||||
} catch {
|
||||
throw new Error('无法读取草案,请核对导入内容。')
|
||||
}
|
||||
if (
|
||||
!draft ||
|
||||
draft.expectedShotFingerprint !== fingerprint ||
|
||||
draft.direction?.shotNo !== props.shot.shotNo ||
|
||||
draft.visualState?.shotNo !== props.shot.shotNo
|
||||
)
|
||||
throw new Error('草案的镜头或分镜版本与当前记录不一致。')
|
||||
return draft
|
||||
}
|
||||
const source = formalQuery.data.value!
|
||||
const draft = draftFromFormal(source.shot, source.keyframe, fingerprint)
|
||||
if (mode.value === 'camera') {
|
||||
draft.direction.composition = composition.value.trim()
|
||||
draft.direction.cameraPosition = cameraPosition.value.trim()
|
||||
} else {
|
||||
const selected = scene.value
|
||||
const previousShotId = continuity.value?.previousShotId
|
||||
const target = draft.visualState.subjects.find(item => item.subjectRef === selected?.subjectRef)
|
||||
if (
|
||||
!target ||
|
||||
!selected?.previousStartState ||
|
||||
!previousShotId ||
|
||||
target.formId !== selected.currentFormId ||
|
||||
target.transientState.trim()
|
||||
)
|
||||
throw new Error('场景状态已变化,请重新读取当前镜头。')
|
||||
target.transientState = selected.previousStartState
|
||||
draft.sceneStateCarryForward = { previousShotId, subjectRef: selected.subjectRef }
|
||||
}
|
||||
return draft
|
||||
}
|
||||
|
||||
/** 免费编译并冻结本次输入,只有同一快照可正式采用。 */
|
||||
async function loadPreview() {
|
||||
if (!canPreview.value || previewing.value || saving.value) return
|
||||
clearPreview()
|
||||
const controller = new AbortController()
|
||||
previewController = controller
|
||||
previewing.value = true
|
||||
try {
|
||||
const draft = buildDraft()
|
||||
const shotId = props.shot.shotId
|
||||
const parameters = { provider: provider.value, generationOptions: { ...options.value } }
|
||||
const expectedCurrentFormalSourceFingerprint = formalQuery.data.value?.keyframe.formalSourceFingerprint
|
||||
const preview = await derivedReviewApi.preview(shotId, draft, parameters, controller.signal)
|
||||
if (controller.signal.aborted) return
|
||||
if (preview.shotId !== shotId || !preview.draftFingerprint || preview.productionReady !== false)
|
||||
throw new Error('没有收到本镜头的有效草案预览。')
|
||||
reviewed.value = {
|
||||
preview,
|
||||
selection: {
|
||||
...parameters,
|
||||
shotId,
|
||||
draft,
|
||||
expectedDraftFingerprint: preview.draftFingerprint,
|
||||
...(expectedCurrentFormalSourceFingerprint ? { expectedCurrentFormalSourceFingerprint } : {})
|
||||
}
|
||||
}
|
||||
} catch (cause) {
|
||||
if (!controller.signal.aborted) message?.error(errorMessage(cause))
|
||||
} finally {
|
||||
if (!controller.signal.aborted) previewing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 只有用户确认后才写入选中的正式镜头。 */
|
||||
async function adopt() {
|
||||
if (
|
||||
!reviewed.value ||
|
||||
!acknowledged.value ||
|
||||
!preflight.data.value?.current.valid ||
|
||||
!reviewer.value.trim() ||
|
||||
saving.value ||
|
||||
props.disabled
|
||||
)
|
||||
return
|
||||
const { selection } = reviewed.value
|
||||
const projectId = props.projectId
|
||||
const author = reviewer.value.trim()
|
||||
saving.value = true
|
||||
try {
|
||||
const ok = await runOperation(projectId, '采用已审摄影草案', async () => {
|
||||
const result = await derivedReviewApi.confirm(projectId, author, [selection])
|
||||
if (!result.shots.some(item => item.shotId === selection.shotId))
|
||||
throw new Error('未收到当前镜头的采用结果,请重新读取分镜。')
|
||||
})
|
||||
if (projectId !== props.projectId || selection.shotId !== props.shot.shotId) return
|
||||
if (ok) {
|
||||
message?.success('已采用当前镜头的审核结果')
|
||||
open.value = false
|
||||
emit('changed')
|
||||
} else {
|
||||
const operation = getOperation(projectId)
|
||||
if (operation.cause instanceof ApiError && operation.cause.status === 409) {
|
||||
clearPreview()
|
||||
message?.warning('当前来源或审核状态已变化,请重新预览。' + operation.error)
|
||||
void preflight.refresh()
|
||||
void formalQuery.refresh()
|
||||
} else message?.error(operation.error)
|
||||
}
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是现有摄影设计内的人工审核入口 -->
|
||||
<NButton class="workspace-action-button" @click="open = true">摄影草案与审核</NButton>
|
||||
<AppDrawer
|
||||
v-model:open="open"
|
||||
:busy="saving"
|
||||
title="摄影草案与审核"
|
||||
:description="`第 ${episodeNo} 集 · 镜头 ${shot.beatNo}.${shot.shotNo} · ${shot.title}`"
|
||||
>
|
||||
<div class="space-y-6">
|
||||
<!-- 以下是当前分镜来源、质量诊断与人工确认状态 -->
|
||||
<section v-if="preflight.data.value" class="space-y-2 text-sm">
|
||||
<WorkspaceSectionHeading title="正式分镜审核" />
|
||||
<p>
|
||||
{{ preflight.data.value.current.valid ? '当前版本已审核' : '当前版本尚未审核或已过期' }} ·
|
||||
{{ preflight.data.value.quality.coverage.episodeCount }} 集 ·
|
||||
{{ preflight.data.value.quality.coverage.shotCount }} 镜 ·
|
||||
{{ preflight.data.value.quality.preflightEligible ? '质量预检符合要求' : '质量预检有待处理项' }}
|
||||
</p>
|
||||
<p v-if="!preflight.data.value.current.valid" class="text-muted">
|
||||
请在制作准备中核对并人工确认正式分镜,之后可采用选中的摄影草案。
|
||||
</p>
|
||||
<NCollapse>
|
||||
<NCollapseItem name="audit" title="查看当前版本与质量诊断">
|
||||
<p class="wrap-anywhere text-xs">
|
||||
分镜版本:{{ preflight.data.value.current.evidence.shotFingerprint }}
|
||||
</p>
|
||||
<ul v-if="issues.length" class="mt-2 space-y-1 text-xs">
|
||||
<li v-for="issue in issues" :key="issue">{{ userFacingText(issue) }}</li>
|
||||
</ul>
|
||||
<p v-else class="mt-2 text-xs text-muted">当前预检未列出具体问题。</p>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</section>
|
||||
<p v-else-if="preflight.loading.value" role="status" class="text-sm text-muted">正在读取正式审核状态…</p>
|
||||
<NButton v-if="preflight.error.value" @click="preflight.refresh">重新读取审核状态</NButton>
|
||||
|
||||
<!-- 以下是受控摄影修订与场景沿用 -->
|
||||
<section v-if="formal" class="space-y-3 text-sm">
|
||||
<WorkspaceSectionHeading
|
||||
title="待审修改"
|
||||
description="可单独修订构图与机位,或填写所选场景的空缺即时状态。"
|
||||
/>
|
||||
<p v-if="formalQuery.loading.value" role="status" class="text-muted">正在读取正式摄影来源…</p>
|
||||
<NButton v-else-if="formalQuery.error.value" @click="formalQuery.refresh">重新读取正式来源</NButton>
|
||||
<template v-else-if="formalQuery.data.value">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<NButton :secondary="mode === 'camera'" :disabled="saving" @click="mode = 'camera'"
|
||||
>修订构图与机位</NButton
|
||||
>
|
||||
<NButton :secondary="mode === 'scene'" :disabled="saving" @click="mode = 'scene'"
|
||||
>沿用前镜场景状态</NButton
|
||||
>
|
||||
</div>
|
||||
<template v-if="mode === 'camera'">
|
||||
<label class="block"
|
||||
>构图<NInput v-model:value="composition" type="textarea" :disabled="saving" class="mt-1"
|
||||
/></label>
|
||||
<label class="block"
|
||||
>摄影机位置<NInput
|
||||
v-model:value="cameraPosition"
|
||||
type="textarea"
|
||||
:disabled="saving"
|
||||
class="mt-1"
|
||||
/></label>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p v-if="previousShot">
|
||||
前镜 {{ previousShot.beatNo }}.{{ previousShot.shotNo }} · {{ previousShot.title }}
|
||||
</p>
|
||||
<p v-if="continuity?.previousClosingState">
|
||||
前镜已确认尾态:{{ continuity.previousClosingState.text }}
|
||||
</p>
|
||||
<p v-if="!scenes.length" class="text-muted">没有可沿用的同形态场景状态。已有状态不会被覆盖。</p>
|
||||
<NSelect
|
||||
v-else
|
||||
v-model:value="selectedScene"
|
||||
placeholder="选择要沿用状态的场景"
|
||||
:disabled="saving"
|
||||
:options="
|
||||
scenes.map(item => ({
|
||||
label:
|
||||
formalQuery.data.value?.generation.subjects.find(
|
||||
subject => subject.subjectRef === item.subjectRef
|
||||
)?.subjectFormName || item.subjectRef,
|
||||
value: item.subjectRef
|
||||
}))
|
||||
"
|
||||
/>
|
||||
<dl v-if="scene" class="detail-grid">
|
||||
<dt>前镜即时状态</dt>
|
||||
<dd>{{ scene.previousStartState }}</dd>
|
||||
<dt>当前即时状态</dt>
|
||||
<dd>{{ scene.currentStartState || '尚未填写' }}</dd>
|
||||
<dt>待确认差异</dt>
|
||||
<dd>仅将前镜已记录的即时状态填入当前场景。请确认它适用于本镜开场。</dd>
|
||||
</dl>
|
||||
</template>
|
||||
</template>
|
||||
</section>
|
||||
<section v-else class="space-y-3">
|
||||
<WorkspaceSectionHeading
|
||||
title="导入待审摄影草案"
|
||||
description="粘贴为当前分镜版本准备的草案,再免费核对实际输入。"
|
||||
/>
|
||||
<NInput
|
||||
v-model:value="imported"
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
placeholder="粘贴草案内容"
|
||||
:disabled="saving"
|
||||
aria-label="待审摄影草案"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<!-- 以下是沿用项目模型目录的预览参数 -->
|
||||
<section v-if="configuration.data.value" class="space-y-4">
|
||||
<WorkspaceSectionHeading title="预览模型" />
|
||||
<GenerationModelControls
|
||||
type="image"
|
||||
:catalog="configuration.data.value.catalog"
|
||||
:aspect-ratio="configuration.data.value.profile.aspectRatio"
|
||||
v-model:provider="provider"
|
||||
v-model:options="options"
|
||||
:disabled="saving"
|
||||
/>
|
||||
</section>
|
||||
<NButton v-if="configuration.error.value" @click="configuration.refresh">重新读取模型配置</NButton>
|
||||
<NButton :loading="previewing" :disabled="!canPreview || saving || previewing" @click="loadPreview"
|
||||
>免费预览摄影草案</NButton
|
||||
>
|
||||
|
||||
<!-- 以下是已冻结的草案、场景几何依据及实际模型输入 -->
|
||||
<section v-if="reviewed && previewDisplay" class="space-y-4 text-sm">
|
||||
<WorkspaceSectionHeading
|
||||
title="待人工采用的预览"
|
||||
description="草案不能用于正式生成。采用后请重新预览正式首帧。"
|
||||
/>
|
||||
<NTag size="small" :bordered="false">{{
|
||||
reviewed.preview.productionGate.ready ? '项目制作已就绪' : '项目制作未就绪'
|
||||
}}</NTag>
|
||||
<p v-if="reviewed.preview.productionGate.reason" class="text-muted">
|
||||
{{ userFacingText(reviewed.preview.productionGate.reason) }}
|
||||
</p>
|
||||
<dl class="detail-grid">
|
||||
<dt>摄影</dt>
|
||||
<dd>
|
||||
{{ directionLabel(reviewed.selection.draft.direction.shotSize, 'shotSize') }} ·
|
||||
{{ directionLabel(reviewed.selection.draft.direction.cameraAngle, 'cameraAngle') }} ·
|
||||
{{ directionLabel(reviewed.selection.draft.direction.cameraMovement, 'cameraMovement') }}
|
||||
</dd>
|
||||
<dt>构图</dt>
|
||||
<dd>{{ reviewed.selection.draft.direction.composition }}</dd>
|
||||
<dt>机位</dt>
|
||||
<dd>{{ reviewed.selection.draft.direction.cameraPosition }}</dd>
|
||||
<dt>视觉意图</dt>
|
||||
<dd>{{ reviewed.selection.draft.direction.visualIntent }}</dd>
|
||||
<dt>环境</dt>
|
||||
<dd>
|
||||
{{
|
||||
Object.values(reviewed.selection.draft.visualState.environment)
|
||||
.filter(Boolean)
|
||||
.join(' · ') || '未指定'
|
||||
}}
|
||||
</dd>
|
||||
</dl>
|
||||
<NCollapse>
|
||||
<NCollapseItem name="visual" title="查看即时状态与场景几何依据">
|
||||
<p v-if="reviewed.selection.draft.visualState.continuityNote" class="mb-2">
|
||||
{{ reviewed.selection.draft.visualState.continuityNote }}
|
||||
</p>
|
||||
<ul class="space-y-2">
|
||||
<li
|
||||
v-for="subject in reviewed.selection.draft.visualState.subjects"
|
||||
:key="subject.subjectRef"
|
||||
>
|
||||
<strong>{{ subject.formName }} · {{ subject.subjectRef }}</strong>
|
||||
<p>
|
||||
{{
|
||||
[
|
||||
subject.expression,
|
||||
subject.pose,
|
||||
subject.gaze,
|
||||
subject.position,
|
||||
subject.transientState
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ') || '无即时变化'
|
||||
}}
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<ul v-if="reviewed.preview.sceneSources.length" class="mt-3 space-y-1 text-xs text-muted">
|
||||
<li
|
||||
v-for="source in reviewed.preview.sceneSources"
|
||||
:key="source.subjectRef + source.imageId"
|
||||
class="wrap-anywhere"
|
||||
>
|
||||
{{ source.subjectRef }} · 已确认几何版本 {{ source.spatialLayoutVersion }}
|
||||
</li>
|
||||
</ul>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
<p class="wrap-anywhere text-xs text-muted">草案指纹:{{ reviewed.preview.draftFingerprint }}</p>
|
||||
<KeyframePreviewChecks :preview="reviewed.preview" />
|
||||
<ImageGenerationPreview
|
||||
:preview="previewDisplay"
|
||||
:loading="false"
|
||||
error=""
|
||||
stale-notice=""
|
||||
display-only
|
||||
/>
|
||||
<NInput
|
||||
v-model:value="reviewer"
|
||||
:maxlength="120"
|
||||
:disabled="saving"
|
||||
placeholder="填写审核人"
|
||||
aria-label="审核人"
|
||||
/>
|
||||
<NCheckbox v-model:checked="acknowledged" :disabled="saving"
|
||||
>我已核对本镜草案和实际参考,确认采用。</NCheckbox
|
||||
>
|
||||
</section>
|
||||
</div>
|
||||
<template #footer>
|
||||
<NButton :disabled="saving" @click="open = false">关闭</NButton>
|
||||
<NButton
|
||||
v-if="reviewed"
|
||||
type="primary"
|
||||
:loading="saving"
|
||||
:disabled="disabled || !acknowledged || !reviewer.trim() || !preflight.data.value?.current.valid"
|
||||
@click="adopt"
|
||||
>正式采用本镜</NButton
|
||||
>
|
||||
</template>
|
||||
</AppDrawer>
|
||||
</template>
|
||||
@@ -0,0 +1,37 @@
|
||||
import { request } from '../../lib/http'
|
||||
import type {
|
||||
DerivedReviewSelection,
|
||||
DraftProviderInput,
|
||||
ShotDraftPreview,
|
||||
ShotReviewDraft
|
||||
} from './derived-review.types'
|
||||
|
||||
/** 已审摄影草案的正式读写入口。 */
|
||||
export const derivedReviewApi = {
|
||||
/**
|
||||
* 免费编译草案,不保存、不调用模型。
|
||||
* @param shotId 当前正式镜头
|
||||
* @param draft 待审草案
|
||||
* @param provider 选定的模型参数
|
||||
* @param signal 取消过期查询
|
||||
* @returns 对应草案指纹及实际模型输入
|
||||
*/
|
||||
preview: (shotId: string, draft: ShotReviewDraft, provider: DraftProviderInput, signal?: AbortSignal) =>
|
||||
request<ShotDraftPreview>(`/storyboard-shots/${encodeURIComponent(shotId)}/keyframe/preview`, {
|
||||
method: 'POST',
|
||||
body: { ...provider, draft },
|
||||
signal
|
||||
}),
|
||||
/**
|
||||
* 用户明确采用已经预览的镜头草案。
|
||||
* @param projectId 正式项目
|
||||
* @param reviewer 人工审核人
|
||||
* @param shots 本次选中的预览及原模型参数
|
||||
* @returns 已保存的正式镜头归属
|
||||
*/
|
||||
confirm: (projectId: string, reviewer: string, shots: DerivedReviewSelection[]) =>
|
||||
request<{ shots: Array<{ shotId: string }> }>(
|
||||
`/projects/${encodeURIComponent(projectId)}/storyboard-derived-reviews/confirm`,
|
||||
{ method: 'POST', body: { reviewer, shots } }
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import type { KeyframeSpec } from '../production/types'
|
||||
import type { ShotReviewDraft } from './derived-review.types'
|
||||
import type { DesignedShot } from './types'
|
||||
|
||||
/**
|
||||
* 从正式记录创建受控草案,保留原来的动作、形态及环境。
|
||||
* @param shot 已保存的摄影和即时状态
|
||||
* @param keyframe 当前正式首帧来源及参考
|
||||
* @param fingerprint 当前项目分镜版本
|
||||
* @returns 正式字段的可审副本
|
||||
*/
|
||||
export function draftFromFormal(shot: DesignedShot, keyframe: KeyframeSpec, fingerprint: string): ShotReviewDraft {
|
||||
const { direction, visualState, shotNo } = shot
|
||||
if (!direction || !visualState || keyframe.shotId !== shot.shotId || !keyframe.formalSourceFingerprint)
|
||||
throw new Error('当前镜头缺少有效的正式摄影或即时状态。')
|
||||
const sceneSources = keyframe.references
|
||||
.filter(item => item.role === 'layout-master' || item.role === 'scene-form-view')
|
||||
.map(item => {
|
||||
if (!item.spatialLayoutVersion) throw new Error('场景机位参考缺少当前几何依据。')
|
||||
return {
|
||||
subjectRef: item.subjectRef,
|
||||
imageId: item.imageId,
|
||||
spatialLayoutVersion: item.spatialLayoutVersion
|
||||
}
|
||||
})
|
||||
return {
|
||||
expectedShotFingerprint: fingerprint,
|
||||
direction: {
|
||||
shotNo,
|
||||
shotSize: direction.shotSize,
|
||||
cameraAngle: direction.cameraAngle,
|
||||
cameraMovement: direction.cameraMovement,
|
||||
composition: direction.composition,
|
||||
cameraPosition: direction.cameraPosition,
|
||||
lensIntent: direction.lensIntent,
|
||||
depthOfField: direction.depthOfField,
|
||||
visualIntent: direction.visualIntent
|
||||
},
|
||||
sceneSources,
|
||||
visualState: {
|
||||
shotNo,
|
||||
environment: {
|
||||
timeOfDay: visualState.timeOfDay,
|
||||
weather: visualState.weather,
|
||||
atmosphere: visualState.atmosphere,
|
||||
transientState: visualState.environmentTransientState
|
||||
},
|
||||
continuityNote: visualState.continuityNote,
|
||||
subjects: visualState.subjects.map(item => {
|
||||
if (!item.subjectFormId) throw new Error('主体缺少正式形态,不能修订摄影设计。')
|
||||
return {
|
||||
subjectRef: item.subjectRef,
|
||||
formId: item.subjectFormId,
|
||||
formName: item.formName,
|
||||
expression: item.expression,
|
||||
pose: item.pose,
|
||||
gaze: item.gaze,
|
||||
position: item.position,
|
||||
transientState: item.transientState
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import type { GenerateKeyframeInput, KeyframeGenerationPreview } from '../production/types'
|
||||
import type { ShotDirection } from './types'
|
||||
|
||||
/** 正式审核约束的摄影草案。 */
|
||||
export interface ShotReviewDraft {
|
||||
/** 当前正式分镜版本。 */
|
||||
expectedShotFingerprint: string
|
||||
/** 本镜摄影设计及镜头序号。 */
|
||||
direction: ShotDirection & { /** 段落内镜头序号。 */ shotNo: number }
|
||||
/** 本镜待确认的即时状态。 */
|
||||
visualState: {
|
||||
/** 段落内镜头序号。 */ shotNo: number
|
||||
/** 与镜头正式绑定一致的主体形态。 */
|
||||
subjects: Array<{
|
||||
/** 主体引用。 */ subjectRef: string
|
||||
/** 形态编号。 */ formId: string
|
||||
/** 形态名称。 */ formName: string
|
||||
/** 表情。 */ expression: string
|
||||
/** 姿态。 */ pose: string
|
||||
/** 视线。 */ gaze: string
|
||||
/** 位置。 */ position: string
|
||||
/** 即时变化。 */ transientState: string
|
||||
}>
|
||||
/** 环境即时状态。 */
|
||||
environment: {
|
||||
/** 时间。 */ timeOfDay: string
|
||||
/** 天气。 */ weather: string
|
||||
/** 氛围。 */ atmosphere: string
|
||||
/** 即时环境变化。 */ transientState: string
|
||||
}
|
||||
/** 衔接说明。 */ continuityNote: string
|
||||
}
|
||||
/** 已确认的场景机位参考和对应几何版本。 */
|
||||
sceneSources: Array<{
|
||||
/** 正式场景引用。 */ subjectRef: string
|
||||
/** 参考图编号。 */ imageId: string
|
||||
/** 几何版本。 */ spatialLayoutVersion: string
|
||||
}>
|
||||
/** 用户明确选择的前镜状态来源。 */
|
||||
sceneStateCarryForward?: {
|
||||
/** 同集紧邻前镜。 */ previousShotId: string
|
||||
/** 所选场景。 */ subjectRef: string
|
||||
}
|
||||
}
|
||||
|
||||
/** 原样传给免费预览和人工采用的可选模型参数。 */
|
||||
export type DraftProviderInput = Pick<GenerateKeyframeInput, 'provider' | 'generationOptions' | 'width' | 'height'>
|
||||
|
||||
/** 草案只有草案指纹,不能提交正式生图。 */
|
||||
export interface ShotDraftPreview extends Omit<KeyframeGenerationPreview, 'previewFingerprint'> {
|
||||
/** 本次草案的确切输入版本。 */ draftFingerprint: string
|
||||
/** 草案始终不能直接生成。 */ productionReady: false
|
||||
/** 项目级制作门禁。 */
|
||||
productionGate: { /** 项目是否就绪。 */ ready: boolean; /** 当前阻断原因。 */ reason: string | null }
|
||||
/** 实际审核的场景几何依据。 */ sceneSources: ShotReviewDraft['sceneSources']
|
||||
}
|
||||
|
||||
/** 每次人工采用一个或多个已预览镜头。 */
|
||||
export interface DerivedReviewSelection extends DraftProviderInput {
|
||||
/** 正式镜头编号。 */ shotId: string
|
||||
/** 用户核对过的草案。 */ draft: ShotReviewDraft
|
||||
/** 对应的免费预览指纹。 */ expectedDraftFingerprint: string
|
||||
/** 控制正式修订时必须携带的旧来源。 */ expectedCurrentFormalSourceFingerprint?: string
|
||||
}
|
||||
@@ -49,6 +49,8 @@ export interface ShotGenerationEnvironmentSpec {
|
||||
* 此结构只负责编译已有正式数据,不调用模型,也不重新解释剧情。
|
||||
*/
|
||||
export interface ShotGenerationSpec {
|
||||
/** 上一镜与当前镜头的正式连续性证据。 */
|
||||
continuity?: ShotContinuityEvidence | null
|
||||
projectId: string
|
||||
episodeNo: number
|
||||
beatNo: number
|
||||
@@ -63,3 +65,30 @@ export interface ShotGenerationSpec {
|
||||
environment: ShotGenerationEnvironmentSpec
|
||||
continuityNote: string
|
||||
}
|
||||
|
||||
/** 编译时读取的相邻镜头证据,首态与尾态分别记录。 */
|
||||
export interface ShotContinuityEvidence {
|
||||
/** 同集紧邻前镜。 */ previousShotId: string
|
||||
/** 是否共用场景。 */ sameScene: boolean
|
||||
/** 单独确认的前镜尾态。 */
|
||||
previousClosingState: {
|
||||
/** 动作修订编号。 */ revisionId: string
|
||||
/** 修订版本。 */ fingerprint: string
|
||||
/** 已确认尾态。 */ text: string
|
||||
} | null
|
||||
/** 可比较的主体状态。 */
|
||||
subjects: Array<{
|
||||
/** 主体引用。 */ subjectRef: string
|
||||
/** 主体分类。 */ module: string
|
||||
/** 前镜正式形态。 */ previousFormId: string | null
|
||||
/** 当前正式形态。 */ currentFormId: string
|
||||
/** 当前形态变化的依据。 */ formDecision: 'same_form' | 'confirmed_change' | 'bound_form' | 'needs_review'
|
||||
/** 前镜即时状态。 */ previousStartState: string | null
|
||||
/** 当前镜头即时状态。 */ currentStartState: string | null
|
||||
}>
|
||||
/** 等待人工核对的冲突。 */
|
||||
reviewIssues: Array<{
|
||||
/** 冲突类型。 */ code: 'character_form_transition_unconfirmed' | 'scene_state_transition_unconfirmed'
|
||||
/** 需要核对的主体。 */ subjectRef: string
|
||||
}>
|
||||
}
|
||||
@@ -148,16 +148,30 @@ export function useStoryboard() {
|
||||
const hasCurrentEpisodeShots = computed(
|
||||
() => Math.max(data.value?.directions.shotCount ?? 0, data.value?.visualStates.shotCount ?? 0) > 0
|
||||
)
|
||||
/** 旧的批量生成仍要求项目素材阶段完成,独立首帧使用逐镜头门禁。 */
|
||||
const projectAssetsReady = computed(
|
||||
() =>
|
||||
context.stageReadiness.value?.projectId === id.value &&
|
||||
context.stageReadiness.value.subjectAssets.ready === true
|
||||
)
|
||||
/** 批量操作继续使用原项目级前置条件。 */
|
||||
const allowed = computed<Record<StoryboardCommand, boolean>>(() => ({
|
||||
'shots-current': !blocked.value && episodeNo.value > 0 && hasCurrentEpisodeShots.value,
|
||||
'direction-all': approved.value && !blocked.value && prerequisites.value.directionProject && batchValid.value,
|
||||
'shots-current':
|
||||
projectAssetsReady.value && !blocked.value && episodeNo.value > 0 && hasCurrentEpisodeShots.value,
|
||||
'direction-all':
|
||||
projectAssetsReady.value &&
|
||||
approved.value &&
|
||||
!blocked.value &&
|
||||
prerequisites.value.directionProject &&
|
||||
batchValid.value,
|
||||
'visual-all':
|
||||
projectAssetsReady.value &&
|
||||
approved.value &&
|
||||
!blocked.value &&
|
||||
prerequisites.value.visualProject &&
|
||||
batchValid.value &&
|
||||
repairsValid.value,
|
||||
prompts: !blocked.value && shots.value.length > 0 && batchValid.value
|
||||
prompts: projectAssetsReady.value && !blocked.value && shots.value.length > 0 && batchValid.value
|
||||
}))
|
||||
|
||||
/** 正式后台任务观察器;重生成使用后端 breakdown 名称并通过 metadata 区分。 */
|
||||
@@ -268,6 +282,7 @@ export function useStoryboard() {
|
||||
source,
|
||||
episodeSourceUnavailable,
|
||||
prerequisites,
|
||||
projectAssetsReady,
|
||||
session,
|
||||
operation,
|
||||
concurrency,
|
||||
|
||||
@@ -24,11 +24,13 @@ export const subjectImagesApi = {
|
||||
/**
|
||||
* 显式准备道具结构规格,可能调用文字模型,不生成图片。
|
||||
* @param formId 正式形态编号
|
||||
* @param reuseOnly 是否仅复用已有正式结构,禁止调用模型
|
||||
* @returns 当前结构规格,页面随后重新读取正式准备状态
|
||||
*/
|
||||
prepareStructure: (formId: string) =>
|
||||
prepareStructure: (formId: string, reuseOnly = false) =>
|
||||
request<Record<string, unknown>>(`/subject-forms/${encodeURIComponent(formId)}/prop-structure-spec/generate`, {
|
||||
method: 'POST',
|
||||
body: { reuseOnly },
|
||||
timeoutMs: 0
|
||||
}),
|
||||
/** 生成并保存正式生图提示词;force 仅覆盖提示词,不生成或替换图片。 */
|
||||
|
||||
@@ -3,6 +3,10 @@ import { computed, ref } from 'vue'
|
||||
import { NButton, NCollapse, NCollapseItem, NTag } from 'naive-ui'
|
||||
import { AssetImage } from '../../../components/ui'
|
||||
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
|
||||
import { ApiError } from '../../../lib/http'
|
||||
import { getOperation, runOperation } from '../../workflows/operations'
|
||||
import { useActionMessage } from '../../../components/ui/useActionMessage'
|
||||
import { subjectImagesApi } from '../api'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { userFacingText } from '../../../lib/user-facing-text'
|
||||
import { subjectIdentityApi } from '../../subject-identity/api'
|
||||
@@ -43,6 +47,38 @@ const query = useQuery(key, async (value, signal) => {
|
||||
})
|
||||
/** 道具当前有效规格或独立的缺失、过期状态。 */
|
||||
const prop = computed(() => query.data.value?.prop)
|
||||
/** 复用中的局部按钮状态。 */
|
||||
const reusing = ref(false)
|
||||
/** 复用反馈只在消息层展示。 */
|
||||
const message = useActionMessage()
|
||||
|
||||
/** 仅复用已有结构;冲突保留当前数据,不调用生成入口。 */
|
||||
async function reuseStructure() {
|
||||
if (!prop.value || reusing.value || getOperation(props.projectId).pending) return
|
||||
const target = key.value
|
||||
const formId = props.form.id
|
||||
reusing.value = true
|
||||
try {
|
||||
const ok = await runOperation(props.projectId, '复用道具结构规格', async () => {
|
||||
try {
|
||||
await subjectImagesApi.prepareStructure(formId, true)
|
||||
} catch (cause) {
|
||||
if (cause instanceof ApiError && cause.status === 409)
|
||||
throw new Error('没有可直接复用的当前规格,已有资料未变更。', { cause })
|
||||
throw cause
|
||||
}
|
||||
})
|
||||
if (target !== key.value) return
|
||||
if (ok) {
|
||||
message?.success('已复用道具结构规格')
|
||||
await query.refresh()
|
||||
} else {
|
||||
message?.error(getOperation(props.projectId).error)
|
||||
}
|
||||
} finally {
|
||||
reusing.value = false
|
||||
}
|
||||
}
|
||||
/** 以原始部件顺序展示原始与当前数量。 */
|
||||
const parts = computed(
|
||||
() =>
|
||||
@@ -92,6 +128,18 @@ function episodeLabel(id: string) {
|
||||
<p v-if="prop.status === 'stale' || prop.reason" class="text-muted">
|
||||
{{ userFacingText(prop.reason, '请重新核对当前形态与剧本来源。') }}
|
||||
</p>
|
||||
<!-- 以下是免费复用操作,文字生成仍使用图片准备检查 -->
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<NButton
|
||||
size="small"
|
||||
:loading="reusing"
|
||||
:disabled="reusing || getOperation(projectId).pending"
|
||||
@click="reuseStructure"
|
||||
>
|
||||
免费复用已有规格
|
||||
</NButton>
|
||||
<span class="text-xs text-muted">需要新规格时,可在图片准备检查中另行确认文字模型费用。</span>
|
||||
</div>
|
||||
<p v-if="prop.spec" class="font-medium">{{ prop.spec.semanticClass }}</p>
|
||||
<ul v-if="parts.length" class="space-y-3">
|
||||
<li v-for="part in parts" :key="part.id">
|
||||
|
||||
@@ -17,6 +17,8 @@ const props = defineProps<{
|
||||
preview: ImageGenerationPreview | null
|
||||
/** 预览读取中。 */
|
||||
loading: boolean
|
||||
/** 只显示已取得的实际输入。 */
|
||||
displayOnly?: boolean
|
||||
/** 当前不能读取预览。 */
|
||||
disabled?: boolean
|
||||
/** 读取或提交错误。 */
|
||||
@@ -81,10 +83,12 @@ const omitted = computed(
|
||||
<!-- 以下是免费实际输入预览模块,参数调整后必须重新读取 -->
|
||||
<section class="min-w-0 space-y-4" aria-label="本次生成预览">
|
||||
<WorkspaceSectionHeading
|
||||
v-if="!displayOnly"
|
||||
title="本次生成预览"
|
||||
description="只检查已有描述、规格和参考图,不生成图片,也不自动补齐资料。"
|
||||
/>
|
||||
<NButton
|
||||
v-if="!displayOnly"
|
||||
class="workspace-action-button"
|
||||
:loading="loading"
|
||||
:disabled="disabled || loading"
|
||||
|
||||
@@ -3,6 +3,10 @@ const configurationErrorLabels: Record<string, string> = {
|
||||
CREATIVE_PROFILE_REQUIRED: '请先保存项目生成配置,再重新检查制作计划。',
|
||||
CANVAS_CHANGE_REQUIRES_REVALIDATION:
|
||||
'已有分镜,暂时不能直接修改作品画幅。需要先重新核对镜头设计和相关素材,当前配置未保存。',
|
||||
KEYFRAME_CANVAS_MISMATCH: '所选尺寸与项目交付画幅不符。请在当前模型目录选择与项目画幅一致的尺寸。',
|
||||
KEYFRAME_CANVAS_SIZE_UNAVAILABLE: '所选模型或尺寸不能用于当前项目画幅,请选择目录中与画幅一致的固定尺寸。',
|
||||
KEYFRAME_SOURCE_STALE: '镜头、正式设计或参考已变化,请刷新候选并重新预览。',
|
||||
SCENE_STATE_SOURCE_STALE: '前镜或当前场景状态已变化,请重新核对衔接后预览。',
|
||||
CREATIVE_PROFILE_ACTIVE_WORKFLOW: '项目仍有任务进行中,请等待任务结束后再保存生成配置。',
|
||||
GENERATION_CONFIG_CHANGE_REQUIRES_REVALIDATION:
|
||||
'已有首帧或视频,暂时不能直接修改相关模型或参数。需要先处理现有素材的更新关系,当前配置未保存。'
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
import { effectScope, ref } from 'vue'
|
||||
import { flushPromises } from '@vue/test-utils'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { submitKeyframeVision, useKeyframeVision } from '@/features/production/keyframe-vision'
|
||||
import type { KeyframeValidationHistoryItem } from '@/features/production/quality.types'
|
||||
|
||||
/** 使用隔离候选和会话状态模拟正式 HTTP。 */
|
||||
const shotId = 'vision-shot'
|
||||
const assetId = 'vision-candidate'
|
||||
const taskId = 'vision-task'
|
||||
const executionId = 'vision-run'
|
||||
let scope = effectScope()
|
||||
|
||||
afterEach(() => {
|
||||
scope.stop()
|
||||
scope = effectScope()
|
||||
sessionStorage.clear()
|
||||
})
|
||||
|
||||
/**
|
||||
* 模拟正式历史中的公开任务证据。
|
||||
* @param status 服务保存的状态
|
||||
* @param output 公开结果
|
||||
* @returns 审核历史
|
||||
*/
|
||||
function history(status: string, output: Record<string, unknown> = {}): KeyframeValidationHistoryItem {
|
||||
return {
|
||||
id: taskId,
|
||||
executionId,
|
||||
status,
|
||||
output,
|
||||
error: null,
|
||||
startedAt: null,
|
||||
finishedAt: null,
|
||||
createdAt: '2026-11-06',
|
||||
steps: [
|
||||
{ name: 'general', status: 'completed', providerRequestId: 'request-1', usage: { totalTokens: 42 } },
|
||||
{ name: 'gaze', status: 'received' }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回一个 HTTP Mock 响应。
|
||||
* @param data 公开数据
|
||||
* @param status HTTP 状态
|
||||
* @returns 可交给 fetch 的响应
|
||||
*/
|
||||
function response(data: unknown, status = 200) {
|
||||
return new Response(JSON.stringify({ data }), { status })
|
||||
}
|
||||
|
||||
/** 从新页面创建观察者,不触发任何 POST。 */
|
||||
function observe() {
|
||||
return scope.run(() => useKeyframeVision(ref(JSON.stringify([shotId, assetId]))))!
|
||||
}
|
||||
|
||||
describe('正式首帧 Vision 的费用与恢复边界', () => {
|
||||
it('202 只受理一次,刷新后从历史恢复分步状态与执行记录', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async (url, options) => {
|
||||
if (options?.method === 'POST')
|
||||
return response(
|
||||
{ shotId, keyframeId: assetId, validationTaskId: taskId, executionId, status: 'pending' },
|
||||
202
|
||||
)
|
||||
if (String(url).endsWith('/validations')) return response([history('running')])
|
||||
return response({ id: executionId, status: 'running' })
|
||||
})
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
expect(await submitKeyframeVision(shotId, assetId, ['门牌'], [])).toBeNull()
|
||||
const vision = observe()
|
||||
await flushPromises()
|
||||
expect(vision.state.value.active?.steps?.[0]?.usage?.totalTokens).toBe(42)
|
||||
expect(vision.execution.data.value?.id).toBe(executionId)
|
||||
expect(vision.blocked.value).toBe(true)
|
||||
await expect(submitKeyframeVision(shotId, assetId, ['门牌'], [history('running')])).rejects.toThrow('待核查')
|
||||
expect(fetcher.mock.calls.filter(([, options]) => options?.method === 'POST')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('200 复用真实结论,包括未通过的已完成结果', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>().mockResolvedValue(
|
||||
response({
|
||||
shotId,
|
||||
keyframeId: assetId,
|
||||
validationTaskId: taskId,
|
||||
passed: false,
|
||||
issues: [],
|
||||
summary: '视线未通过',
|
||||
subjects: [],
|
||||
subjectCountConsistent: true,
|
||||
unauthorizedText: { detected: false, texts: [] }
|
||||
})
|
||||
)
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
expect(await submitKeyframeVision(shotId, assetId, [], [])).toMatchObject({ passed: false })
|
||||
expect(fetcher).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('断线保留原提交并只读找回任务;未知费用不自动重试', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async (url, options) => {
|
||||
if (options?.method === 'POST') throw new TypeError('HTTP 断线')
|
||||
if (String(url).endsWith('/validations')) return response([history('failed', { recoveryRequired: true })])
|
||||
return response({ id: executionId, status: 'failed' })
|
||||
})
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
await expect(submitKeyframeVision(shotId, assetId, [], [])).rejects.toThrow('暂时无法连接服务')
|
||||
const vision = observe()
|
||||
await flushPromises()
|
||||
expect(vision.state.value.unknown?.id).toBe(taskId)
|
||||
expect(vision.blocked.value).toBe(true)
|
||||
await expect(
|
||||
submitKeyframeVision(shotId, assetId, [], [history('failed', { recoveryRequired: true })])
|
||||
).rejects.toThrow('已有审核或费用待核查')
|
||||
expect(fetcher.mock.calls.filter(([, options]) => options?.method === 'POST')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('有正式可继续结论时使用原文字显式提交,保留已完成步骤', async () => {
|
||||
let accepted = 0
|
||||
const saved = history('failed', { recoveryRequired: false, resumeAvailable: true })
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async (_url, options) => {
|
||||
if (options?.method === 'POST') {
|
||||
accepted++
|
||||
return response(
|
||||
{
|
||||
shotId,
|
||||
keyframeId: assetId,
|
||||
validationTaskId: taskId,
|
||||
executionId: accepted === 1 ? executionId : 'resume-execution',
|
||||
status: 'pending'
|
||||
},
|
||||
202
|
||||
)
|
||||
}
|
||||
return response([saved])
|
||||
})
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
await submitKeyframeVision(shotId, assetId, ['旧门牌'], [])
|
||||
const vision = observe()
|
||||
await flushPromises()
|
||||
expect(vision.resumeTexts.value).toEqual(['旧门牌'])
|
||||
expect(vision.state.value.resumable?.steps?.map(item => item.status)).toEqual(['completed', 'received'])
|
||||
await expect(submitKeyframeVision(shotId, assetId, ['新门牌'], [saved])).rejects.toThrow('原审核参数')
|
||||
expect(accepted).toBe(1)
|
||||
await submitKeyframeVision(shotId, assetId, ['旧门牌'], [saved])
|
||||
expect(accepted).toBe(2)
|
||||
expect(
|
||||
fetcher.mock.calls
|
||||
.filter(([, options]) => options?.method === 'POST')
|
||||
.map(([, options]) => JSON.parse(String(options?.body)))
|
||||
).toEqual([{ allowedTexts: ['旧门牌'] }, { allowedTexts: ['旧门牌'] }])
|
||||
})
|
||||
|
||||
it('409 活动审核只观察原编号,不能把当前表单参数当作原参数', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async (url, options) => {
|
||||
if (options?.method === 'POST')
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
message: 'KEYFRAME_VALIDATION_ACTIVE',
|
||||
details: { code: 'KEYFRAME_VALIDATION_ACTIVE', taskId, executionId }
|
||||
}),
|
||||
{ status: 409 }
|
||||
)
|
||||
if (String(url).endsWith('/validations')) return response([history('running')])
|
||||
return response({ id: executionId, status: 'running' })
|
||||
})
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
expect(await submitKeyframeVision(shotId, assetId, ['新文字'], [])).toBeNull()
|
||||
const vision = observe()
|
||||
await flushPromises()
|
||||
expect(vision.execution.data.value?.id).toBe(executionId)
|
||||
expect(vision.resumeTexts.value).toBeNull()
|
||||
expect(vision.blocked.value).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -70,6 +70,15 @@ function recoveryButton(label: string) {
|
||||
return [...document.querySelectorAll('button')].find(item => item.textContent?.trim() === label)!
|
||||
}
|
||||
|
||||
/**
|
||||
* 在实际弹窗中定位当前可操作的按钮。
|
||||
* @param label 完整按钮文字
|
||||
* @returns 对应按钮
|
||||
*/
|
||||
function dialogButton(label: string) {
|
||||
return [...document.querySelectorAll<HTMLButtonElement>('button')].find(item => item.textContent?.trim() === label)
|
||||
}
|
||||
|
||||
describe('精简公开资产回归', () => {
|
||||
it('无内部字段的视频可播放,晋升使用后端权限,会话通过不能授权', async () => {
|
||||
const projectId = 'public-video-contract'
|
||||
@@ -298,24 +307,35 @@ describe('精简公开资产回归', () => {
|
||||
const projectId = 'keyframe-promotion-contract'
|
||||
const primary = keyframeFixture()
|
||||
const candidate = keyframeFixture({ id: 'keyframe-2', isPrimary: false })
|
||||
let persistedQuality = 'unknown'
|
||||
const primaryRequests: string[] = []
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
vi.fn<typeof fetch>().mockImplementation(
|
||||
async url =>
|
||||
new Response(
|
||||
JSON.stringify({
|
||||
data: String(url).endsWith('/generation-models')
|
||||
? imageCatalog
|
||||
: String(url).endsWith('/creative-profile')
|
||||
? generationProfile(projectId)
|
||||
: String(url).endsWith('/keyframes')
|
||||
? [primary, candidate]
|
||||
: []
|
||||
})
|
||||
)
|
||||
)
|
||||
vi.fn<typeof fetch>().mockImplementation(async (url, options) => {
|
||||
if (options?.method === 'PUT') {
|
||||
primaryRequests.push(String(url))
|
||||
return new Response(JSON.stringify({ data: { ...candidate, isPrimary: true } }))
|
||||
}
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
data: String(url).endsWith('/generation-models')
|
||||
? imageCatalog
|
||||
: String(url).endsWith('/creative-profile')
|
||||
? generationProfile(projectId)
|
||||
: String(url).endsWith('/keyframes')
|
||||
? [primary, candidate]
|
||||
: String(url).endsWith('/quality-review')
|
||||
? {
|
||||
effectiveQualityStatus: String(url).includes(candidate.id)
|
||||
? persistedQuality
|
||||
: 'passed'
|
||||
}
|
||||
: []
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
const wrapper = mount(ShotProductionAssets, {
|
||||
let wrapper = mount(ShotProductionAssets, {
|
||||
attachTo: document.body,
|
||||
props: { projectId, shot, disabled: false }
|
||||
})
|
||||
@@ -365,7 +385,29 @@ describe('精简公开资产回归', () => {
|
||||
expect(sessionKeyframePassed(projectId, shot.shotId, candidate.id)).toBe(true)
|
||||
expect(
|
||||
[...document.querySelectorAll('button')].some(item => item.textContent?.includes('设为主首帧'))
|
||||
).toBe(true)
|
||||
).toBe(false)
|
||||
|
||||
wrapper.unmount()
|
||||
persistedQuality = 'passed'
|
||||
wrapper = mount(ShotProductionAssets, {
|
||||
attachTo: document.body,
|
||||
props: { projectId, shot, disabled: false }
|
||||
})
|
||||
await flushPromises()
|
||||
await wrapper
|
||||
.findAll('button')
|
||||
.find(item => item.text().includes('管理候选'))!
|
||||
.trigger('click')
|
||||
await flushPromises()
|
||||
const promote = dialogButton('设为主首帧')
|
||||
expect(promote).toBeDefined()
|
||||
promote?.click()
|
||||
await flushPromises()
|
||||
dialogButton('确认切换')?.click()
|
||||
await flushPromises()
|
||||
expect(primaryRequests).toEqual([
|
||||
'/api/storyboard-shots/' + shot.shotId + '/keyframes/' + candidate.id + '/primary'
|
||||
])
|
||||
} finally {
|
||||
wrapper.unmount()
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
wrapper = undefined
|
||||
document.body.innerHTML = ''
|
||||
sessionStorage.clear()
|
||||
vi.restoreAllMocks()
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
@@ -162,6 +163,10 @@ function server() {
|
||||
error: null
|
||||
}
|
||||
else if (path.endsWith('/checkpoints')) data = []
|
||||
else if (path.endsWith('/production/entry-readiness')) data = { ready: true }
|
||||
else if (path.endsWith('/validations')) data = []
|
||||
else if (path.endsWith('/quality-review'))
|
||||
data = { effectiveQualityStatus: 'unknown', qualityDecision: 'unknown', historicalGazePreview: [] }
|
||||
else if (path.includes('/readiness')) data = readiness
|
||||
else if (path.endsWith('/keyframes')) data = [keyframe]
|
||||
else if (path.endsWith('/videos')) data = [video]
|
||||
@@ -450,7 +455,7 @@ describe('质量面板渐进展示', () => {
|
||||
expect(validationButton().disabled).toBe(true)
|
||||
expect(document.body.textContent).toContain('更多参数与模型限制')
|
||||
expect(document.querySelector('[aria-label="额外允许的画面文字"]')).not.toBeNull()
|
||||
expect(data.fetcher).not.toHaveBeenCalled()
|
||||
expect(data.posts()).toHaveLength(0)
|
||||
wrapper.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
|
||||
await flushPromises()
|
||||
expect(validationButton().disabled).toBe(false)
|
||||
|
||||
@@ -487,7 +487,7 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
expect(wrapper!.find(`.n-menu a[href="/projects/${id}/subject-identity"]`).exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('部分身份未齐备时可以逐项准备形态资料,但不能提前进入镜头设计或生产', async () => {
|
||||
it('部分身份未齐备时允许核对已准备分镜,项目制作仍受限', async () => {
|
||||
const id = 'partial-asset-preparation'
|
||||
const state = readiness(id)
|
||||
state.identity = { ready: false, reason: '还有角色尚未确认选角' }
|
||||
@@ -499,7 +499,7 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
const { mounted } = await openProject(`/projects/${id}/subject-images`)
|
||||
expect(mounted).toHaveBeenCalledExactlyOnceWith('subject-images')
|
||||
expect(wrapper!.find(`.n-menu a[href="/projects/${id}/subject-images"]`).exists()).toBe(true)
|
||||
expect(wrapper!.find(`.n-menu a[href="/projects/${id}/storyboard"]`).exists()).toBe(false)
|
||||
expect(wrapper!.find(`.n-menu a[href="/projects/${id}/storyboard"]`).exists()).toBe(true)
|
||||
expect(wrapper!.find(`.n-menu a[href="/projects/${id}/production"]`).exists()).toBe(false)
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { derivedReviewApi } from '@/features/storyboard/derived-review-api'
|
||||
import { draftFromFormal } from '@/features/storyboard/derived-review'
|
||||
import { subjectImagesApi } from '@/features/subject-images/api'
|
||||
import type { DesignedShot } from '@/features/storyboard/types'
|
||||
import type { KeyframeSpec } from '@/features/production/types'
|
||||
|
||||
/** 已保存的正式镜头样本,保留空间、动作和形态值。 */
|
||||
const shot: DesignedShot = {
|
||||
shotId: 'shot/1',
|
||||
beatNo: 1,
|
||||
shotNo: 1,
|
||||
title: '开门',
|
||||
description: '角色站在门边',
|
||||
visualFocus: '手',
|
||||
direction: {
|
||||
shotSize: 'wide',
|
||||
cameraAngle: 'eye_level',
|
||||
cameraMovement: 'static',
|
||||
composition: '门在右侧',
|
||||
cameraPosition: '室内',
|
||||
lensIntent: 'wide',
|
||||
depthOfField: 'deep',
|
||||
visualIntent: '空间关系'
|
||||
},
|
||||
visualState: {
|
||||
timeOfDay: '午后',
|
||||
weather: '',
|
||||
atmosphere: '',
|
||||
environmentTransientState: '日光',
|
||||
continuityNote: '保持视角',
|
||||
subjects: [
|
||||
{
|
||||
subjectId: 'scene',
|
||||
subjectRef: '@SC0001',
|
||||
subjectFormId: 'scene-form',
|
||||
formName: '客厅',
|
||||
expression: '',
|
||||
pose: '',
|
||||
gaze: '',
|
||||
position: '画面右侧',
|
||||
transientState: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
/** 正式来源及已确认的场景几何。 */
|
||||
const keyframe: KeyframeSpec = {
|
||||
formalSourceFingerprint: 'a'.repeat(64),
|
||||
projectId: 'p/1',
|
||||
shotId: shot.shotId,
|
||||
episodeNo: 1,
|
||||
beatNo: 1,
|
||||
shotNo: 1,
|
||||
prompt: '正式描述',
|
||||
references: [
|
||||
{
|
||||
subjectId: 'scene',
|
||||
subjectRef: '@SC0001',
|
||||
module: 'scene',
|
||||
role: 'layout-master',
|
||||
imageId: 'master-1',
|
||||
imageUrl: '/storage/master.png',
|
||||
spatialLayoutVersion: 'geometry-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
describe('摄影草案与规格复用的正式契约', () => {
|
||||
it('受控修订只变更摄影字段,采用原预览和正式来源', async () => {
|
||||
const fingerprint = 'b'.repeat(64)
|
||||
const draft = draftFromFormal(shot, keyframe, fingerprint)
|
||||
const original = structuredClone(draft)
|
||||
draft.direction.composition = '保留原场景并移动构图'
|
||||
draft.direction.cameraPosition = '室内右侧'
|
||||
expect(draft.visualState).toEqual(original.visualState)
|
||||
expect(draft.sceneSources).toEqual([
|
||||
{ subjectRef: '@SC0001', imageId: 'master-1', spatialLayoutVersion: 'geometry-1' }
|
||||
])
|
||||
const mock = vi
|
||||
.fn<typeof fetch>()
|
||||
.mockResolvedValueOnce(
|
||||
new Response(
|
||||
JSON.stringify({ data: { draftFingerprint: 'draft-fingerprint', productionReady: false } })
|
||||
)
|
||||
)
|
||||
.mockResolvedValueOnce(new Response(JSON.stringify({ data: { shots: [{ shotId: shot.shotId }] } })))
|
||||
vi.stubGlobal('fetch', mock)
|
||||
const params = { provider: 'seedream', generationOptions: { size: '2048x2048' } }
|
||||
const preview = await derivedReviewApi.preview(shot.shotId, draft, params)
|
||||
expect(preview.productionReady).toBe(false)
|
||||
expect(mock).toHaveBeenCalledTimes(1)
|
||||
await derivedReviewApi.confirm('p/1', '人工', [
|
||||
{
|
||||
...params,
|
||||
shotId: shot.shotId,
|
||||
draft,
|
||||
expectedDraftFingerprint: preview.draftFingerprint,
|
||||
expectedCurrentFormalSourceFingerprint: keyframe.formalSourceFingerprint
|
||||
}
|
||||
])
|
||||
expect(mock.mock.calls.map(([url]) => url)).toEqual([
|
||||
'/api/storyboard-shots/shot%2F1/keyframe/preview',
|
||||
'/api/projects/p%2F1/storyboard-derived-reviews/confirm'
|
||||
])
|
||||
expect(JSON.parse(String(mock.mock.calls[1]![1]?.body)).shots[0]).toMatchObject({
|
||||
...params,
|
||||
draft,
|
||||
expectedCurrentFormalSourceFingerprint: keyframe.formalSourceFingerprint,
|
||||
expectedDraftFingerprint: 'draft-fingerprint'
|
||||
})
|
||||
})
|
||||
|
||||
it('场景沿用保留其它状态,只将选定的正式前镜证据交给免费预览', async () => {
|
||||
const draft = draftFromFormal(shot, keyframe, 'b'.repeat(64))
|
||||
draft.sceneStateCarryForward = { previousShotId: 'previous', subjectRef: '@SC0001' }
|
||||
draft.visualState.subjects[0]!.transientState = '门半开'
|
||||
const mock = vi
|
||||
.fn<typeof fetch>()
|
||||
.mockResolvedValue(new Response(JSON.stringify({ data: { productionReady: false } })))
|
||||
vi.stubGlobal('fetch', mock)
|
||||
await derivedReviewApi.preview(shot.shotId, draft, {})
|
||||
expect(JSON.parse(String(mock.mock.calls[0]![1]?.body)).draft).toMatchObject({
|
||||
sceneStateCarryForward: draft.sceneStateCarryForward,
|
||||
visualState: {
|
||||
subjects: [{ formId: 'scene-form', transientState: '门半开' }],
|
||||
environment: { transientState: '日光' }
|
||||
}
|
||||
})
|
||||
expect(shot.visualState?.subjects[0]?.transientState).toBe('')
|
||||
expect(mock).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('道具复用冲突只发送一次 reuseOnly,不回退文字模型', async () => {
|
||||
const mock = vi
|
||||
.fn<typeof fetch>()
|
||||
.mockResolvedValue(new Response(JSON.stringify({ message: '没有等价规格' }), { status: 409 }))
|
||||
vi.stubGlobal('fetch', mock)
|
||||
await expect(subjectImagesApi.prepareStructure('form/1', true)).rejects.toMatchObject({ status: 409 })
|
||||
expect(mock).toHaveBeenCalledTimes(1)
|
||||
expect(mock.mock.calls[0]![0]).toBe('/api/subject-forms/form%2F1/prop-structure-spec/generate')
|
||||
expect(JSON.parse(String(mock.mock.calls[0]![1]?.body))).toEqual({ reuseOnly: true })
|
||||
})
|
||||
})
|
||||
@@ -112,7 +112,7 @@ function stubFetch(fetcher: Mock<typeof fetch>) {
|
||||
let executionCount = 0
|
||||
fetcher.mockImplementation(async (url, init) => {
|
||||
const path = String(url)
|
||||
if (path.endsWith('/storyboard/quality-confirmation')) {
|
||||
if (path.endsWith('/storyboard-quality-confirmation')) {
|
||||
const current = preparationFixture(fixture.id)
|
||||
return jsonResponse({ ...current.approval, valid: true, confirmation: current.record })
|
||||
}
|
||||
@@ -1955,7 +1955,7 @@ describe('工作台页面交互', () => {
|
||||
fetcher.mock.calls.filter(
|
||||
([url, init]) =>
|
||||
(!init?.method || init.method === 'GET') &&
|
||||
!String(url).endsWith('/storyboard/quality-confirmation')
|
||||
!String(url).endsWith('/storyboard-quality-confirmation')
|
||||
)
|
||||
).toHaveLength(12)
|
||||
expect(fetcher.mock.calls.filter(([url]) => String(url).endsWith('/duration-budget'))).toHaveLength(2)
|
||||
@@ -2055,10 +2055,10 @@ describe('工作台页面交互', () => {
|
||||
expect(wrapper!.text()).not.toContain('第1集镜头1')
|
||||
/** 切换剧集只增加当前集查询,项目时长预算只在挂载时读取一次。 */
|
||||
expect(
|
||||
fetcher.mock.calls.filter(([url]) => !String(url).endsWith('/storyboard/quality-confirmation'))
|
||||
fetcher.mock.calls.filter(([url]) => !String(url).endsWith('/storyboard-quality-confirmation'))
|
||||
).toHaveLength(6)
|
||||
expect(
|
||||
fetcher.mock.calls.filter(([url]) => String(url).endsWith('/storyboard/quality-confirmation'))
|
||||
fetcher.mock.calls.filter(([url]) => String(url).endsWith('/storyboard-quality-confirmation'))
|
||||
).toHaveLength(1)
|
||||
expect(fetcher.mock.calls.filter(([url]) => String(url).endsWith('/duration-budget'))).toHaveLength(1)
|
||||
expect(fetcher.mock.calls.every(([, init]) => !init?.method || init.method === 'GET')).toBe(true)
|
||||
|
||||
Reference in new issue
Block a user