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
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user