fix: 为镜头提示词缺少首帧提供操作指引
This commit is contained in:
1 parent
0ce9ae00e7
commit
de26dd0c19
8 files changed
+149
-19
No files matched your search
@@ -80,6 +80,9 @@ const linkedShotMissing = computed(
|
||||
query.data.value &&
|
||||
!shots.value.some(item => item.shotId === selectedShot.value)
|
||||
)
|
||||
const openRequestedKeyframe = computed(
|
||||
() => queryText(route?.query.action) === 'keyframe' && queryText(route?.query.shotId) === shot.value?.shotId
|
||||
)
|
||||
const staleVideos = computed(() => query.data.value?.videos.stalePrimaryVideo ?? 0)
|
||||
const stages = computed(() => {
|
||||
const data = query.data.value
|
||||
@@ -694,6 +697,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
|
||||
:prompt-readiness="promptItem"
|
||||
:keyframe-readiness="keyframeItem"
|
||||
:video-readiness="videoItem"
|
||||
:open-keyframe="openRequestedKeyframe"
|
||||
:disabled="blocked || !!linkedShotMissing"
|
||||
@changed="refreshProject"
|
||||
/>
|
||||
|
||||
@@ -37,6 +37,7 @@ const props = defineProps<{
|
||||
promptReadiness?: PromptReadinessItem
|
||||
keyframeReadiness?: KeyframeReadinessItem
|
||||
videoReadiness?: VideoReadinessItem
|
||||
openKeyframe?: boolean
|
||||
disabled: boolean
|
||||
}>()
|
||||
const emit = defineEmits<{ changed: [] }>()
|
||||
@@ -63,6 +64,13 @@ const activeVideo = computed(() => videos.value.find(isActiveVideo))
|
||||
const operation = computed(() => getOperation(props.projectId))
|
||||
const assetBlocked = computed(() => props.disabled || operation.value.pending || !!query.error.value)
|
||||
const keyframeOpen = ref(false)
|
||||
watch(
|
||||
() => props.openKeyframe,
|
||||
requested => {
|
||||
if (requested) keyframeOpen.value = true
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
const qualityOpen = ref(false)
|
||||
const qualityTarget = ref<QualityTarget | null>(null)
|
||||
const specsOpen = ref(false)
|
||||
|
||||
@@ -33,11 +33,23 @@ provide(projectContextKey, context)
|
||||
const operation = computed(() => getOperation(id.value))
|
||||
const complete = computed(() => isProjectComplete(context.project.value, id.value))
|
||||
const isCreation = computed(() => route.path.replace(/\/+$/, '').endsWith('/create-drama'))
|
||||
type OperationGuide = { title: string; description: string; action?: string; target?: 'profile' | 'style' | 'identity' }
|
||||
type OperationGuide = {
|
||||
title: string
|
||||
description: string
|
||||
action?: string
|
||||
target?: 'profile' | 'style' | 'identity' | 'keyframe'
|
||||
}
|
||||
const operationGuide = computed<OperationGuide | null>(() => {
|
||||
const error = operation.value.error?.trim()
|
||||
if (!error) return null
|
||||
const normalized = error.toLowerCase()
|
||||
if (normalized.includes('primary keyframe') || error.includes('主首帧'))
|
||||
return {
|
||||
title: '缺少镜头主首帧',
|
||||
description: '视频提示词需要主首帧完成起点校验。请先生成并确认主首帧,再返回分镜页读取/生成提示词。',
|
||||
action: '先生成主首帧',
|
||||
target: 'keyframe'
|
||||
}
|
||||
if (normalized.includes('creative profile'))
|
||||
return {
|
||||
title: '缺少项目生成配置',
|
||||
@@ -65,7 +77,18 @@ const operationGuide = computed<OperationGuide | null>(() => {
|
||||
/** 已知前置条件直接送达对应工作区;保留当前页面,修复后可继续原操作。 */
|
||||
function resolveOperationError() {
|
||||
const target = operationGuide.value?.target
|
||||
if (target === 'style') void router.push(`/projects/${id.value}/visual-style`)
|
||||
if (target === 'keyframe') {
|
||||
const recovery = operation.value.recovery?.target === 'keyframe' ? operation.value.recovery : null
|
||||
const query = recovery
|
||||
? {
|
||||
...(recovery.episodeNo ? { episodeNo: String(recovery.episodeNo) } : {}),
|
||||
shotId: recovery.shotId,
|
||||
action: 'keyframe'
|
||||
}
|
||||
: { action: 'keyframe' }
|
||||
operation.value.error = ''
|
||||
void router.push({ path: `/projects/${id.value}/production`, query })
|
||||
} else if (target === 'style') void router.push(`/projects/${id.value}/visual-style`)
|
||||
else if (target === 'identity') void router.push(`/projects/${id.value}/subject-identity`)
|
||||
else if (target === 'profile') {
|
||||
const onIdentityPage = route.path.replace(/\/+$/, '').endsWith('/subject-identity')
|
||||
|
||||
@@ -419,7 +419,13 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
||||
>
|
||||
<div v-if="detailTab === 'design'" class="pt-6"><ShotDesign :shot="shot" /></div>
|
||||
<div v-if="detailTab === 'tools'" class="pt-6">
|
||||
<ShotTools :key="shot.shotId" :project-id="id" :shot="shot" :disabled="blocked" />
|
||||
<ShotTools
|
||||
:key="shot.shotId"
|
||||
:project-id="id"
|
||||
:episode-no="episodeNo"
|
||||
:shot="shot"
|
||||
:disabled="blocked"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</NScrollbar>
|
||||
|
||||
@@ -13,7 +13,7 @@ import { getOperation, runOperation } from '../../workflows/operations'
|
||||
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
||||
|
||||
/** 镜头级只读资源与显式 Prompt 生成;查询与耗费模型的操作分开。 */
|
||||
const props = defineProps<{ projectId: string; shot: DesignedShot; disabled: boolean }>()
|
||||
const props = defineProps<{ projectId: string; shot: DesignedShot; episodeNo?: number; disabled: boolean }>()
|
||||
const references = ref<ShotReferences | null>(null)
|
||||
const spec = ref<ShotGenerationSpec | null>(null)
|
||||
const errors = ref({ references: '', spec: '' })
|
||||
@@ -72,7 +72,7 @@ async function generatePrompt() {
|
||||
const projectId = props.projectId
|
||||
const shotId = props.shot.shotId
|
||||
const overwrite = force.value
|
||||
await runOperation(projectId, `读取/生成镜头 ${props.shot.shotNo} 提示词`, async () => {
|
||||
const ok = await runOperation(projectId, `读取/生成镜头 ${props.shot.shotNo} 提示词`, async () => {
|
||||
const session = getStoryboardSession(projectId)
|
||||
// 请求结果不确定时不要保留可能已被覆盖的旧正文。
|
||||
delete session.prompts[shotId]
|
||||
@@ -81,6 +81,13 @@ async function generatePrompt() {
|
||||
throw new Error('接口未返回此镜头的有效提示词,请检查后端记录后重试。')
|
||||
session.prompts[shotId] = result
|
||||
})
|
||||
if (!ok && /primary keyframe|主首帧/i.test(operation.value.error)) {
|
||||
operation.value.recovery = {
|
||||
target: 'keyframe',
|
||||
shotId,
|
||||
episodeNo: props.episodeNo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 仅导出已返回的真实规格或提示词,不在前端补造内容。 */
|
||||
|
||||
@@ -7,6 +7,14 @@ export interface Operation {
|
||||
label: string
|
||||
error: string
|
||||
notice: string
|
||||
recovery: OperationRecovery | null
|
||||
}
|
||||
|
||||
/** 失败后的可执行恢复位置;仅保留当前浏览器会话内的真实上下文。 */
|
||||
export type OperationRecovery = {
|
||||
target: 'keyframe'
|
||||
shotId: string
|
||||
episodeNo?: number
|
||||
}
|
||||
|
||||
/** 按项目而非 graph 上锁,防止改写剧本与拆解同时提交。 */
|
||||
@@ -14,14 +22,14 @@ const operations = reactive<Record<string, Operation>>({})
|
||||
|
||||
/** 取得项目操作状态,不向浏览器持久化虚假的后台运行状态。 */
|
||||
export function getOperation(projectId: string): Operation {
|
||||
return (operations[projectId] ??= { pending: false, label: '', error: '', notice: '' })
|
||||
return (operations[projectId] ??= { pending: false, label: '', error: '', notice: '', recovery: null })
|
||||
}
|
||||
|
||||
/** 只提交一次;断网不自动重试,后台是否已执行由刷新后的 checkpoint 确认。 */
|
||||
export async function runOperation(projectId: string, label: string, action: () => Promise<unknown>) {
|
||||
const operation = getOperation(projectId)
|
||||
if (operation.pending) return false
|
||||
Object.assign(operation, { pending: true, label, error: '', notice: '' })
|
||||
Object.assign(operation, { pending: true, label, error: '', notice: '', recovery: null })
|
||||
try {
|
||||
await action()
|
||||
operation.notice = '请求已返回,正在重新读取后端状态;最终结果以下方记录为准。'
|
||||
|
||||
Reference in new issue
Block a user