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

+10 -13
View File
@@ -7,7 +7,7 @@ import ActionMenu from '../../components/ui/ActionMenu.vue'
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
import { NScrollbar, NAlert, NButton, NCheckbox, NInputNumber, NProgress, NSelect, NTab, NTabs } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { ArrowLeft, RefreshCw } from '@lucide/vue'
import { ArrowLeft } from '@lucide/vue'
import { EmptyState } from '../../components/ui'
import { downloadText } from '../../lib/format'
import ConfirmAction from '../workflows/ConfirmAction.vue'
@@ -177,15 +177,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
</div>
<div class="toolbar-actions">
<div class="flex gap-3">
<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>
<ActionMenu
label="分镜更多操作"
:items="[{ key: 'export', label: '导出本集', disabled: !shots.length }]"
@@ -441,7 +432,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
<div v-if="!data && query.loading.value" class="panel p-8 text-sm text-muted" role="status">
正在读取正式分镜数据……
</div>
<div v-else-if="shot" class="panel storyboard-workspace workspace-surface">
<div v-else-if="shots.length" class="panel storyboard-workspace workspace-surface">
<nav class="shot-list directory-panel" aria-label="本集镜头">
<div class="directory-heading">
<h3>
@@ -456,7 +447,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
>
<BeatShotDirectory
:shots="shots"
:active-id="shot.shotId"
:active-id="shot?.shotId || ''"
item-class="shot-link"
@select="selectedShot = $event"
>
@@ -468,7 +459,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
</NScrollbar>
</nav>
<article class="storyboard-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-6">
<p class="eyebrow">
BEAT {{ shot.beatNo }} / SHOT {{ shot.shotNo }}
@@ -502,6 +493,12 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
</div>
</div>
</NScrollbar>
<!-- 以下是无效镜头地址的定位反馈模块 -->
<EmptyState
v-if="!shot"
title="链接中的镜头已不存在或不属于本集"
description="请在左侧目录重新选择镜头。"
/>
</article>
</div>
<EmptyState
@@ -0,0 +1,67 @@
import { computed, inject, ref, watch } from 'vue'
import { routeLocationKey, routerKey } from 'vue-router'
import type { LocationQueryRaw } from 'vue-router'
import { queryText } from '../production/asset-links'
/**
* 镜头选择与地址同步;初次读取及浏览器导航恢复正式 ID,切集清除上集镜头。
* @param currentEpisode 当前有效剧集,选择镜头时用于补全深链接
* @returns 可写的剧集和镜头选择状态
*/
export function useShotSelection(currentEpisode: () => number) {
/** 当前页面地址,非路由环境保留本地选择。 */
const route = inject(routeLocationKey, undefined)
/** 当前路由导航器,替换选择参数不产生逐镜头历史。 */
const router = inject(routerKey, undefined)
/** 当前选择的剧集,缺省时由页面决定首次有效剧集。 */
const episode = ref<number>()
/** 当前选择的正式镜头 ID。 */
const shotId = ref('')
/** 地址变化只读取选择,不触发反向写入或重置其它参数。 */
watch(
() => [route?.query.episodeNo, route?.query.shotId],
() => {
const number = Number(queryText(route?.query.episodeNo))
episode.value = Number.isSafeInteger(number) && number > 0 ? number : undefined
shotId.value = queryText(route?.query.shotId)
},
{ immediate: true, flush: 'sync' }
)
/**
* 仅替换当前页面的选择参数,保留来源动作、筛选参数与 hash。
* @param query 更新后的地址参数
*/
function replaceSelection(query: LocationQueryRaw) {
if (router && route) void router.replace({ path: route.path, query, hash: route.hash })
}
/** 切换剧集立即清除旧镜头,避免把上集 ID 带到下集。 */
const selectedEpisode = computed({
get: () => episode.value,
set: (number: number | undefined) => {
episode.value = number
shotId.value = ''
const query: LocationQueryRaw = { ...route?.query }
delete query.shotId
if (number && Number.isSafeInteger(number) && number > 0) query.episodeNo = String(number)
else delete query.episodeNo
replaceSelection(query)
}
})
/** 选择镜头同时写入有效剧集和正式 ID,刷新后按地址恢复。 */
const selectedShot = computed({
get: () => shotId.value,
set: (value: string) => {
shotId.value = value.trim()
const query: LocationQueryRaw = { ...route?.query }
const number = currentEpisode()
if (Number.isSafeInteger(number) && number > 0) query.episodeNo = String(number)
if (shotId.value) query.shotId = shotId.value
else delete query.shotId
replaceSelection(query)
}
})
return { selectedEpisode, selectedShot }
}
+8 -7
View File
@@ -1,3 +1,4 @@
import { useShotSelection } from './useShotSelection'
import { useWorkflowExecution } from '../workflows/execution'
import type { StoryboardBatchResult, PromptBatchResult, StoryboardShotRegenerationResult } from './types'
import { computed, ref, watch } from 'vue'
@@ -22,10 +23,8 @@ export function useStoryboard() {
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)
/** 当前工作区的响应式状态或派生业务条件。 */
@@ -88,12 +87,14 @@ export function useStoryboard() {
)
/** 重生成接口未返回新正文时,明确标记辅助剧情信息不可用。 */
const episodeSourceUnavailable = computed(() => !!session.value.invalidatedEpisodeSources[episodeNo.value])
/** 当前工作区的响应式状态或派生业务条件。 */
/** 当前剧集的正式镜头目录。 */
const shots = computed(() =>
mergeDesignedShots(data.value?.directions ?? null, data.value?.visualStates ?? 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 prerequisites = computed(() => storyboardPrerequisites(context.checkpoints.value, episodeNo.value))
/** 当前工作区的响应式状态或派生业务条件。 */