feat: 同步动作与首帧编辑能力并统一工作区反馈

接入动作时间轴、密度审计、人工视线目标和后台首帧编辑;独立读取已保存提示词,并在首帧晋升前重新核对持久化质量状态。
统一 NMessage 结果反馈、局部 loading 和业务说明间距,保留真实长任务进度与部分失败语义。
验证:pnpm check(49 个文件、393 项测试)、pnpm build;当前环境无法完成 localhost 浏览器验收及真实后端联调。
This commit is contained in:
GouJ committed 2026-10-12 20:05:03 +08:00
1 parent 83482a70c5
commit 7a60db3ced
76 files changed
+2485 -457

No files matched your search

+40 -33
View File
@@ -1,20 +1,14 @@
<script setup lang="ts">
import { isOperationRunning } from '../workflows/operations'
import ContextNotice from '../../components/ui/ContextNotice.vue'
import AppForm from '../../components/ui/AppForm.vue'
import { NFormItem } from 'naive-ui'
import { integerRule, sizeRules } from '../../lib/form-rules'
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
import {
NScrollbar,
NAlert,
NButton,
NCheckbox,
NInputNumber,
NProgress,
NSelect,
NCollapse,
NCollapseItem
} from 'naive-ui'
import { NScrollbar, NButton, NCheckbox, NInputNumber, NProgress, NSelect, NCollapse, NCollapseItem } from 'naive-ui'
import { computed, inject, ref, watch } from 'vue'
import { ArrowLeft, CheckCircle2, CircleAlert, Film, Image, MessageSquareText } from '@lucide/vue'
import { EmptyState, StatusBadge } from '../../components/ui'
@@ -300,6 +294,8 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</NButton>
<WorkspaceTools
:pending="operation.pending"
:pending-label="operation.label"
v-model:open="toolsOpen"
title="项目生产总览与批量操作"
label="批量生产"
@@ -361,38 +357,38 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
<section class="workspace-overview-panel production-tool-section workspace-panel">
<div class="overview-content workspace-section-stack">
<h3 class="text-sm font-semibold">项目生产总览与批量操作</h3>
<NAlert v-if="videoRunning" role="status" type="info" :show-icon="false">
<ContextNotice v-if="videoRunning" role="status" type="info" :show-icon="false">
当前有
{{ videoRunning }}
个视频任务等待或生成中。系统会持续更新任务状态,同一镜头不会重复提交。
</NAlert>
<NAlert v-if="identityBlocked" type="info" :show-icon="false">
</ContextNotice>
<ContextNotice v-if="identityBlocked" type="info" :show-icon="false">
当前有
{{ identityBlocked }}
项角色身份尚未准备完成。请先确认角色母版并完成身份锁定,再生成镜头首帧。
<RouterLink :to="`/projects/${id}/subject-identity`" class="text-button ml-2"
>前往主体身份 →</RouterLink
></NAlert
></ContextNotice
>
<NAlert v-if="invalidGenerationSpecs" type="warning" :show-icon="false">
<ContextNotice v-if="invalidGenerationSpecs" type="warning" :show-icon="false">
当前有
{{ invalidGenerationSpecs }}
个镜头的设计信息还不完整。请先补齐镜头设计和即时视觉状态。
<RouterLink :to="`/projects/${id}/storyboard`" class="text-button ml-2">
前往分镜设计 →
</RouterLink>
</NAlert>
<NAlert v-if="staleKeyframes" role="status" type="info" :show-icon="false">
</ContextNotice>
<ContextNotice v-if="staleKeyframes" role="status" type="info" :show-icon="false">
当前有
{{ staleKeyframes }}
个主首帧已过期。它们使用的主体参考资产已经变化,视频阶段会被阻止;可在下方逐镜重新生成,或使用“补齐
/ 更新主首帧”批量处理。
</NAlert>
<NAlert v-if="staleVideos" role="status" type="info" :show-icon="false">
</ContextNotice>
<ContextNotice v-if="staleVideos" role="status" type="info" :show-icon="false">
当前有
{{ staleVideos }}
个主视频已过期。它们使用的主首帧或主体参考图已经变化;非覆盖模式批量生成时会只重建这些过期主视频。
</NAlert>
</ContextNotice>
<ProductionReceipt v-if="session.receipt" :receipt="session.receipt" />
<WorkflowExecutionPanel
v-if="promptExecution.executionId.value"
@@ -490,6 +486,16 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
{{ query.data.value?.keyframes.identityUnlocked ?? 0 }}
</p>
<ConfirmAction
:loading="
stage.key === 'prompts'
? promptExecution.active.value ||
isOperationRunning(operation, '项目视频提示词')
: stage.key === 'keyframes'
? keyframeExecution.active.value ||
isOperationRunning(operation, '首帧')
: videoExecution.active.value ||
isOperationRunning(operation, '视频')
"
:label="stage.action"
:disabled="
blocked ||
@@ -586,14 +592,14 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
<strong>{{ inputPlan?.omniReferenceCount ?? 0 }}</strong>
</div>
</div>
<NAlert
<ContextNotice
v-if="query.data.value?.videoInputPlansError"
type="warning"
:show-icon="false"
class="text-xs"
>
输入规划暂不可用,仍可按“全部推荐模式”提交;刷新后可重试规划。
</NAlert>
</ContextNotice>
<NFormItem path="videoInputMode" label="输入规划范围">
<NSelect
v-model:value="videoInputMode"
@@ -645,6 +651,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</p>
</div>
<ConfirmAction
:loading="isOperationRunning(operation, '重试失败视频任务')"
label="重试失败视频"
:disabled="
blocked || !batchValid || !query.data.value.videoStatus.failed
@@ -706,13 +713,13 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
@dismiss="keyframeQualityExecution.dismiss"
/>
<!-- 以下是重生成后正文缺省的真实数据说明模块 -->
<NAlert v-if="episodeSourceUnavailable" type="info" :show-icon="false">
<ContextNotice v-if="episodeSourceUnavailable" type="info" :show-icon="false">
本集镜头已重新生成。新标题和剧情详情尚未提供,当前只显示正式镜头编号;请按实际生成规格核对内容。
</NAlert>
</ContextNotice>
<NScrollbar v-if="query.error.value" class="workspace-feedback"
><NAlert role="alert" type="error" :show-icon="false"
><ContextNotice role="alert" type="error" :show-icon="false"
>{{ query.error.value
}}<span v-if="query.data.value"> 当前保留上次读取的数据,生产操作已暂停。</span></NAlert
}}<span v-if="query.data.value"> 当前保留上次读取的数据,生产操作已暂停。</span></ContextNotice
></NScrollbar
>
<!-- 以下是需要处理的项目状态摘要模块,数量为零的项目不占空间 -->
@@ -785,8 +792,8 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
<article class="production-detail min-w-0">
<NScrollbar v-if="shot" class="panel-scroll" content-class="shot-detail-content p-5 lg:p-7">
<header class="mb-5 pb-5">
<NAlert v-if="linkedShotMissing" type="warning" :show-icon="false" class="mb-4"
>链接中的镜头已不存在或不属于该剧集,请在左侧重新选择。</NAlert
<ContextNotice v-if="linkedShotMissing" type="warning" :show-icon="false" class="mb-4"
>链接中的镜头已不存在或不属于该剧集,请在左侧重新选择。</ContextNotice
>
<!-- 以下是镜头编号与最近视频任务状态模块,分别对齐左右边缘 -->
<div class="flex flex-wrap items-center justify-between gap-3">
@@ -815,7 +822,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</div>
</div>
<p v-if="shot.description" class="mt-3 text-sm leading-7">{{ shot.description }}</p>
<NAlert
<ContextNotice
v-if="videoStatusItem?.status === 'failed'"
type="error"
:show-icon="false"
@@ -826,7 +833,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
此失败不支持普通重试,请先处理失败原因。
</p>
<p v-else-if="videoStatusItem.retryable === true" class="mt-2">此任务可以重试。</p>
</NAlert>
</ContextNotice>
<NCollapse v-if="selectedKeyframeStale" class="mt-3">
<NCollapseItem title="首帧需要更新 · 查看相关素材" name="stale-keyframe">
<StaleKeyframeNotice
@@ -841,7 +848,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
/>
</NCollapseItem>
</NCollapse>
<NAlert
<ContextNotice
v-if="videoItem?.primaryVideoStale"
role="status"
type="info"
@@ -849,7 +856,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
class="mt-4 text-xs"
>
主视频已过期:当前主首帧或主体参考图与生成该视频时不一致。旧视频仍保留,但需要重新生成后才能作为当前有效成片。
</NAlert>
</ContextNotice>
</header>
<ShotProductionAssets
ref="shotAssetsRef"
@@ -1,5 +1,9 @@
<script setup lang="ts">
import { NAlert, NButton, NCheckbox, NCollapse, NCollapseItem, NInputNumber, NSelect } from 'naive-ui'
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInputNumber, NSelect } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import ConfirmAction from '../../workflows/ConfirmAction.vue'
import { downloadText, formatDate } from '../../../lib/format'
@@ -71,8 +75,8 @@ const confirmationDescription = computed(
<template>
<NCollapse v-model:expanded-names="expanded" class="production-tool-section"
><NCollapseItem name="advanced" title="高级:串联生产(全项目)">
<NAlert type="warning" :show-icon="false"
>依次补齐形态提示词、参考图、首帧质量校验与修复、视频提示词,再提交视频任务。视觉风格、身份母版、导演设计和即时状态仍需提前准备。</NAlert
<ContextNotice type="warning" :show-icon="false"
>依次补齐形态提示词、参考图、首帧质量校验与修复、视频提示词,再提交视频任务。视觉风格、身份母版、导演设计和即时状态仍需提前准备。</ContextNotice
>
<p class="mt-3 text-xs leading-6 text-muted">
范围固定为全项目并跳过已有有效结果。默认开启测试安全模式:允许 LLM、Vision、主体图、少量首帧和 Video
@@ -118,10 +122,12 @@ const confirmationDescription = computed(
>视频候选镜头上限<NInputNumber v-model:value="videoLimit" :min="1" :step="1" :precision="0"
/></label>
</div>
<NAlert v-if="scopeError" type="error" :show-icon="false" class="mt-3">{{ scopeError }}</NAlert>
<NAlert v-if="!safeMode && !stopAfter" type="warning" :show-icon="false" class="mt-3">
<ContextNotice v-if="scopeError" type="error" :show-icon="false" class="mt-3">{{
scopeError
}}</ContextNotice>
<ContextNotice v-if="!safeMode && !stopAfter" type="warning" :show-icon="false" class="mt-3">
已关闭测试安全模式。启动后会进入视频任务提交阶段并产生较高视频生成费用。
</NAlert>
</ContextNotice>
</div>
<!-- 以下是无消耗预检与费用确认模块。 -->
<div class="mt-4 flex flex-wrap items-center gap-3">
@@ -151,13 +157,13 @@ const confirmationDescription = computed(
<summary>失败任务结果详情</summary>
<pre class="mt-2 whitespace-pre-wrap break-all">{{ JSON.stringify(failedResult, null, 2) }}</pre>
</details>
<NAlert v-if="error" type="error" class="mt-3" :show-icon="false">{{ error }}</NAlert>
<NAlert
<FeedbackMessage v-if="error" :message="error" />
<ContextNotice
v-if="operation.label === '高级串联生产' && operation.error"
type="error"
class="mt-3"
:show-icon="false"
>{{ operation.error }}</NAlert
>{{ operation.error }}</ContextNotice
>
<div v-if="check" class="surface-inset mt-3 p-4">
<p class="text-xs text-muted">{{ formatDate(check.checkedAt) }} · 检查 {{ check.shotCount }} 镜</p>
@@ -221,13 +227,13 @@ const confirmationDescription = computed(
{{ receipt.videoGenerationResult.failed }}</template
><template v-else>未执行或未返回</template>
</p>
<NAlert
<ContextNotice
v-if="receipt.stopReason || receipt.errors.length"
type="warning"
:show-icon="false"
class="mt-3"
><p>{{ receipt.stopReason }}</p>
<p v-for="(item, index) in receipt.errors" :key="index" class="mt-2">{{ item }}</p></NAlert
<p v-for="(item, index) in receipt.errors" :key="index" class="mt-2">{{ item }}</p></ContextNotice
>
</section>
</NCollapseItem></NCollapse
@@ -1,6 +1,8 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import { onScopeDispose, ref, watch } from 'vue'
import { NAlert, NButton, NCollapse, NCollapseItem, NProgress, NSpin } from 'naive-ui'
import { NButton, NCollapse, NCollapseItem, NProgress, NSpin } from 'naive-ui'
import { mediaAssetUrl } from '../../../lib/assets'
import { errorMessage } from '../../../lib/http'
import { productionApi } from '../api'
@@ -69,7 +71,7 @@ onScopeDispose(() => controller?.abort())
</p>
<NButton size="small" :disabled="loading" @click="refresh">刷新就绪状态</NButton>
</div>
<NAlert v-if="error" type="error" :show-icon="false" class="mt-3">{{ error }}</NAlert>
<FeedbackMessage v-if="error" :message="error" />
<p v-if="readiness" class="mt-3 text-xs">
已就绪 {{ readiness.ready }}/{{ readiness.total }} 集 · 阻塞 {{ readiness.blocked }} 集
</p>
@@ -1,10 +1,12 @@
<script setup lang="ts">
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import IssueHint from '../../../components/ui/IssueHint.vue'
import { productionMessage } from '../production-messages'
import { computed } from 'vue'
import { useQuery } from '../../../composables/useQuery'
import { qualityApi } from '../quality-api'
import { NAlert, NButton, NTag } from 'naive-ui'
import { NButton, NTag } from 'naive-ui'
import { AssetImage, AssetOpenLink, StatusBadge } from '../../../components/ui'
import { formatDate } from '../../../lib/format'
import { productionStatusLabel } from '../model'
@@ -19,10 +21,12 @@ const props = defineProps<{
shotNo: number
stale: boolean
blocked: boolean
/** 只在当前源图编辑任务运行期间显示局部加载。 */
editing?: boolean
validationPassed: boolean | null
confirming: boolean
}>()
const emit = defineEmits<{ quality: []; select: []; confirm: []; cancel: []; history: [] }>()
const emit = defineEmits<{ quality: []; edit: []; select: []; confirm: []; cancel: []; history: [] }>()
/** 质量状态以数据库为准;会话内检查仅在历史状态未知时兜底。 */
const reviewKey = computed(() =>
props.item.status === 'completed' ? JSON.stringify([props.shotId, props.item.id, props.reviewRevision ?? 0]) : ''
@@ -96,6 +100,15 @@ const canSelect = computed(
<NButton text size="small" @click="emit('quality')">
{{ validationPassed === null ? '质量检查' : '重新检查' }}
</NButton>
<NButton
v-if="item.source !== 'provider_variant'"
text
size="small"
:disabled="blocked"
:loading="editing"
@click="emit('edit')"
>编辑此首帧</NButton
>
<NButton v-if="item.status === 'completed'" text size="small" @click="emit('history')"
>查看首帧校验历史</NButton
>
@@ -103,13 +116,13 @@ const canSelect = computed(
设为主首帧
</NButton>
</div>
<NAlert v-if="confirming" type="info" :show-icon="false" class="mt-2 text-xs">
<p>该候选已通过本次质量检查。确认让后续视频使用此首帧?</p>
<ContextNotice v-if="confirming" 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 text size="small" @click="emit('cancel')">取消</NButton>
</div>
</NAlert>
</ContextNotice>
</div>
</article>
</template>
@@ -1,6 +1,10 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import AppForm from '../../../components/ui/AppForm.vue'
import { NAlert, NButton, NCheckbox, NCollapse, NCollapseItem, NTag } from 'naive-ui'
import { NButton, NCheckbox, NCollapse, NCollapseItem, NTag } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { generationConfigApi } from '../../generation-config/api'
import type {
@@ -119,9 +123,9 @@ async function loadPreview() {
validate-on-change
@submit="submit"
>
<NAlert v-if="replacePrimary" type="info" :show-icon="false" class="mt-5 text-xs">
<ContextNotice v-if="replacePrimary" type="info" :show-icon="false" class="mt-5 text-xs">
当前主首帧使用的主体参考资产已经变化。新图成功后应设为主首帧,旧图会继续保留为历史候选。
</NAlert>
</ContextNotice>
<section v-if="generationCatalog" class="dialog-section mt-5" aria-label="本次首帧生成模型设置">
<p class="text-xs font-medium">
<FieldLabel
@@ -141,14 +145,14 @@ async function loadPreview() {
@update:options="imageGenerationOptions = $event"
/>
</section>
<NAlert v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-5 text-xs">
<ContextNotice v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-5 text-xs">
生成模型目录读取失败:{{ generationCatalogError }}
</NAlert>
</ContextNotice>
<div class="mt-5 flex flex-wrap items-center gap-3">
<NButton :loading="previewPending" @click="loadPreview">预览实际生成输入</NButton>
<span class="text-xs text-muted">只读取参考图规划与最终 Prompt,不调用图片模型。</span>
</div>
<NAlert v-if="previewError" type="error" :show-icon="false" class="mt-3">{{ previewError }}</NAlert>
<FeedbackMessage v-if="previewError" :message="previewError" />
<div v-if="preview" class="panel mt-3 p-4 text-xs leading-6">
<div class="flex flex-wrap items-center gap-2">
<strong>{{ preview.provider }} / {{ preview.model }}</strong>
@@ -0,0 +1,361 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { NButton, NCheckbox, NInput, NSelect } from 'naive-ui'
import { AppDialog, AssetImage } from '../../../components/ui'
import IssueHint from '../../../components/ui/IssueHint.vue'
import { useQuery } from '../../../composables/useQuery'
import { useFeedbackMessage } from '../../../composables/useFeedbackMessage'
import { errorMessage } from '../../../lib/http'
import { getOperation, runOperation } from '../../workflows/operations'
import { useWorkflowExecution } from '../../workflows/execution'
import { generationConfigApi } from '../../generation-config/api'
import type { GenerationOptions } from '../../generation-config/types'
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
import { spatialApi } from '../../storyboard/spatial-api'
import {
keyframeEditApi,
type KeyframeEditInput,
type KeyframeEditPreview,
type RelativeGazeGeometry
} from '../keyframe-edit-api'
import { productionApi } from '../api'
import type { ShotKeyframe } from '../types'
/** 编辑明确指定的源图;关闭弹窗后后台任务继续由页面观察。 */
const props = defineProps<{ projectId: string; shotId: string; source: ShotKeyframe | null; disabled: boolean }>()
const open = defineModel<boolean>('open', { default: false })
const emit = defineEmits<{ started: [executionId: string] }>()
const execution = useWorkflowExecution(
computed(() => props.projectId),
'keyframe-quality'
)
/** 草稿与来源、模型和参数共同构成预览身份,变化时撤销旧确认。 */
const instruction = ref('')
const editMode = ref<KeyframeEditInput['editMode']>('subject_only')
const allowBackground = ref(false)
const confirmed = ref(false)
const provider = ref('')
const options = ref<GenerationOptions>({})
const geometry = ref<RelativeGazeGeometry[]>([])
const preview = ref<KeyframeEditPreview | null>(null)
const previewError = ref('')
const previewLoading = ref(false)
useFeedbackMessage(previewError)
/** 只有打开当前有效源图时才读取配置和已有绑定。 */
const sourceKey = computed(() =>
open.value && props.source ? JSON.stringify([props.projectId, props.shotId, props.source.id]) : ''
)
const modelQuery = useQuery(sourceKey, async (key, signal) => {
if (!key) return null
const [projectId, shotId] = JSON.parse(key) as [string, string, string]
const [catalog, profile, bindings] = await Promise.all([
generationConfigApi.catalog(signal),
generationConfigApi.profile(projectId, signal),
spatialApi.bindings(shotId, signal)
])
return { catalog, profile, bindings }
})
watch(sourceKey, () => {
instruction.value = ''
editMode.value = 'subject_only'
allowBackground.value = false
confirmed.value = false
geometry.value = []
geometryBinding.value = null
preview.value = null
previewError.value = ''
previewLoading.value = false
})
watch(
() => modelQuery.data.value,
data => {
if (!data) return
provider.value = data.profile?.imageProvider || data.catalog.defaults.imageProvider
const selected = data.catalog.images.find(item => item.provider === provider.value)
options.value = { ...selected?.defaults, ...data.profile?.imageOptions }
}
)
/** 已保存人工目标作为几何选择来源;不自动填写高低方向。 */
const bindingOptions = computed(() =>
(modelQuery.data.value?.bindings ?? [])
.filter(item => item.visibility === 'in_frame')
.map((item, index) => ({ label: `${item.subjectRef} → ${item.targetDescription}`, value: index }))
)
const geometryBinding = ref<number | null>(null)
/**
* 添加一个已保存目标的人工几何观察。
* @returns 未选择明确绑定时不创建记录
*/
function addGeometry() {
if (geometryBinding.value === null) return
const binding = (modelQuery.data.value?.bindings ?? []).filter(item => item.visibility === 'in_frame')[
geometryBinding.value
]
if (
!binding ||
geometry.value.some(
item => item.subjectRef === binding.subjectRef && item.targetDescription === binding.targetDescription
)
)
return
geometry.value.push({
subjectRef: binding.subjectRef,
targetDescription: binding.targetDescription,
horizontal: 'unknown',
vertical: 'unknown',
source: 'manual'
})
}
/** 预览与提交都使用当前人工配置,不拼接 Provider 指令。 */
const input = computed<KeyframeEditInput>(() => ({
editInstruction: instruction.value.trim(),
editMode: editMode.value,
...(editMode.value === 'composition_assisted'
? { allowBackgroundDeemphasis: allowBackground.value, relativeGazeGeometry: geometry.value }
: {}),
provider: provider.value || undefined,
generationOptions: options.value
}))
const inputKey = computed(() => JSON.stringify([sourceKey.value, input.value]))
watch(inputKey, () => {
preview.value = null
previewError.value = ''
confirmed.value = false
previewLoading.value = false
})
const requestLoading = computed(() => {
const operation = getOperation(props.projectId)
return operation.pending && operation.label === `编辑镜头 ${props.shotId} 首帧`
})
const valid = computed(
() =>
!!instruction.value.trim() &&
!!modelQuery.data.value &&
!modelQuery.error.value &&
(editMode.value !== 'composition_assisted' || allowBackground.value)
)
/** 只读编辑预览,切换源图或参数后忽略旧结果。 */
async function inspect() {
if (!valid.value || previewLoading.value || !props.source) return
const version = inputKey.value
const shotId = props.shotId
const sourceId = props.source.id
previewLoading.value = true
previewError.value = ''
try {
const result = await keyframeEditApi.preview(shotId, sourceId, input.value)
if (version !== inputKey.value || !open.value) return
if (result.shotId !== shotId || result.sourceKeyframeId !== sourceId)
throw new Error('编辑预览与当前源图不匹配。')
preview.value = result
} catch (cause) {
if (version === inputKey.value && open.value) previewError.value = errorMessage(cause)
} finally {
if (version === inputKey.value) previewLoading.value = false
}
}
/** 重新核对源图并提交一次,后台句柄按原项目保存。 */
async function submit() {
if (props.disabled || !valid.value || !preview.value || !confirmed.value || !props.source || requestLoading.value)
return
const projectId = props.projectId
const shotId = props.shotId
const source = { ...props.source }
const body: KeyframeEditInput = JSON.parse(JSON.stringify(input.value))
const version = inputKey.value
const ok = await runOperation(
projectId,
`编辑镜头 ${shotId} 首帧`,
async () => {
const records = await productionApi.listKeyframes(shotId)
const current = records.find(item => item.id === source.id && item.shotId === shotId)
if (
!current ||
current.status !== 'completed' ||
!current.imageUrl ||
current.source === 'provider_variant' ||
current.isPrimary !== source.isPrimary
)
throw new Error('编辑源图或主首帧状态已变化,请刷新后重新预览并确认。')
if (version !== inputKey.value || !open.value) throw new Error('编辑配置已变化,请重新预览。')
const started = await keyframeEditApi.start(shotId, source.id, body)
if (started.projectId !== projectId || started.shotId !== shotId || started.sourceKeyframeId !== source.id)
throw new Error('后台编辑任务归属不匹配,请刷新状态,勿重复提交。')
await execution.track(started.executionId, projectId)
if (props.projectId === projectId) emit('started', started.executionId)
},
{ content: '首帧编辑已在后台开始,结果会显示在当前镜头。', type: 'info' }
)
if (ok && version === inputKey.value) open.value = false
}
</script>
<template>
<AppDialog v-model:open="open" title="编辑首帧候选" :busy="requestLoading" wide>
<div v-if="source" class="keyframe-edit-layout">
<div>
<AssetImage :src="source.imageUrl" alt="本次首帧编辑源图" preview />
<p class="mt-2 text-xs text-muted">
{{
source.isPrimary
? '编辑主首帧:后台会自动校验,通过后尝试晋升新图。'
: '编辑历史候选:仅生成新候选,之后需另行质量检查。'
}}
</p>
</div>
<div class="space-y-4 min-w-0">
<label class="block text-xs"
>修改要求<NInput
v-model:value="instruction"
type="textarea"
class="mt-2"
:autosize="{ minRows: 4, maxRows: 8 }"
placeholder="描述需要修改的姿态、视线或局部细节"
:disabled="requestLoading"
/></label>
<label class="block text-xs"
>编辑范围<NSelect
v-model:value="editMode"
class="mt-2"
:options="[
{ label: '主体局部调整', value: 'subject_only' },
{ label: '构图协同调整', value: 'composition_assisted' }
]"
:disabled="requestLoading"
/></label>
<NCheckbox
v-if="editMode === 'composition_assisted'"
v-model:checked="allowBackground"
:disabled="requestLoading"
>我确认允许弱化非关键背景干扰,保留固定目标及已确认主体。</NCheckbox
>
<GenerationModelControls
v-if="modelQuery.data.value"
type="image"
:catalog="modelQuery.data.value.catalog"
:provider="provider"
:options="options"
:aspect-ratio="modelQuery.data.value.profile?.aspectRatio ?? '9:16'"
:disabled="requestLoading"
@update:provider="provider = $event"
@update:options="options = $event"
/>
<p v-if="modelQuery.loading.value" class="text-xs text-muted" role="status">正在读取生成配置…</p>
<IssueHint :messages="modelQuery.error.value ? [modelQuery.error.value] : []" type="error" />
<div v-if="editMode === 'composition_assisted' && bindingOptions.length" class="space-y-3">
<h4 class="text-xs font-medium">相对视线位置(人工确认,可选)</h4>
<div class="flex flex-wrap gap-2">
<NSelect
v-model:value="geometryBinding"
:options="bindingOptions"
placeholder="选择已确认目标"
class="min-w-0 flex-1"
:disabled="requestLoading"
/><NButton :disabled="geometryBinding === null || requestLoading" @click="addGeometry"
>添加观察</NButton
>
</div>
<section v-for="(item, index) in geometry" :key="index" class="space-y-3 bg-(--app-subtle) p-3">
<div class="flex items-center justify-between gap-3 text-xs">
<span>{{ item.subjectRef }} → {{ item.targetDescription }}</span
><NButton text size="small" :disabled="requestLoading" @click="geometry.splice(index, 1)"
>移除</NButton
>
</div>
<div class="keyframe-geometry-grid">
<label
>目标相对双眼水平方向<NSelect
v-model:value="item.horizontal"
:options="[
{ label: '左侧', value: 'left' },
{ label: '右侧', value: 'right' },
{ label: '居中', value: 'center' },
{ label: '未确认', value: 'unknown' }
]"
:disabled="requestLoading"
/></label>
<label
>目标相对双眼高低<NSelect
v-model:value="item.vertical"
:options="[
{ label: '上方', value: 'above' },
{ label: '下方', value: 'below' },
{ label: '同高', value: 'level' },
{ label: '未确认', value: 'unknown' }
]"
:disabled="requestLoading"
/></label>
<label
>注视部位<NSelect
v-model:value="item.targetFocusRegion"
clearable
:options="[
{ label: '中上部', value: 'upper' },
{ label: '中心', value: 'center' },
{ label: '下部', value: 'lower' },
{ label: '整体', value: 'whole' }
]"
:disabled="requestLoading"
/></label>
<label
>姿态协同<NSelect
v-model:value="item.gazeAlignmentStrategy"
clearable
:options="[
{ label: '双眼微调', value: 'eyes_only' },
{ label: '头颈协同', value: 'head_assisted' },
{ label: '上半身协同', value: 'upper_body_assisted' }
]"
:disabled="requestLoading"
/></label>
</div>
</section>
</div>
</div>
</div>
<div class="mt-5 flex flex-wrap items-center gap-3">
<NButton :disabled="!valid || requestLoading" :loading="previewLoading" @click="inspect"
>预览编辑输入</NButton
><span class="text-xs text-muted">只编译编辑指令,不调用图片模型。</span>
</div>
<IssueHint :messages="previewError ? [previewError] : []" type="error" />
<section v-if="preview" class="mt-4 space-y-3 bg-(--app-subtle) p-4 text-xs leading-6">
<p>
{{ preview.provider }} / {{ preview.model }} · 源图 {{ preview.sourceImageSlots }} 张 · 已选参考
{{ preview.selected.length }} 张 · 省略 {{ preview.omitted.length }} 张
</p>
<p class="whitespace-pre-wrap break-words">{{ preview.editInstruction }}</p>
</section>
<NCheckbox v-model:checked="confirmed" class="mt-5" :disabled="!preview || requestLoading"
>我已核对预览并确认本次生图费用;主首帧编辑还会自动调用视觉校验。</NCheckbox
>
<template #footer
><NButton :disabled="requestLoading" @click="open = false">取消</NButton
><NButton
type="primary"
:disabled="disabled || !valid || !preview || !confirmed"
:loading="requestLoading"
@click="submit"
>确认编辑</NButton
></template
>
</AppDialog>
</template>
<style>
@reference "../../../styles/styles.css";
.keyframe-edit-layout {
@apply grid grid-cols-[minmax(180px,280px)_minmax(0,1fr)] gap-5;
}
.keyframe-geometry-grid {
@apply grid grid-cols-[repeat(auto-fit,minmax(min(100%,180px),1fr))] gap-3;
}
.keyframe-geometry-grid > label {
@apply grid gap-2 text-xs;
}
@media (max-width: 760px) {
.keyframe-edit-layout {
@apply grid-cols-1;
}
}
</style>
@@ -1,6 +1,10 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { computed, ref } from 'vue'
import { NButton, NInput, NAlert } from 'naive-ui'
import { NButton, NInput } from 'naive-ui'
import { errorMessage } from '../../../lib/http'
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
import { useQuery } from '../../../composables/useQuery'
@@ -169,13 +173,13 @@ const records = computed(() =>
placeholder="填写审核理由(必填)"
:disabled="submitting"
/>
<NAlert :type="reviewAction === 'accepted' ? 'warning' : 'info'" :show-icon="false">
<ContextNotice :type="reviewAction === 'accepted' ? 'warning' : 'info'" :show-icon="false">
{{
reviewAction === 'accepted'
? '确认接受后将替换当前主首帧;AI 原始失败记录仍会保留。'
: '拒绝后保留图片及原始质量记录。'
}}
</NAlert>
</ContextNotice>
<div class="flex gap-3">
<NButton
type="primary"
@@ -188,8 +192,10 @@ const records = computed(() =>
</div>
</div>
</section>
<NAlert v-if="submitError" type="error" :show-icon="false" class="mt-3">{{ submitError }}</NAlert>
<NAlert v-if="submitSuccess" type="success" :show-icon="false" class="mt-3">{{ submitSuccess }}</NAlert>
<FeedbackMessage v-if="submitError" :message="submitError" />
<ContextNotice v-if="submitSuccess" type="success" :show-icon="false" class="mt-3">{{
submitSuccess
}}</ContextNotice>
<p v-if="reviewQuery.error.value" class="text-danger">{{ reviewQuery.error.value }}</p>
<p v-if="!records.length" class="text-muted">暂无校验记录。</p>
<!-- 以下是实际校验结论、问题与调用错误模块 -->
@@ -1,6 +1,10 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { onScopeDispose, ref, watch } from 'vue'
import { NAlert, NButton } from 'naive-ui'
import { NButton } from 'naive-ui'
import { qualityApi } from '../quality-api'
import type { ImageProviderCapability, ShotProviderCapability } from '../quality.types'
import { errorMessage } from '../../../lib/http'
@@ -55,7 +59,7 @@ async function inspect() {
<template>
<section class="mt-4 text-xs">
<NButton size="small" :loading="loading" :disabled="loading" @click="inspect">查看模型限制</NButton>
<NAlert v-if="error" type="error" :show-icon="false" class="mt-3">{{ error }}</NAlert>
<FeedbackMessage v-if="error" :message="error" />
<template v-if="providers">
<p v-if="!providers.some(item => item.active)" class="mt-2 text-danger">
没有匹配的启用图片模型,请检查后端配置。
@@ -71,12 +75,12 @@ async function inspect() {
}}
</p>
</template>
<NAlert v-if="capability" :type="capability.valid ? 'info' : 'error'" :show-icon="false" class="mt-3">{{
<ContextNotice v-if="capability" :type="capability.valid ? 'info' : 'error'" :show-icon="false" class="mt-3">{{
capability.valid
? capability.message ||
`当前镜头共有 ${capability.referenceCount} 张业务参考图,后端已判定本次规划符合 ${capability.provider} 能力。`
: capability.message || '当前镜头不满足模型能力限制。'
}}</NAlert>
}}</ContextNotice>
<p v-if="capability?.valid && capability.plannedReferenceCount !== undefined" class="mt-2 text-muted">
本次计划输入 {{ capability.plannedReferenceCount }} 张 · 转为文字约束
{{ capability.omittedReferenceCount ?? 0 }} 张
@@ -1,6 +1,8 @@
<script setup lang="ts">
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { computed } from 'vue'
import { NAlert, NCollapse, NCollapseItem, NScrollbar } from 'naive-ui'
import { NCollapse, NCollapseItem, NScrollbar } from 'naive-ui'
import type { ProductionPlan, ProjectProductionStatus } from '../types'
/** 展示当前制作计划与真实资产状态,不在页面重复推断业务规则。 */
@@ -92,11 +94,11 @@ const problems = computed(() => [
<p class="mt-2 text-xs text-muted">
计划会根据当前素材自动更新。已有有效结果会直接复用;重新生成的过期主体图会自动设为当前主图,手动生成的候选仍可在形态图片页自行确认。
</p>
<NAlert v-if="plan.hasManualBlockers" type="warning" :show-icon="false" class="mt-3">
<ContextNotice v-if="plan.hasManualBlockers" type="warning" :show-icon="false" class="mt-3">
各阶段合计
{{ plan.manualBlocked }}
项需人工处理(同一镜头可能重复计数)。可先生成就绪的主体参考图;成功结果会保留,遇到阻塞时后续阶段可能暂停。
</NAlert>
</ContextNotice>
<NCollapse v-if="problems.length" class="mt-3" :default-expanded-names="['issues']">
<NCollapseItem name="issues" title="查看还需要准备的内容">
<ul class="space-y-3 text-xs">
@@ -1,5 +1,7 @@
<script setup lang="ts">
import { NAlert, NButton } from 'naive-ui'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { NButton } from 'naive-ui'
import { Download } from '@lucide/vue'
import { downloadText } from '../../../lib/format'
import type { ProductionReceipt } from '../types'
@@ -44,7 +46,7 @@ function exportReceipt() {
{{ receipt.result.skipped }} · 已重新提交 {{ receipt.result.retried }} · 提交失败
{{ receipt.result.failed }}
</p>
<NAlert
<ContextNotice
v-if="receipt.kind === 'videos' && receipt.result.created"
role="status"
type="info"
@@ -52,10 +54,10 @@ function exportReceipt() {
class="mt-3"
>
严格质量候选已经创建,但尚未代表成片完成。后台会继续查询视频模型、执行视觉校验,并在失败时有限修复;只有校验通过的候选才会晋升主视频。
</NAlert>
<NAlert v-if="receipt.result.failed" role="alert" type="error" :show-icon="false" class="mt-3">
</ContextNotice>
<ContextNotice v-if="receipt.result.failed" role="alert" type="error" :show-icon="false" class="mt-3">
本次存在部分失败,成功提交或生成的结果不会回滚。请查看逐镜错误后再重试。
</NAlert>
</ContextNotice>
<ul v-if="receipt.result.failures.length" class="mt-3 space-y-2 text-xs text-danger">
<li v-for="failure in receipt.result.failures" :key="failure.shotId">
<code>{{ failure.shotId }}</code
@@ -1,6 +1,8 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import { computed, onScopeDispose, ref, watch } from 'vue'
import { NAlert, NButton, NInput } from 'naive-ui'
import { NButton, NInput } from 'naive-ui'
import { productionApi } from '../api'
import { errorMessage } from '../../../lib/http'
import type { ProviderInputSpec } from '../types'
@@ -61,7 +63,7 @@ async function inspect() {
/>
<NButton :disabled="!targetProvider || loading" :loading="loading" @click="inspect">检查实际输入</NButton>
</div>
<NAlert v-if="error" type="error" :show-icon="false" class="mt-3">{{ error }}</NAlert>
<FeedbackMessage v-if="error" :message="error" />
<div v-if="result" class="mt-3 space-y-2 break-all text-xs">
<p>目标模型:{{ result.targetProvider }}</p>
<p>业务主首帧:{{ result.businessKeyframe.id }}</p>
@@ -1,19 +1,13 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import AppForm from '../../../components/ui/AppForm.vue'
import { NFormItem } from 'naive-ui'
import { integerRule, sizeRules } from '../../../lib/form-rules'
import { computed, ref, watch } from 'vue'
import {
NAlert,
NButton,
NCheckbox,
NCollapse,
NCollapseItem,
NInput,
NInputNumber,
NRadioButton,
NRadioGroup
} from 'naive-ui'
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NInputNumber, NRadioButton, NRadioGroup } from 'naive-ui'
import { AppDialog } from '../../../components/ui'
import { allowedTextLines, validQualityInput } from '../quality'
import type { QualityAction, QualityInput, QualityTarget } from '../quality.types'
@@ -243,8 +237,8 @@ const optionsExpanded = ref<string[]>(['options'])
target?.kind === 'video' ? '生成修复候选' : '校验并修复'
}}</NRadioButton>
</NRadioGroup>
<NAlert v-if="target?.kind === 'video'" type="info" :show-icon="false" class="mt-4"
>视频校验会按镜头启用抽样帧、运动及道具专项检查,不含音频和口型。普通候选只校验;修复候选复检通过后会自动设为主视频。</NAlert
<ContextNotice v-if="target?.kind === 'video'" type="info" :show-icon="false" class="mt-4"
>视频校验会按镜头启用抽样帧、运动及道具专项检查,不含音频和口型。普通候选只校验;修复候选复检通过后会自动设为主视频。</ContextNotice
>
<div v-if="generating" class="quality-fields mt-4">
<NFormItem path="attempts" :label="videoRepair ? '修复链次数上限' : '每镜最多修复'"
@@ -274,8 +268,8 @@ const optionsExpanded = ref<string[]>(['options'])
<p v-if="videoRepair" class="mt-3 text-xs text-muted">
本次仅创建一个修复视频,不自动等待或复检。完成后请打开新候选的质量检查;修复约束沿用上次失败校验,不使用额外参数。
</p>
<NAlert v-if="!repairAvailable" type="warning" :show-icon="false" class="mt-3"
>请先执行视觉校验,只有未通过的视频可以创建修复候选。</NAlert
<ContextNotice v-if="!repairAvailable" type="warning" :show-icon="false" class="mt-3"
>请先执行视觉校验,只有未通过的视频可以创建修复候选。</ContextNotice
>
<NCollapse
v-if="!videoRepair"
@@ -326,10 +320,10 @@ const optionsExpanded = ref<string[]>(['options'])
:aspect-ratio="modelQuery.data.value.profile.aspectRatio"
:disabled="pending"
/>
<NAlert v-if="modelQuery.error.value" type="error" :show-icon="false">{{
<ContextNotice v-if="modelQuery.error.value" type="error" :show-icon="false">{{
modelQuery.error.value
}}</NAlert>
<NAlert
}}</ContextNotice>
<ContextNotice
v-if="target?.kind === 'batch' && !modelReady && !modelQuery.error.value"
type="warning"
:show-icon="false"
@@ -339,14 +333,14 @@ const optionsExpanded = ref<string[]>(['options'])
? '正在读取项目模型配置,请稍候。'
: '请先保存有效的项目图片模型配置,再选择本次模型。'
}}
</NAlert>
</ContextNotice>
<ModelCapabilities
:shot-id="target?.shotId"
:provider="target?.kind === 'batch' ? provider : undefined"
/>
</NCollapseItem>
</NCollapse>
<NAlert type="warning" :show-icon="false" class="mt-4">
<ContextNotice type="warning" :show-icon="false" class="mt-4">
<template v-if="videoRepair"
>本次最多提交 1
个视频生成任务,可能产生费用;生成完成不会切换主视频,需再次付费复检通过后才会晋升。</template
@@ -365,12 +359,10 @@ const optionsExpanded = ref<string[]>(['options'])
? '如果当前是修复候选,校验通过将替换当前主视频。'
: '仅校验,不修改主资产。'
}}</template>
</NAlert>
</ContextNotice>
</AppForm>
<p v-if="pending" role="status" class="mt-3 text-xs text-muted">{{ operation.label }}进行中,请勿重复提交。</p>
<NAlert v-if="session.error" role="alert" type="error" :show-icon="false" class="mt-4">{{
session.error
}}</NAlert>
<FeedbackMessage v-if="session.error" :message="session.error" />
<!-- 以下是持久化任务进度与原目标最终回执模块 -->
<WorkflowExecutionPanel
v-if="execution.executionId.value"
@@ -1,6 +1,8 @@
<script setup lang="ts">
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { computed } from 'vue'
import { NAlert, NButton, NCollapse, NCollapseItem } from 'naive-ui'
import { NButton, NCollapse, NCollapseItem } from 'naive-ui'
import { downloadText } from '../../../lib/format'
import type { QualityReceipt } from '../quality.types'
@@ -111,7 +113,7 @@ function exportResult() {
</p>
<p v-else class="mt-2 text-xs text-muted">只校验,不重生成或切换主首帧。</p>
</template>
<NAlert
<ContextNotice
v-for="(issue, index) in issues"
:key="index"
:type="issue.severity === 'error' ? 'error' : 'warning'"
@@ -119,7 +121,7 @@ function exportResult() {
class="mt-3"
>
{{ issue.frameLabel ? `${issue.frameLabel} · ` : '' }}{{ issue.description }}
</NAlert>
</ContextNotice>
<NCollapse class="mt-4" :default-expanded-names="['details']">
<NCollapseItem name="details" title="主体检查与执行详情">
<template v-if="receipt.kind === 'keyframe' || receipt.kind === 'video'">
@@ -1,8 +1,12 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import IssueHint from '../../../components/ui/IssueHint.vue'
import { useActionMessage } from '../../../components/ui/useActionMessage'
import ProviderInputInspector from './ProviderInputInspector.vue'
import { NAlert, NButton, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
import { NButton, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
import { computed, onScopeDispose, ref, watch } from 'vue'
import { ImagePlus, RefreshCw } from '@lucide/vue'
import { AssetImage } from '../../../components/ui'
@@ -26,7 +30,12 @@ import type {
VideoGenerationSpec,
VideoReadinessItem
} from '../types'
import MotionPlanPanel from '../../storyboard/components/MotionPlanPanel.vue'
import SpatialBindingsPanel from '../../storyboard/components/SpatialBindingsPanel.vue'
import KeyframeDialog from './KeyframeDialog.vue'
import KeyframeEditDialog from './KeyframeEditDialog.vue'
import type { ShotKeyframe } from '../types'
import { getOperation, isOperationRunning } from '../../workflows/operations'
import KeyframeCard from './KeyframeCard.vue'
import VideoCard from './VideoCard.vue'
import ProductionStageStatus from './ProductionStageStatus.vue'
@@ -48,6 +57,25 @@ import GenerationModelControls from '../../generation-config/components/Generati
/** 当前页面操作反馈使用消息提示,不长期占据正文。 */
const actionMessage = useActionMessage()
/** 动作与视线按需打开,避免进入生产页便编译全部镜头。 */
const motionOpen = ref(false)
/** 编辑源图保持正式资产身份,不能把视频输入变体当作业务源图。 */
const editOpen = ref(false)
const editSource = ref<ShotKeyframe | null>(null)
/**
* 编辑具体主图或历史候选,切镜时废弃原源图。
* @param source 当前镜头已完成首帧
*/
function openEdit(source: ShotKeyframe) {
if (assetBlocked.value || source.status !== 'completed' || source.source === 'provider_variant') return
editSource.value = source
editOpen.value = true
}
/** 单镜头动作按钮反映本镜头操作,不把整个项目锁显示为所有按钮加载。 */
const promptLoading = computed(() => {
const op = getOperation(props.projectId)
return op.pending && op.label === `生成镜头 ${props.shot.shotNo} 视频提示词`
})
/** 离开镜头后忽略迟到的手动读取反馈。 */
let disposed = false
onScopeDispose(() => {
@@ -76,6 +104,15 @@ const props = defineProps<{
/** 通知父页面刷新及观察已启动的质量任务。 */
const emit = defineEmits<{ changed: []; qualityStarted: [executionId: string] }>()
const key = computed(() => props.shot.shotId)
watch(
() => props.shot.shotId,
() => {
editOpen.value = false
editSource.value = null
motionOpen.value = false
}
)
/** 仅当前镜头存在后台首帧或视频任务时临时轮询,终态后自动停止。 */
let query!: ReturnType<
typeof usePolling<{
@@ -381,13 +418,16 @@ async function setPrimaryKeyframe() {
if (
assetBlocked.value ||
!keyframeId ||
keyframePassed(keyframeId) !== true ||
keyframes.value.find(item => item.id === keyframeId)?.source === 'provider_variant'
)
return
const shotId = props.shot.shotId
confirmingKeyframe.value = ''
await runOperation(props.projectId, `设置镜头 ${props.shot.shotNo} 主首帧`, async () => {
// 晋升前重新读取持久化质量结论,刷新页面后也认可真实历史通过。
const review = await qualityApi.keyframeQualityReview(shotId, keyframeId)
if (!['passed', 'manual_accepted'].includes(review.effectiveQualityStatus))
throw new Error('此候选尚未通过当前质量要求,请先完成质量检查或有效人工复核。')
const result = await productionApi.setPrimaryKeyframe(shotId, keyframeId)
if (!result || result.id !== keyframeId || !result.isPrimary || result.status !== 'completed')
throw new Error('接口未确认主首帧切换。')
@@ -477,9 +517,9 @@ defineExpose({ inspectSpecs, inspecting })
<template>
<section class="production-assets">
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
<ContextNotice v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
>{{ query.error.value }} 当前保留上次成功读取的资产,操作已暂停。
</NAlert>
</ContextNotice>
<div class="production-stage">
<div class="production-stage-heading">
@@ -494,7 +534,10 @@ defineExpose({ inspectSpecs, inspecting })
/>
</div>
<div v-if="savedPrompt?.videoPrompt" class="surface-inset mt-4 p-4" aria-label="本镜视频提示词">
<p class="text-xs font-medium">本镜视频提示词</p>
<div class="flex flex-wrap items-center justify-between gap-3">
<p class="text-xs font-medium">本镜视频提示词</p>
<NButton text size="small" @click="motionOpen = true">查看动作与视线</NButton>
</div>
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">{{ savedPrompt.videoPrompt }}</p>
<template v-if="savedPrompt.negativePrompt">
<p class="mt-4 text-xs font-medium">负向提示词</p>
@@ -510,13 +553,20 @@ defineExpose({ inspectSpecs, inspecting })
正在读取视频提示词…
</p>
<p v-else-if="!promptQuery.error.value" class="mt-4 text-xs text-muted">尚未生成本镜视频提示词。</p>
<NAlert v-if="promptQuery.error.value" role="alert" type="warning" :show-icon="false" class="mt-4 text-xs">
<ContextNotice
v-if="promptQuery.error.value"
role="alert"
type="warning"
:show-icon="false"
class="mt-4 text-xs"
>
提示词读取失败:{{ promptQuery.error.value }}
<NButton text size="small" @click="promptQuery.refresh">重试</NButton>
</NAlert>
</ContextNotice>
<div class="production-stage-actions">
<ConfirmAction
:label="promptReadiness?.status === 'skipped' ? '重新生成本镜提示词' : '生成本镜提示词'"
:loading="promptLoading"
:disabled="!canGeneratePrompt"
acknowledgement
:description="
@@ -548,27 +598,37 @@ defineExpose({ inspectSpecs, inspecting })
:shot-id="shot.shotId"
:review-revision="reviewRevision"
:item="currentKeyframe"
:editing="
editSource?.id === currentKeyframe.id &&
isOperationRunning(getOperation(projectId), `编辑镜头 ${shot.shotId} 首帧`)
"
:shot-no="shot.shotNo"
:stale="keyframeStale"
:blocked="assetBlocked"
:validation-passed="keyframePassed(currentKeyframe.id)"
:confirming="false"
@quality="openQuality('keyframe', currentKeyframe.id)"
@edit="openEdit(currentKeyframe)"
@history="openKeyframeHistory(currentKeyframe.id)"
/>
</div>
<p v-else class="mt-4 text-xs text-muted">尚无已确认主首帧。请生成候选,完成质量检查后再设为主首帧。</p>
<NAlert
<ContextNotice
v-if="currentKeyframe && keyframePassed(currentKeyframe.id) === false"
type="error"
:show-icon="false"
class="mt-3 text-xs"
>
当前主首帧在本次质量检查中未通过,已阻止继续生成视频。请从候选中选择质量通过的图片。
</NAlert>
<NAlert v-if="query.data.value?.qualityStatusError" type="warning" :show-icon="false" class="mt-3 text-xs">
</ContextNotice>
<ContextNotice
v-if="query.data.value?.qualityStatusError"
type="warning"
:show-icon="false"
class="mt-3 text-xs"
>
视频质量链状态暂时无法读取;视频资产仍可查看。请稍后刷新。
</NAlert>
</ContextNotice>
<div class="production-stage-actions">
<NButton :disabled="!episodeNo || !canGenerateKeyframe" @click="openShotKeyframeQuality"
>本镜首帧质量重跑</NButton
@@ -580,7 +640,10 @@ defineExpose({ inspectSpecs, inspecting })
<NTag v-if="activeKeyframeCount" size="small" type="warning" :bordered="false" role="status">
首帧任务进行中({{ activeKeyframeCount }})
</NTag>
<NButton :disabled="!canGenerateKeyframe" @click="keyframeOpen = true"
<NButton
:loading="isOperationRunning(getOperation(projectId), `生成镜头 ${shot.shotNo} 首帧`)"
:disabled="!canGenerateKeyframe"
@click="keyframeOpen = true"
><ImagePlus :size="14" />{{
keyframeStale ? '生成替代候选' : currentKeyframe ? '再生成一张候选' : '生成首帧候选'
}}</NButton
@@ -752,9 +815,9 @@ defineExpose({ inspectSpecs, inspecting })
</div>
</div>
</section>
<NAlert v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-4 text-xs">
<ContextNotice v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-4 text-xs">
生成模型目录读取失败:{{ generationCatalogError }}
</NAlert>
</ContextNotice>
<div class="production-stage-actions">
<ConfirmAction
:label="
@@ -779,7 +842,7 @@ defineExpose({ inspectSpecs, inspecting })
</div>
<AppDialog v-model:open="specsOpen" title="生成设置与模型限制" description="查看不收费。" wide>
<NAlert v-if="specError" role="alert" type="error" :show-icon="false" class="mt-4">{{ specError }}</NAlert>
<FeedbackMessage v-if="specError" :message="specError" />
<p v-if="inspecting" role="status" class="mt-4 text-xs text-muted">正在读取生成规格…</p>
<ModelCapabilities :shot-id="shot.shotId" />
<ProviderInputInspector :shot-id="shot.shotId" />
@@ -811,6 +874,26 @@ defineExpose({ inspectSpecs, inspecting })
></NCollapse
>
</AppDialog>
<AppDialog v-model:open="motionOpen" title="镜头动作与视线" wide>
<div v-if="motionOpen" class="space-y-6">
<MotionPlanPanel :key="shot.shotId" :shot-id="shot.shotId" :revision="savedPrompt?.updatedAt" />
<SpatialBindingsPanel
:key="shot.shotId"
:project-id="projectId"
:shot-id="shot.shotId"
:disabled="assetBlocked"
@changed="refreshAll"
/>
</div>
</AppDialog>
<KeyframeEditDialog
v-model:open="editOpen"
:project-id="projectId"
:shot-id="shot.shotId"
:source="editSource"
:disabled="assetBlocked"
@started="emit('qualityStarted', $event)"
/>
<QualityDialog
v-model:open="qualityOpen"
:project-id="projectId"
@@ -822,7 +905,7 @@ defineExpose({ inspectSpecs, inspecting })
<AppDialog
v-model:open="candidatesOpen"
title="首帧候选管理"
description="先完成质量检查;只有本会话校验通过的候选才能设为主首帧。"
description="读取已保存质量结论;通过质量检查或完成有效人工复核的候选可以设为主首帧。"
:width="keyframeCandidatesWidth"
>
<!-- 候选图片和对应的人工复核入口按相同候选 ID 分组。 -->
@@ -832,12 +915,17 @@ defineExpose({ inspectSpecs, inspecting })
:shot-id="shot.shotId"
:review-revision="reviewRevision"
:item="item"
:editing="
editSource?.id === item.id &&
isOperationRunning(getOperation(projectId), `编辑镜头 ${shot.shotId} 首帧`)
"
:shot-no="shot.shotNo"
:stale="false"
:blocked="assetBlocked"
:validation-passed="keyframePassed(item.id)"
:confirming="confirmingKeyframe === item.id"
@quality="openQuality('keyframe', item.id)"
@edit="openEdit(item)"
@history="openKeyframeHistory(item.id)"
@select="confirmingKeyframe = item.id"
@confirm="setPrimaryKeyframe"
@@ -1,7 +1,9 @@
<script setup lang="ts">
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { productionIssueText } from '../production-messages'
import { computed } from 'vue'
import { NAlert, NButton } from 'naive-ui'
import { NButton } from 'naive-ui'
import { referenceLocation, referenceTargets } from '../asset-links'
import { useShotReferences } from '../useShotReferences'
import type { ProductionIssue } from '../types'
@@ -22,7 +24,7 @@ const precise = computed(() =>
)
</script>
<template>
<NAlert
<ContextNotice
role="alert"
type="warning"
:show-icon="false"
@@ -57,5 +59,5 @@ const precise = computed(() =>
<div v-if="references.error.value" class="mt-2 text-danger">
{{ references.error.value }} <NButton text size="small" @click="references.refresh">重试定位</NButton>
</div>
</NAlert>
</ContextNotice>
</template>
@@ -1,6 +1,10 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { computed } from 'vue'
import { NAlert, NButton, NTag } from 'naive-ui'
import { NButton, NTag } from 'naive-ui'
import { AssetOpenLink, StatusBadge } from '../../../components/ui'
import { mediaAssetUrl } from '../../../lib/assets'
import { formatDate } from '../../../lib/format'
@@ -78,9 +82,7 @@ const canSelect = computed(
<p v-if="previousValidation !== null" class="mt-2 text-[11px] text-muted">
{{ previousValidation ? '此前画面检查通过' : '此前画面检查未通过' }}
</p>
<NAlert v-if="item.error" role="alert" type="error" :show-icon="false" class="mt-3">{{
item.error
}}</NAlert>
<FeedbackMessage v-if="item.error" :message="item.error" />
<p class="mt-3 break-all text-[10px] text-muted">
{{ item.provider }} · {{ item.model }} · {{ formatDate(item.createdAt) }}
</p>
@@ -94,7 +96,7 @@ const canSelect = computed(
</NButton>
</div>
<!-- 以下是候选切换确认模块,不更改已有费用确认与质量检查流程 -->
<NAlert v-if="confirming" type="info" :show-icon="false" class="mt-3 text-xs">
<ContextNotice v-if="confirming" type="info" :show-icon="false" class="mt-3 text-xs">
<p>确认把此候选设为当前镜头主视频?旧成片仍会保留。</p>
<div class="mt-2 flex gap-3">
<NButton :disabled="blocked || !canSelect" type="primary" @click="emit('confirm')"
@@ -102,7 +104,7 @@ const canSelect = computed(
>
<NButton text size="small" @click="emit('cancel')">取消</NButton>
</div>
</NAlert>
</ContextNotice>
</div>
</article>
</template>
@@ -1,6 +1,8 @@
<script setup lang="ts">
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { computed } from 'vue'
import { NAlert, NTag } from 'naive-ui'
import { NTag } from 'naive-ui'
import { useQuery } from '../../../composables/useQuery'
import { formatDate } from '../../../lib/format'
import { videoDiagnosticsApi } from '../diagnostics-api'
@@ -67,10 +69,12 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
<template>
<!-- 以下是弹窗中的视频已有检查记录模块,无需再次点击查看 -->
<section class="workspace-panel text-xs leading-6" aria-label="当前视频质量记录">
<NAlert v-if="stale" type="warning" :show-icon="false" class="mb-3">
<ContextNotice v-if="stale" type="warning" :show-icon="false" class="mb-3">
此视频需要更新:首帧或参考图已变化。此前画面检查结果仅供参考,请重新生成视频。
</NAlert>
<NAlert v-if="query.error.value" type="error" :show-icon="false" role="alert">{{ query.error.value }}</NAlert>
</ContextNotice>
<ContextNotice v-if="query.error.value" type="error" :show-icon="false" role="alert">{{
query.error.value
}}</ContextNotice>
<p v-if="query.loading.value" class="text-muted" role="status">正在读取质量记录…</p>
<template v-else-if="detail">
<p v-if="currentRecord" class="font-semibold">
@@ -121,7 +125,7 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
</li>
</ul>
</article>
<NAlert
<ContextNotice
v-if="analysis"
class="mt-3"
:type="analysis.requiresManualReview ? 'warning' : 'info'"
@@ -132,7 +136,7 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
<p v-if="analysis.recommendedRollback.length" class="mt-1">
建议检查:{{ analysis.recommendedRollback.map(rollbackLabel).join('、') }}
</p>
</NAlert>
</ContextNotice>
<article v-for="issue in analysis?.persistentIssues ?? []" :key="issue.type" class="mt-3">
<strong>{{ issue.type }} · 出现 {{ issue.occurrences }} 次</strong>
<p>{{ issue.suspectedCause }}</p>
@@ -0,0 +1,67 @@
import { request } from '../../lib/http'
import type { GenerationOptions } from '../generation-config/types'
import type { WorkflowExecutionStart } from '../workflows/execution.types'
/** 人工确认的相对眼位;只提交用户选择,不能从画面区域猜测。 */
export interface RelativeGazeGeometry {
subjectRef: string
targetDescription: string
horizontal: 'left' | 'right' | 'center' | 'unknown'
vertical: 'above' | 'below' | 'level' | 'unknown'
targetFocusRegion?: 'upper' | 'center' | 'lower' | 'whole'
gazeAlignmentStrategy?: 'eyes_only' | 'head_assisted' | 'upper_body_assisted'
source: 'manual'
}
/** 本次首帧编辑参数,不修改项目默认配置。 */
export interface KeyframeEditInput {
editInstruction: string
editMode: 'subject_only' | 'composition_assisted'
allowBackgroundDeemphasis?: boolean
relativeGazeGeometry?: RelativeGazeGeometry[]
provider?: string
generationOptions?: GenerationOptions
}
/** 后端编译的真实编辑输入。 */
export interface KeyframeEditPreview {
shotId: string
sourceKeyframeId: string
provider: string
model: string
editInstruction: string
editMode: KeyframeEditInput['editMode']
sourceImageSlots: number
maxInputImages: number | null
selected: Array<{ subjectRef: string; role: string; imageId: string }>
omitted: Array<{ subjectRef: string; role: string; imageId: string }>
}
/** 预览和后台编辑使用完全相同的业务参数。 */
export const keyframeEditApi = {
/**
* 只读编译实际编辑指令和参考图名额。
* @param shotId 正式镜头 ID
* @param sourceId 当前镜头有效源图 ID
* @param input 本次人工确认的编辑参数
* @param signal 查询取消信号
* @returns 实际模型输入
*/
preview: (shotId: string, sourceId: string, input: KeyframeEditInput, signal?: AbortSignal) =>
request<KeyframeEditPreview>(
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframes/${encodeURIComponent(sourceId)}/edit/preview`,
{ method: 'POST', body: input, signal, timeoutMs: 0 }
),
/**
* 启动持久化编辑任务,结果由后台真实终态确认。
* @param shotId 正式镜头 ID
* @param sourceId 已核对的编辑源图 ID
* @param input 已预览并确认费用的参数
* @returns 后台首帧质量任务观察句柄
*/
start: (shotId: string, sourceId: string, input: KeyframeEditInput) =>
request<WorkflowExecutionStart & { projectId: string; shotId: string; sourceKeyframeId: string }>(
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframes/${encodeURIComponent(sourceId)}/edit`,
{ method: 'POST', body: input, timeoutMs: 0 }
)
}
+1 -1
View File
@@ -36,7 +36,7 @@ export interface VisualValidation {
issues: QualityIssue[]
}
/** 首帧校验回执;当前后端没有独立读取校验历史的 GET。 */
/** 首帧校验回执;历史记录通过独立 validations GET 读取。 */
export interface KeyframeValidation extends VisualValidation {
shotId: string
keyframeId: string