feat(short-drama-agent-front): 完善镜头定位与项目配置

This commit is contained in:
GJ committed 2026-10-08 19:45:26 +08:00
1 parent 470b52e26d
commit 5b134207b8
66 files changed
+2042 -984

No files matched your search

+16 -31
View File
@@ -6,7 +6,7 @@ import WorkspacePage from '../../components/ui/WorkspacePage.vue'
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
import { NScrollbar, NAlert, NButton, NCheckbox, NInputNumber, NProgress, NSelect } from 'naive-ui'
import { computed, inject, ref, watch } from 'vue'
import { ArrowLeft, CheckCircle2, CircleAlert, Film, Image, MessageSquareText, RefreshCw } from '@lucide/vue'
import { ArrowLeft, CheckCircle2, CircleAlert, Film, Image, MessageSquareText } from '@lucide/vue'
import { EmptyState, StatusBadge } from '../../components/ui'
import BeatShotDirectory from '../storyboard/components/BeatShotDirectory.vue'
import ConfirmAction from '../workflows/ConfirmAction.vue'
@@ -82,16 +82,6 @@ watch(
}
)
const route = inject(routeLocationKey, undefined)
/** 从素材页返回时恢复到指定剧集与正式镜头,不按重复的 Shot 编号定位。 */
watch(
() => [route?.query.episodeNo, route?.query.shotId],
() => {
const episode = Number(queryText(route?.query.episodeNo))
selectedEpisode.value = Number.isSafeInteger(episode) && episode > 0 ? episode : undefined
selectedShot.value = queryText(route?.query.shotId)
},
{ immediate: true }
)
const linkedShotMissing = computed(
() =>
queryText(route?.query.shotId) &&
@@ -249,13 +239,6 @@ watch(
if (receipt) toolsOpen.value = true
}
)
watch(
() => route?.query.configure,
value => {
if (value === 'profile') toolsOpen.value = true
},
{ immediate: true }
)
function profileSaved() {
operation.value.error = ''
@@ -309,15 +292,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
>
<div class="toolbar-actions">
<NButton :disabled="blocked || !episodeNo" @click="qualityOpen = true">首帧质量生成</NButton>
<NButton
:disabled="query.loading.value"
@click="query.refresh"
quaternary
class="icon-button"
aria-label="刷新就绪状态"
title="刷新就绪状态"
><RefreshCw :size="16" :class="{ 'animate-spin': query.loading.value }" />
</NButton>
<WorkspaceTools
v-model:open="toolsOpen"
title="项目生产总览与批量操作"
@@ -370,7 +345,11 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</AppForm>
</section>
<div class="production-tool-stack workspace-section-stack">
<CreativeProfileSettings :project-id="id" @saved="profileSaved" />
<CreativeProfileSettings
:project-id="id"
:disabled="operation.pending"
@saved="profileSaved"
/>
<section class="production-tool-section workspace-panel">
<h3 class="text-sm font-semibold">处理范围与覆盖规则</h3>
<p class="mt-3 text-xs leading-6 text-muted">
@@ -743,7 +722,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
<span>过期首帧 {{ staleKeyframes }} · 过期视频 {{ staleVideos }} · 身份前置问题 {{ identityBlocked }}</span>
<NButton text size="small" @click="toolsOpen = true">查看处理方式</NButton>
</div>
<div v-if="shot" class="panel production-workspace workspace-surface">
<div v-if="shots.length" class="panel production-workspace workspace-surface">
<nav class="production-shot-list directory-panel" aria-label="本集生产镜头">
<div class="directory-heading">
<h3>
@@ -757,7 +736,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
>
<BeatShotDirectory
:shots="shots"
:active-id="shot.shotId"
:active-id="shot?.shotId || ''"
@select="selectedShot = $event"
item-class="production-shot-link"
>
@@ -805,7 +784,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</NScrollbar>
</nav>
<article class="production-detail min-w-0">
<NScrollbar class="panel-scroll" content-class="p-5 lg:p-7">
<NScrollbar v-if="shot" class="panel-scroll" content-class="p-5 lg:p-7">
<header class="mb-5 pb-5">
<NAlert v-if="linkedShotMissing" type="warning" :show-icon="false" class="mb-4"
>链接中的镜头已不存在或不属于该剧集,请在左侧重新选择。</NAlert
@@ -870,6 +849,12 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
@quality-started="trackKeyframeQuality"
/>
</NScrollbar>
<!-- 以下是无效镜头地址的定位反馈模块 -->
<EmptyState
v-if="!shot"
title="链接中的镜头已不存在或不属于本集"
description="请在左侧目录重新选择镜头。"
/>
</article>
</div>
<EmptyState
@@ -3,9 +3,13 @@ import AppForm from '../../../components/ui/AppForm.vue'
import { NAlert, NButton, NCheckbox, NCollapse, NCollapseItem, NTag } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { generationConfigApi } from '../../generation-config/api'
import type { CreativeProfileAspectRatio, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
import type {
CreativeProfileAspectRatio,
GenerationModelCatalog,
GenerationOptions
} from '../../generation-config/types'
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
import { AppDialog } from '../../../components/ui'
import { AppDialog, FieldLabel } from '../../../components/ui'
import { errorMessage } from '../../../lib/http'
import { productionApi } from '../api'
import type { GenerateKeyframeInput, KeyframeGenerationPreview } from '../types'
@@ -107,8 +111,12 @@ async function loadPreview() {
当前主首帧使用的主体参考资产已经变化。新图成功后应设为主首帧,旧图会继续保留为历史候选。
</NAlert>
<section v-if="generationCatalog" class="dialog-section mt-5" aria-label="本次首帧生成模型设置">
<p class="text-xs font-medium">本次生成设置</p>
<p class="mt-1 text-xs text-muted">仅覆盖当前镜头本次首帧生成,不修改项目默认图片模型。</p>
<p class="text-xs font-medium">
<FieldLabel
label="本次生成设置"
description="仅覆盖当前镜头本次首帧生成,不修改项目默认图片模型。"
/>
</p>
<GenerationModelControls
class="mt-4"
type="image"
@@ -175,8 +183,10 @@ async function loadPreview() {
</NCheckbox>
</AppForm>
<template #footer>
<NButton @click="open = false">取消</NButton>
<NButton :disabled="disabled || !confirmed" @click="formRef?.validate(submit)" type="primary">确认生成首帧</NButton>
<NButton @click="open = false">取消</NButton>
<NButton :disabled="disabled || !confirmed" @click="formRef?.validate(submit)" type="primary"
>确认生成首帧</NButton
>
</template>
</AppDialog>
</template>
@@ -1,7 +1,7 @@
<script setup lang="ts">
import ProviderInputInspector from './ProviderInputInspector.vue'
import { NAlert, NButton, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
import { computed, onMounted, ref, watch } from 'vue'
import { computed, ref, watch } from 'vue'
import { ExternalLink, ImagePlus, RefreshCw } from '@lucide/vue'
import { AssetImage, StatusBadge } from '../../../components/ui'
import { usePolling } from '../../../composables/usePolling'
@@ -39,6 +39,7 @@ import { AppDialog } from '../../../components/ui'
import ModelCapabilities from './ModelCapabilities.vue'
import type { QualityTarget } from '../quality.types'
import { sessionKeyframePassed, sessionVideoValidation } from '../quality'
import { useProjectGenerationRevision } from '../../generation-config/context'
import { generationConfigApi } from '../../generation-config/api'
import type {
CreativeProfileAspectRatio,
@@ -156,25 +157,35 @@ const videoGenerationOptions = ref<GenerationOptions>({})
const videoInputModeOverride = ref<'auto' | 'first_frame' | 'omni_reference'>('auto')
const projectAspectRatio = ref<CreativeProfileAspectRatio>('9:16')
/** 单镜手动生成默认继承项目配置,用户修改只作用于本次请求。 */
onMounted(async () => {
try {
const [catalog, profile] = await Promise.all([
generationConfigApi.catalog(),
generationConfigApi.profile(props.projectId)
])
generationCatalog.value = catalog
projectAspectRatio.value = profile?.aspectRatio ?? '9:16'
videoProvider.value = profile?.videoProvider || catalog.defaults.videoProvider
const selected = catalog.videos.find(item => item.provider === videoProvider.value)
videoGenerationOptions.value = {
...selected?.defaults,
...profile?.videoOptions
/** 项目配置成功保存后同步当前单镜头默认参数。 */
const generationRevision = useProjectGenerationRevision()
/** 单镜手动生成默认继承项目配置,用户修改只作用于本次请求;取消旧项目响应。 */
watch(
[() => props.projectId, generationRevision],
async ([projectId], _previous, onCleanup) => {
const controller = new AbortController()
onCleanup(() => controller.abort())
generationCatalogError.value = ''
try {
const [catalog, profile] = await Promise.all([
generationConfigApi.catalog(controller.signal),
generationConfigApi.profile(projectId, controller.signal)
])
if (controller.signal.aborted) return
generationCatalog.value = catalog
projectAspectRatio.value = profile?.aspectRatio ?? '9:16'
videoProvider.value = profile?.videoProvider || catalog.defaults.videoProvider
const selected = catalog.videos.find(item => item.provider === videoProvider.value)
videoGenerationOptions.value = {
...selected?.defaults,
...profile?.videoOptions
}
} catch (cause) {
if (!controller.signal.aborted) generationCatalogError.value = errorMessage(cause)
}
} catch (cause) {
generationCatalogError.value = errorMessage(cause)
}
})
},
{ immediate: true }
)
/** 从实际候选打开质量面板,保留单镜头主操作。 */
function openQuality(kind: 'keyframe' | 'video', assetId: string) {
@@ -385,15 +396,6 @@ async function inspectSpecs() {
:items="[{ key: 'specs', label: '检查生成规格与模型限制', disabled: inspecting }]"
@select="inspectSpecs"
/>
<NButton
:disabled="query.loading.value"
@click="refreshAll"
quaternary
class="icon-button"
aria-label="刷新资产"
title="刷新资产"
><RefreshCw :size="16" :class="{ 'animate-spin': query.loading.value }" />
</NButton>
</div>
</div>
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
+9 -8
View File
@@ -1,3 +1,4 @@
import { useShotSelection } from '../storyboard/useShotSelection'
import type { KeyframeBatchResult } from './types'
import type { PromptBatchResult } from '../storyboard/types'
import { computed, ref, watch } from 'vue'
@@ -21,10 +22,8 @@ export function useProduction() {
const context = useProjectContext()
/** 当前工作区的响应式状态或派生业务条件。 */
const id = computed(() => context.project.value?.id ?? '')
/** 当前工作区的响应式状态或派生业务条件。 */
const selectedEpisode = ref<number>()
/** 当前工作区的响应式状态或派生业务条件。 */
const selectedShot = ref('')
/** 两个镜头工作区共用地址选择,刷新恢复同一正式镜头。 */
const { selectedEpisode, selectedShot } = useShotSelection(() => episodeNo.value)
/** 当前工作区的响应式状态或派生业务条件。 */
const concurrency = ref(2)
/** 当前工作区的响应式状态或派生业务条件。 */
@@ -68,7 +67,7 @@ export function useProduction() {
)
/** 当前工作区的响应式状态或派生业务条件。 */
const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value, force.value]))
/** 生产页已有刷新按钮,就绪状态改为手动更新。 */
/** 就绪状态在进入、切集或自身操作完成后读取,不定时刷新。 */
const query = usePolling(
queryKey,
async (key, signal) => {
@@ -112,10 +111,12 @@ export function useProduction() {
const episodeSourceUnavailable = computed(
() => !!getStoryboardSession(id.value).invalidatedEpisodeSources[episodeNo.value]
)
/** 当前工作区的响应式状态或派生业务条件。 */
/** 当前剧集的正式镜头目录。 */
const shots = computed(() => mergeDesignedShots(query.data.value?.directions ?? null, null, source.value))
/** 当前工作区的响应式状态或派生业务条件。 */
const shot = computed(() => shots.value.find(item => item.shotId === selectedShot.value) ?? shots.value[0])
/** 明确指定的镜头不存在时不代选其它镜头;首次进入才选择第一镜。 */
const shot = computed(() =>
selectedShot.value ? shots.value.find(item => item.shotId === selectedShot.value) : shots.value[0]
)
/** 当前工作区的响应式状态或派生业务条件。 */
const promptItem = computed(() => query.data.value?.prompts.items.find(item => item.shotId === shot.value?.shotId))
/** 当前工作区的响应式状态或派生业务条件。 */