feat(short-drama-agent-front): 完善镜头定位与项目配置
This commit is contained in:
1 parent
470b52e26d
commit
5b134207b8
66 files changed
+2042
-984
No files matched your search
+5
-1
@@ -145,7 +145,11 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
disabled
|
||||
? h(
|
||||
'span',
|
||||
{ class: 'admin-menu-label', title: sectionAccess?.reason || '请先完成前面的制作步骤', 'aria-disabled': 'true' },
|
||||
{
|
||||
class: 'admin-menu-label',
|
||||
title: sectionAccess?.reason || '请先完成前面的制作步骤',
|
||||
'aria-disabled': 'true'
|
||||
},
|
||||
label
|
||||
)
|
||||
: h(RouterLink, { to: target }, () =>
|
||||
|
||||
@@ -2,14 +2,29 @@
|
||||
import { NModal, NScrollbar } from 'naive-ui'
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
|
||||
/** Naive UI 管理焦点锁定、Esc、遮罩与主题;长弹窗只滚动内部正文。 */
|
||||
defineProps<{ title: string; description: string; busy?: boolean; wide?: boolean }>()
|
||||
/** 公共弹窗的标题、说明、操作状态和宽度。 */
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
/** 弹窗标题,同时作为可访问名称。 */
|
||||
title: string
|
||||
/** 标题下的默认说明,可使用 description slot 覆盖。 */
|
||||
description?: string
|
||||
/** 提交期间锁定关闭操作。 */
|
||||
busy?: boolean
|
||||
/** 使用宽弹窗布局。 */
|
||||
wide?: boolean
|
||||
}>(),
|
||||
{ description: '', busy: false, wide: false }
|
||||
)
|
||||
/** 弹窗显隐状态,关闭行为由 Naive 管理。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 正文测量锚点,不包含固定 header 与 footer。 */
|
||||
const bodyAnchor = ref<HTMLElement | null>(null)
|
||||
/** 可用正文滚动高度。 */
|
||||
const bodyHeight = ref(0)
|
||||
let layoutObserver: ResizeObserver | undefined
|
||||
|
||||
/** 正文使用内容高度与剩余视口高度的较小值;为 NScrollbar 提供明确滚动高度。 */
|
||||
/** 正文使用内容高度与剩余视口高度的较小值,扣除固定标题、说明与 footer。 */
|
||||
function updateBodyHeight() {
|
||||
const card = bodyAnchor.value?.closest('.app-dialog')
|
||||
const scrollContent = bodyAnchor.value?.parentElement
|
||||
@@ -20,27 +35,34 @@ function updateBodyHeight() {
|
||||
const contentStyle = content ? getComputedStyle(content) : null
|
||||
const available = Math.max(
|
||||
0,
|
||||
window.innerHeight - 32 - (header?.offsetHeight ?? 0) - (footer?.offsetHeight ?? 0)
|
||||
- (contentStyle ? parseFloat(contentStyle.paddingTop) + parseFloat(contentStyle.paddingBottom) : 0)
|
||||
- 2
|
||||
window.innerHeight -
|
||||
32 -
|
||||
(header?.offsetHeight ?? 0) -
|
||||
(footer?.offsetHeight ?? 0) -
|
||||
(contentStyle ? parseFloat(contentStyle.paddingTop) + parseFloat(contentStyle.paddingBottom) : 0) -
|
||||
2
|
||||
)
|
||||
bodyHeight.value = Math.min(scrollContent.scrollHeight, available)
|
||||
}
|
||||
watch(open, async shown => {
|
||||
layoutObserver?.disconnect()
|
||||
if (!shown) return
|
||||
await nextTick()
|
||||
updateBodyHeight()
|
||||
const card = bodyAnchor.value?.closest('.app-dialog')
|
||||
const scrollContent = bodyAnchor.value?.parentElement
|
||||
if (!card || !scrollContent) return
|
||||
layoutObserver = new ResizeObserver(updateBodyHeight)
|
||||
const header = card.querySelector('.n-card-header')
|
||||
const footer = card.querySelector('.n-card__footer')
|
||||
if (header) layoutObserver.observe(header)
|
||||
if (footer) layoutObserver.observe(footer)
|
||||
layoutObserver.observe(scrollContent)
|
||||
}, { flush: 'post' })
|
||||
watch(
|
||||
open,
|
||||
async shown => {
|
||||
layoutObserver?.disconnect()
|
||||
if (!shown) return
|
||||
await nextTick()
|
||||
updateBodyHeight()
|
||||
const card = bodyAnchor.value?.closest('.app-dialog')
|
||||
const scrollContent = bodyAnchor.value?.parentElement
|
||||
if (!card || !scrollContent) return
|
||||
layoutObserver = new ResizeObserver(updateBodyHeight)
|
||||
const header = card.querySelector('.n-card-header')
|
||||
const footer = card.querySelector('.n-card__footer')
|
||||
if (header) layoutObserver.observe(header)
|
||||
if (footer) layoutObserver.observe(footer)
|
||||
layoutObserver.observe(scrollContent)
|
||||
},
|
||||
{ flush: 'post', immediate: true }
|
||||
)
|
||||
onMounted(() => window.addEventListener('resize', updateBodyHeight))
|
||||
onBeforeUnmount(() => {
|
||||
layoutObserver?.disconnect()
|
||||
@@ -53,7 +75,6 @@ onBeforeUnmount(() => {
|
||||
<NModal
|
||||
v-model:show="open"
|
||||
preset="card"
|
||||
:title="title"
|
||||
:closable="!busy"
|
||||
:mask-closable="!busy"
|
||||
:close-on-esc="!busy"
|
||||
@@ -62,9 +83,18 @@ onBeforeUnmount(() => {
|
||||
role="dialog"
|
||||
:aria-label="title"
|
||||
>
|
||||
<!-- 以下是固定标题与说明模块,说明位于标题下并可自定义 -->
|
||||
<template #header>
|
||||
<div class="min-w-0">
|
||||
<div class="text-lg font-semibold">{{ title }}</div>
|
||||
<div v-if="description || $slots.description" class="mt-[2px] text-sm leading-6 font-normal text-muted">
|
||||
<slot name="description">{{ description }}</slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 以下是弹窗正文滚动模块 -->
|
||||
<NScrollbar class="dialog-body-scroll" :style="{ height: bodyHeight + 'px' }">
|
||||
<span ref="bodyAnchor" class="dialog-body-anchor" aria-hidden="true" />
|
||||
<p v-if="description" class="text-sm leading-6 text-muted">{{ description }}</p>
|
||||
<slot />
|
||||
</NScrollbar>
|
||||
<template v-if="$slots.footer" #footer>
|
||||
@@ -86,9 +116,8 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
|
||||
.app-dialog .n-card-header {
|
||||
@apply shrink-0;
|
||||
@apply shrink-0 items-start;
|
||||
}
|
||||
|
||||
/* 正文容器可收缩,滚动高度由内容与剩余视口共同确定。 */
|
||||
.app-dialog .n-card-content {
|
||||
@apply min-h-0 overflow-hidden;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { NPopover } from 'naive-ui'
|
||||
import type { PopoverProps } from 'naive-ui'
|
||||
import { CircleHelp } from '@lucide/vue'
|
||||
|
||||
/** 字段标签与按需打开的说明,适用于项目配置和各类生成表单。 */
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
/** 字段标签,保持实际文案与必填标记。 */
|
||||
label: string
|
||||
/** 原有字段说明,没有说明时不显示提示图标。 */
|
||||
description?: string
|
||||
/** 提示位置可按字段单独指定,默认居中显示在图标上方。 */
|
||||
placement?: PopoverProps['placement']
|
||||
}>(),
|
||||
{ placement: 'top' }
|
||||
)
|
||||
/** 点击或键盘激活提示按钮时打开说明,点击外部后关闭。 */
|
||||
const open = ref(false)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是字段标签与说明提示模块 -->
|
||||
<span class="inline-flex min-w-0 items-center gap-1.5">
|
||||
<span>{{ label }}</span>
|
||||
<!-- 浮层挂到视口层,按字段指定位置并自动翻转,避免被弹窗滚动容器裁剪。 -->
|
||||
<NPopover v-if="description" v-model:show="open" trigger="click" :placement="placement" :to="true" :flip="true">
|
||||
<template #trigger>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex size-4 shrink-0 items-center justify-center text-muted hover:text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current"
|
||||
:aria-label="`${label}说明`"
|
||||
:aria-expanded="open"
|
||||
@click.stop
|
||||
>
|
||||
<CircleHelp :size="14" aria-hidden="true" />
|
||||
</button>
|
||||
</template>
|
||||
<div class="max-w-[min(360px,calc(100vw-48px))] whitespace-pre-wrap break-words text-xs leading-5">
|
||||
{{ description }}
|
||||
</div>
|
||||
</NPopover>
|
||||
</span>
|
||||
</template>
|
||||
@@ -62,5 +62,3 @@ const open = defineModel<boolean>('open', { default: false })
|
||||
@apply grid-cols-[repeat(auto-fit,_minmax(min(100%,_230px),_1fr))];
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/** 公共 UI 的统一导出入口。 */
|
||||
export { default as FieldLabel } from './FieldLabel.vue'
|
||||
export { default as AppDialog } from './AppDialog.vue'
|
||||
export { default as EmptyState } from './EmptyState.vue'
|
||||
export { default as StatusBadge } from './StatusBadge.vue'
|
||||
|
||||
@@ -78,4 +78,3 @@ export function usePolling<T>(
|
||||
})
|
||||
return { data, loading, error, updatedAt, refresh }
|
||||
}
|
||||
|
||||
@@ -263,4 +263,3 @@ export function useTheme() {
|
||||
})
|
||||
return { preference, isDark, theme, overrides }
|
||||
}
|
||||
|
||||
@@ -105,14 +105,15 @@ function exportScript() {
|
||||
:loading="backgroundExecution.query.loading.value"
|
||||
:error="backgroundExecution.query.error.value"
|
||||
@refresh="backgroundExecution.query.refresh"
|
||||
@dismiss="backgroundExecution.dismiss"
|
||||
/>
|
||||
@dismiss="backgroundExecution.dismiss" />
|
||||
<div v-if="!complete" class="mt-5 flex flex-wrap items-center justify-between gap-4">
|
||||
<p class="text-sm text-muted">
|
||||
已写入 {{ episodes.length }}<span v-if="total"> / {{ total }}</span> 集<span v-if="!total">
|
||||
· 等待计划集数</span
|
||||
>。{{
|
||||
project?.status === 'generating' ? '剧本仍在生成,请等待状态更新。' : '如中途停止,可从当前阶段继续。'
|
||||
project?.status === 'generating'
|
||||
? '剧本仍在生成,请等待状态更新。'
|
||||
: '如中途停止,可从当前阶段继续。'
|
||||
}}
|
||||
</p>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
|
||||
@@ -10,43 +10,86 @@ import type {
|
||||
GenerationModelItem,
|
||||
GenerationOptions
|
||||
} from '../types'
|
||||
import { creativeProfileDraft, creativeProfileIssues } from '../profile-draft'
|
||||
import { useProjectGenerationRevision } from '../context'
|
||||
import GenerationOptionFields from './GenerationOptionFields.vue'
|
||||
|
||||
const props = defineProps<{ projectId: string }>()
|
||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput] }>()
|
||||
/** 项目配置表单参数。 */
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 当前项目 ID。 */
|
||||
projectId: string
|
||||
/** 弹窗由公共 footer 提供保存操作,隐藏表单自身操作区。 */
|
||||
hideActions?: boolean
|
||||
/** 有项目操作时禁止编辑和保存配置。 */
|
||||
disabled?: boolean
|
||||
}>(),
|
||||
{ hideActions: false, disabled: false }
|
||||
)
|
||||
/** 保存后的实际配置与保存状态通知。 */
|
||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput]; busy: [saving: boolean] }>()
|
||||
/** 成功保存后通知当前项目生成表单更新默认值。 */
|
||||
const revision = useProjectGenerationRevision()
|
||||
|
||||
/** 配置和模型目录读取状态。 */
|
||||
const loading = ref(false)
|
||||
/** 配置保存状态。 */
|
||||
const saving = ref(false)
|
||||
/** 读取或保存错误。 */
|
||||
const error = ref('')
|
||||
/** 真实保存结果提示。 */
|
||||
const notice = ref('')
|
||||
/** 后端支持的图片与视频模型目录。 */
|
||||
const catalog = ref<GenerationModelCatalog | null>(null)
|
||||
/** 当前项目的独立编辑草稿。 */
|
||||
const profile = ref<CreativeProfileInput | null>(null)
|
||||
/** 当前读取请求控制器。 */
|
||||
let controller: AbortController | null = null
|
||||
/** 组件销毁后忽略迟到保存响应,不更新新项目配置修订号。 */
|
||||
let disposed = false
|
||||
|
||||
/** 项目画布支持的宽高比选项。 */
|
||||
const aspectRatios = ['9:16', '16:9', '1:1', '4:3', '3:4'].map(value => ({ label: value, value }))
|
||||
/** 当前可用的图片模型。 */
|
||||
const enabledImages = computed(() => catalog.value?.images?.filter(item => item.enabled && item.model) ?? [])
|
||||
/** 当前可用的视频模型。 */
|
||||
const enabledVideos = computed(() => catalog.value?.videos?.filter(item => item.enabled && item.model) ?? [])
|
||||
/** 当前图片模型的组合选项值。 */
|
||||
const imageSelection = computed(() =>
|
||||
profile.value ? selectionValue(profile.value.imageProvider, profile.value.imageModel) : null
|
||||
)
|
||||
/** 当前视频模型的组合选项值。 */
|
||||
const videoSelection = computed(() =>
|
||||
profile.value ? selectionValue(profile.value.videoProvider, profile.value.videoModel) : null
|
||||
)
|
||||
/** 图片模型对应的参数 schema。 */
|
||||
const imageModel = computed(() =>
|
||||
enabledImages.value.find(item =>
|
||||
profile.value ? item.provider === profile.value.imageProvider && item.model === profile.value.imageModel : false
|
||||
)
|
||||
)
|
||||
/** 视频模型对应的参数 schema。 */
|
||||
const videoModel = computed(() =>
|
||||
enabledVideos.value.find(item =>
|
||||
profile.value ? item.provider === profile.value.videoProvider && item.model === profile.value.videoModel : false
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* 组合供应方与模型,避免同名模型混淆。
|
||||
* @param provider 模型供应方
|
||||
* @param model 模型名称
|
||||
* @returns 下拉选项唯一值
|
||||
*/
|
||||
function selectionValue(provider: string, model: string) {
|
||||
return `${provider}\u0000${model}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 将实际模型目录转成下拉选项。
|
||||
* @param items 当前媒介模型列表
|
||||
* @returns 模型下拉选项
|
||||
*/
|
||||
function modelOptions(items: GenerationModelItem[]) {
|
||||
return items.map(item => ({
|
||||
label: `${item.providerLabel} · ${item.modelLabel}`,
|
||||
@@ -54,6 +97,11 @@ function modelOptions(items: GenerationModelItem[]) {
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* 依据目标模型 schema 创建合法初始参数。
|
||||
* @param item 当前模型
|
||||
* @returns 模型初始参数
|
||||
*/
|
||||
function defaultOptions(item: GenerationModelItem): GenerationOptions {
|
||||
return Object.fromEntries(
|
||||
item.generationOptions.flatMap(schema => {
|
||||
@@ -75,22 +123,11 @@ function defaultOptions(item: GenerationModelItem): GenerationOptions {
|
||||
)
|
||||
}
|
||||
|
||||
/** 把历史 Profile 中已不属于当前模型 Schema 的参数收敛为当前模型默认值。 */
|
||||
function normalizeSavedOptions(item: GenerationModelItem | undefined, saved: GenerationOptions): GenerationOptions {
|
||||
if (!item) return { ...saved }
|
||||
const defaults = defaultOptions(item)
|
||||
const normalized = { ...saved }
|
||||
for (const schema of item.generationOptions) {
|
||||
const value = normalized[schema.key]
|
||||
if (schema.type !== 'size' || typeof value !== 'string' || !schema.options?.length) continue
|
||||
if (schema.options.some(option => option.value === value)) continue
|
||||
const fallback = defaults[schema.key]
|
||||
if (fallback !== undefined) normalized[schema.key] = fallback
|
||||
else delete normalized[schema.key]
|
||||
}
|
||||
return normalized
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换模型时清空上一模型参数。
|
||||
* @param type 图片或视频媒介
|
||||
* @param value 下拉选项唯一值
|
||||
*/
|
||||
function selectModel(type: 'image' | 'video', value: string) {
|
||||
if (!profile.value) return
|
||||
const items = type === 'image' ? enabledImages.value : enabledVideos.value
|
||||
@@ -107,6 +144,11 @@ function selectModel(type: 'image' | 'video', value: string) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 未配置项目使用后端可用默认模型初始化草稿。
|
||||
* @param nextCatalog 当前模型目录
|
||||
* @returns 初始项目配置,无完整模型时返回 null
|
||||
*/
|
||||
function createInitial(nextCatalog: GenerationModelCatalog): CreativeProfileInput | null {
|
||||
const image =
|
||||
nextCatalog.images.find(item => item.enabled && item.isDefault && item.model) ??
|
||||
@@ -126,139 +168,153 @@ function createInitial(nextCatalog: GenerationModelCatalog): CreativeProfileInpu
|
||||
}
|
||||
}
|
||||
|
||||
/** 读取实际目录与项目配置,取消旧目标请求并忽略迟到响应。 */
|
||||
async function load() {
|
||||
controller?.abort()
|
||||
controller = new AbortController()
|
||||
const signal = controller.signal
|
||||
const projectId = props.projectId
|
||||
profile.value = null
|
||||
catalog.value = null
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
notice.value = ''
|
||||
try {
|
||||
const [nextCatalog, saved] = await Promise.all([
|
||||
generationConfigApi.catalog(controller.signal),
|
||||
generationConfigApi.profile(props.projectId, controller.signal)
|
||||
generationConfigApi.catalog(signal),
|
||||
generationConfigApi.profile(projectId, signal)
|
||||
])
|
||||
if (signal.aborted || props.projectId !== projectId) return
|
||||
if (saved && saved.projectId !== projectId) throw new Error('项目配置返回了不匹配的项目。')
|
||||
catalog.value = nextCatalog
|
||||
const savedImageModel = saved
|
||||
? nextCatalog.images.find(
|
||||
item => item.provider === saved.imageProvider && item.model === saved.imageModel
|
||||
)
|
||||
: undefined
|
||||
const savedVideoModel = saved
|
||||
? nextCatalog.videos.find(
|
||||
item => item.provider === saved.videoProvider && item.model === saved.videoModel
|
||||
)
|
||||
: undefined
|
||||
profile.value = saved
|
||||
? {
|
||||
aspectRatio: saved.aspectRatio,
|
||||
imageProvider: saved.imageProvider,
|
||||
imageModel: saved.imageModel,
|
||||
imageOptions: normalizeSavedOptions(savedImageModel, saved.imageOptions),
|
||||
videoProvider: saved.videoProvider,
|
||||
videoModel: saved.videoModel,
|
||||
videoOptions: normalizeSavedOptions(savedVideoModel, saved.videoOptions)
|
||||
}
|
||||
: createInitial(nextCatalog)
|
||||
profile.value = saved ? creativeProfileDraft(saved) : createInitial(nextCatalog)
|
||||
} catch (cause) {
|
||||
if (!controller.signal.aborted) error.value = errorMessage(cause)
|
||||
if (!signal.aborted && props.projectId === projectId) error.value = errorMessage(cause)
|
||||
} finally {
|
||||
if (!controller.signal.aborted) loading.value = false
|
||||
if (!signal.aborted && props.projectId === projectId) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 保存独立配置快照,不因路由变化把结果写入其它项目。 */
|
||||
async function save() {
|
||||
if (!profile.value || saving.value) return
|
||||
if (!canSave.value || !profile.value) return
|
||||
const projectId = props.projectId
|
||||
const input = creativeProfileDraft(profile.value)
|
||||
saving.value = true
|
||||
error.value = ''
|
||||
notice.value = ''
|
||||
try {
|
||||
const saved = await generationConfigApi.saveProfile(props.projectId, profile.value)
|
||||
profile.value = {
|
||||
aspectRatio: saved.aspectRatio,
|
||||
imageProvider: saved.imageProvider,
|
||||
imageModel: saved.imageModel,
|
||||
imageOptions: { ...saved.imageOptions },
|
||||
videoProvider: saved.videoProvider,
|
||||
videoModel: saved.videoModel,
|
||||
videoOptions: { ...saved.videoOptions }
|
||||
}
|
||||
const saved = await generationConfigApi.saveProfile(projectId, input)
|
||||
if (disposed || props.projectId !== projectId) return
|
||||
if (saved.projectId !== projectId) throw new Error('保存结果与当前项目不匹配,请重新读取配置。')
|
||||
profile.value = creativeProfileDraft(saved)
|
||||
notice.value = '项目生成配置已保存,后续首帧和视频生成会继承此配置。'
|
||||
revision.value++
|
||||
emit('saved', profile.value)
|
||||
} catch (cause) {
|
||||
error.value = errorMessage(cause)
|
||||
if (!disposed && props.projectId === projectId) error.value = errorMessage(cause)
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 按后端实际 schema 展示不兼容参数,不静默替换用户已保存的值。 */
|
||||
const validationIssues = computed(() =>
|
||||
profile.value && catalog.value ? creativeProfileIssues(profile.value, catalog.value) : []
|
||||
)
|
||||
/** 有实际项目草稿、完整可用模型且无进行中的项目操作才允许保存。 */
|
||||
const canSave = computed(
|
||||
() =>
|
||||
!props.disabled &&
|
||||
!loading.value &&
|
||||
!saving.value &&
|
||||
!!profile.value &&
|
||||
!!enabledImages.value.length &&
|
||||
!!enabledVideos.value.length &&
|
||||
!validationIssues.value.length
|
||||
)
|
||||
/** 向弹窗 footer 暴露同一个保存入口,避免复制表单与请求逻辑。 */
|
||||
defineExpose({ save, canSave })
|
||||
|
||||
/** 保存状态同步给弹窗,保存完成前禁止关闭。 */
|
||||
watch(saving, value => emit('busy', value), { flush: 'sync' })
|
||||
/** 项目变化时重新读取配置。 */
|
||||
watch(() => props.projectId, load, { immediate: true })
|
||||
onScopeDispose(() => controller?.abort())
|
||||
onScopeDispose(() => {
|
||||
disposed = true
|
||||
controller?.abort()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是项目画布与图片、视频模型配置模块 -->
|
||||
<section class="production-tool-section creative-profile-settings workspace-panel">
|
||||
<h3 class="text-sm font-semibold">项目画布与生成模型</h3>
|
||||
<h3 v-if="!hideActions" class="text-sm font-semibold">项目画布与生成模型</h3>
|
||||
<NSpin :show="loading">
|
||||
<NAlert v-if="error" type="error" :show-icon="false" class="mb-3">{{ error }}</NAlert>
|
||||
<NAlert v-if="notice" type="success" :show-icon="false" class="mb-3">{{ notice }}</NAlert>
|
||||
<NAlert
|
||||
v-if="!loading && (!enabledImages.length || !enabledVideos.length)"
|
||||
type="warning"
|
||||
:show-icon="false"
|
||||
>
|
||||
当前没有可用的完整图片和视频模型,暂时无法保存项目生成配置。
|
||||
</NAlert>
|
||||
<div v-if="profile" class="creative-profile-grid">
|
||||
<NFormItem label="作品宽高比">
|
||||
<NAlert v-if="disabled" type="info" :show-icon="false" class="mb-3"
|
||||
>项目正在执行制作任务,完成后可以修改配置。</NAlert
|
||||
>
|
||||
<NAlert v-if="error" type="error" :show-icon="false" class="mb-3">{{ error }}</NAlert>
|
||||
<NAlert v-if="validationIssues.length" type="warning" :show-icon="false" class="mb-3">
|
||||
<p v-for="issue in validationIssues" :key="issue">{{ issue }}</p>
|
||||
</NAlert>
|
||||
<NAlert v-if="notice" type="success" :show-icon="false" class="mb-3">{{ notice }}</NAlert>
|
||||
<NAlert
|
||||
v-if="!loading && (!enabledImages.length || !enabledVideos.length)"
|
||||
type="warning"
|
||||
:show-icon="false"
|
||||
>
|
||||
当前没有可用的完整图片和视频模型,暂时无法保存项目生成配置。
|
||||
</NAlert>
|
||||
<div v-if="profile" class="creative-profile-grid">
|
||||
<NFormItem label="作品宽高比">
|
||||
<NSelect
|
||||
:value="profile.aspectRatio"
|
||||
:options="aspectRatios"
|
||||
:disabled="saving || disabled"
|
||||
@update:value="profile.aspectRatio = $event as CreativeProfileAspectRatio"
|
||||
/>
|
||||
</NFormItem>
|
||||
<div></div>
|
||||
<!-- 以下是项目图片生成配置模块 -->
|
||||
<section class="model-section min-w-0 pt-5">
|
||||
<h3 class="mb-4 text-sm font-semibold">图片配置</h3>
|
||||
<NFormItem label="图片模型">
|
||||
<NSelect
|
||||
:value="profile.aspectRatio"
|
||||
:options="aspectRatios"
|
||||
:disabled="saving"
|
||||
@update:value="profile.aspectRatio = $event as CreativeProfileAspectRatio"
|
||||
:value="imageSelection"
|
||||
:options="modelOptions(enabledImages)"
|
||||
:disabled="saving || disabled"
|
||||
@update:value="selectModel('image', $event)"
|
||||
/>
|
||||
</NFormItem>
|
||||
<div></div>
|
||||
<section class="model-section">
|
||||
<NFormItem label="图片模型">
|
||||
<NSelect
|
||||
:value="imageSelection"
|
||||
:options="modelOptions(enabledImages)"
|
||||
:disabled="saving"
|
||||
@update:value="selectModel('image', $event)"
|
||||
/>
|
||||
</NFormItem>
|
||||
<GenerationOptionFields
|
||||
v-model="profile.imageOptions"
|
||||
:schemas="imageModel?.generationOptions || []"
|
||||
:disabled="saving"
|
||||
<GenerationOptionFields
|
||||
v-model="profile.imageOptions"
|
||||
:schemas="imageModel?.generationOptions || []"
|
||||
:disabled="saving || disabled"
|
||||
/>
|
||||
</section>
|
||||
<!-- 以下是项目视频生成配置模块 -->
|
||||
<section class="model-section min-w-0 pt-5">
|
||||
<h3 class="mb-4 text-sm font-semibold">视频配置</h3>
|
||||
<NFormItem label="视频模型">
|
||||
<NSelect
|
||||
:value="videoSelection"
|
||||
:options="modelOptions(enabledVideos)"
|
||||
:disabled="saving || disabled"
|
||||
@update:value="selectModel('video', $event)"
|
||||
/>
|
||||
</section>
|
||||
<section class="model-section">
|
||||
<NFormItem label="视频模型">
|
||||
<NSelect
|
||||
:value="videoSelection"
|
||||
:options="modelOptions(enabledVideos)"
|
||||
:disabled="saving"
|
||||
@update:value="selectModel('video', $event)"
|
||||
/>
|
||||
</NFormItem>
|
||||
<GenerationOptionFields
|
||||
v-model="profile.videoOptions"
|
||||
:schemas="videoModel?.generationOptions || []"
|
||||
:disabled="saving"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
<div class="page-form-actions creative-profile-actions">
|
||||
<NButton
|
||||
type="primary"
|
||||
:loading="saving"
|
||||
:disabled="loading || !profile || !enabledImages.length || !enabledVideos.length"
|
||||
@click="save"
|
||||
>保存项目生成配置</NButton
|
||||
>
|
||||
<span class="text-xs text-muted">切换模型时会按新模型重置生成参数。</span>
|
||||
</div>
|
||||
</NFormItem>
|
||||
<GenerationOptionFields
|
||||
v-model="profile.videoOptions"
|
||||
:schemas="videoModel?.generationOptions || []"
|
||||
:disabled="saving || disabled"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
<div v-if="!hideActions" class="page-form-actions creative-profile-actions">
|
||||
<NButton type="primary" :loading="saving" :disabled="!canSave" @click="save">保存项目生成配置</NButton>
|
||||
<span class="text-xs text-muted">切换模型时会按新模型重置生成参数。</span>
|
||||
</div>
|
||||
</NSpin>
|
||||
</section>
|
||||
</template>
|
||||
@@ -268,9 +324,6 @@ onScopeDispose(() => controller?.abort())
|
||||
.creative-profile-grid {
|
||||
@apply grid grid-cols-[repeat(2,_minmax(0,_1fr))] items-start gap-x-5 gap-y-6;
|
||||
}
|
||||
.model-section {
|
||||
@apply min-w-0;
|
||||
}
|
||||
.model-section > :deep(.n-form-item) {
|
||||
@apply mb-6;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { NFormItem, NInputNumber, NSelect, NSwitch, NTag } from 'naive-ui'
|
||||
import FieldLabel from '../../../components/ui/FieldLabel.vue'
|
||||
import type { SelectOption } from 'naive-ui'
|
||||
import type {
|
||||
CreativeProfileAspectRatio,
|
||||
@@ -9,6 +10,7 @@ import type {
|
||||
GenerationOptions
|
||||
} from '../types'
|
||||
|
||||
/** 本次生成模型与参数控件,字段说明在标签图标中按需查看。 */
|
||||
const props = defineProps<{
|
||||
type: 'image' | 'video'
|
||||
catalog: GenerationModelCatalog
|
||||
@@ -17,15 +19,19 @@ const props = defineProps<{
|
||||
aspectRatio: CreativeProfileAspectRatio
|
||||
disabled?: boolean
|
||||
}>()
|
||||
/** 模型与参数编辑通知。 */
|
||||
const emit = defineEmits<{
|
||||
'update:provider': [value: string]
|
||||
'update:options': [value: GenerationOptions]
|
||||
}>()
|
||||
|
||||
/** 当前已启用的媒介模型。 */
|
||||
const models = computed(() =>
|
||||
(props.type === 'image' ? props.catalog.images : props.catalog.videos).filter(item => item.enabled)
|
||||
)
|
||||
/** 本次选择的实际模型。 */
|
||||
const model = computed(() => models.value.find(item => item.provider === props.provider) ?? models.value[0])
|
||||
/** 可用模型的下拉选项。 */
|
||||
const modelOptions = computed(() =>
|
||||
models.value.map(item => ({
|
||||
label: item.modelLabel ? `${item.providerLabel} · ${item.modelLabel}` : item.providerLabel,
|
||||
@@ -88,7 +94,10 @@ function selectValue(key: string): string | number | null {
|
||||
:key="item.key"
|
||||
class="generation-model-field"
|
||||
:label="item.label"
|
||||
:show-feedback="false"
|
||||
>
|
||||
<!-- 以下是生成参数标签与说明提示模块 -->
|
||||
<template #label><FieldLabel :label="item.label" :description="item.description" /></template>
|
||||
<div class="generation-model-field-control">
|
||||
<div v-if="item.type === 'boolean'" class="generation-model-toggle">
|
||||
<NSwitch
|
||||
@@ -120,14 +129,13 @@ function selectValue(key: string): string | number | null {
|
||||
:disabled="disabled || item.userEditable === false"
|
||||
@update:value="updateOption(item.key, $event)"
|
||||
/>
|
||||
<p v-if="item.description" class="generation-model-description">{{ item.description }}</p>
|
||||
</div>
|
||||
</NFormItem>
|
||||
|
||||
<NFormItem class="generation-model-field" label="画幅比例">
|
||||
<NFormItem class="generation-model-field" label="画幅比例" :show-feedback="false">
|
||||
<template #label><FieldLabel label="画幅比例" description="项目画幅 · 单次生成不可覆盖" /></template>
|
||||
<div class="generation-model-static">
|
||||
<NTag size="small">{{ aspectRatio }}</NTag>
|
||||
<span class="generation-model-description">项目画幅 · 单次生成不可覆盖</span>
|
||||
</div>
|
||||
</NFormItem>
|
||||
</template>
|
||||
@@ -165,9 +173,6 @@ function selectValue(key: string): string | number | null {
|
||||
.generation-model-static {
|
||||
@apply flex min-h-[34px] min-w-0 items-center gap-2.5;
|
||||
}
|
||||
.generation-model-description {
|
||||
@apply m-0 text-[11px] leading-5 text-muted;
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.generation-model-controls {
|
||||
@apply grid-cols-[minmax(0,_1fr)] gap-y-4;
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import { NCheckbox, NFormItem, NInput, NInputNumber, NSelect } from 'naive-ui'
|
||||
import FieldLabel from '../../../components/ui/FieldLabel.vue'
|
||||
import type { GenerationOptionSchema, GenerationOptions } from '../types'
|
||||
|
||||
defineProps<{ schemas: GenerationOptionSchema[]; modelValue: GenerationOptions; disabled?: boolean }>()
|
||||
/** 动态模型参数字段,实际说明由后端 schema 提供。 */
|
||||
defineProps<{
|
||||
/** 当前模型开放的参数列表。 */
|
||||
schemas: GenerationOptionSchema[]
|
||||
/** 本次实际参数值。 */
|
||||
modelValue: GenerationOptions
|
||||
/** 上游操作期间禁止编辑。 */
|
||||
disabled?: boolean
|
||||
}>()
|
||||
/** 字段编辑后通知上游更新参数。 */
|
||||
const emit = defineEmits<{ 'update:modelValue': [value: GenerationOptions] }>()
|
||||
|
||||
function update(model: GenerationOptions, key: string, value: string | number | boolean | null) {
|
||||
@@ -70,9 +80,15 @@ function constrainedOptions(schema: GenerationOptionSchema, current: string | nu
|
||||
v-for="schema in schemas"
|
||||
:key="schema.key"
|
||||
:label="`${schema.label}${schema.required ? ' *' : ''}`"
|
||||
:feedback="schema.description"
|
||||
:show-feedback="!!schema.description"
|
||||
:show-feedback="false"
|
||||
>
|
||||
<!-- 以下是参数标签与按需说明模块 -->
|
||||
<template #label>
|
||||
<FieldLabel
|
||||
:label="`${schema.label}${schema.required ? ' *' : ''}`"
|
||||
:description="schema.description"
|
||||
/>
|
||||
</template>
|
||||
<NCheckbox
|
||||
v-if="schema.type === 'boolean'"
|
||||
:checked="modelValue[schema.key] === true"
|
||||
@@ -131,11 +147,6 @@ function constrainedOptions(schema: GenerationOptionSchema, current: string | nu
|
||||
min-height: 34px;
|
||||
align-items: center;
|
||||
}
|
||||
.generation-option-grid :deep(.n-form-item-feedback-wrapper:not(:empty)) {
|
||||
min-height: 0;
|
||||
padding: 8px 0 0;
|
||||
line-height: 1.55;
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.generation-option-grid {
|
||||
@apply grid-cols-[minmax(0,_1fr)];
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import type { CreativeProfileInput } from '../types'
|
||||
import CreativeProfileSettings from './CreativeProfileSettings.vue'
|
||||
|
||||
/** 项目全局配置弹窗参数。 */
|
||||
const props = defineProps<{
|
||||
/** 当前正式项目 ID。 */
|
||||
projectId: string
|
||||
/** 项目操作期间只读查看,禁止保存模型配置。 */
|
||||
disabled: boolean
|
||||
}>()
|
||||
/** 真实保存成功后通知项目布局更新就绪信息。 */
|
||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput] }>()
|
||||
/** 弹窗显隐状态。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 保存进行中时禁止关闭弹窗,避免重复写入。 */
|
||||
const saving = ref(false)
|
||||
/** 配置表单实例,footer 调用表单自身的校验与保存入口。 */
|
||||
const form = ref<InstanceType<typeof CreativeProfileSettings> | null>(null)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是项目图片与视频全局配置弹窗模块 -->
|
||||
<AppDialog v-model:open="open" title="项目全局配置" :busy="saving" wide>
|
||||
<template #description>设置项目画布、图片和视频生成模型,后续生成默认使用这里保存的配置。</template>
|
||||
<CreativeProfileSettings
|
||||
v-if="open"
|
||||
ref="form"
|
||||
:key="props.projectId"
|
||||
:project-id="props.projectId"
|
||||
:disabled="props.disabled"
|
||||
hide-actions
|
||||
@busy="saving = $event"
|
||||
@saved="emit('saved', $event)"
|
||||
/>
|
||||
<!-- 以下是固定底栏取消与保存配置模块 -->
|
||||
<template #footer>
|
||||
<NButton :disabled="saving" @click="open = false">取消</NButton>
|
||||
<NButton type="primary" :loading="saving" :disabled="!form?.canSave" @click="form?.save()"
|
||||
>保存配置</NButton
|
||||
>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { inject, ref, type InjectionKey, type Ref } from 'vue'
|
||||
|
||||
/** 项目内共享的配置修订号,成功保存后通知已挂载的生成表单重新读取。 */
|
||||
export const projectGenerationRevisionKey: InjectionKey<Ref<number>> = Symbol('project-generation-revision')
|
||||
|
||||
/**
|
||||
* 读取项目配置修订号,独立使用组件时保留本地修订状态。
|
||||
* @returns 当前项目的响应式配置修订号
|
||||
*/
|
||||
export function useProjectGenerationRevision() {
|
||||
return inject(projectGenerationRevisionKey, undefined) ?? ref(0)
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import type { CreativeProfileInput, GenerationModelCatalog } from './types'
|
||||
|
||||
/**
|
||||
* 创建独立编辑或提交快照,原样保留后端已保存的生成参数。
|
||||
* @param profile 后端配置或当前编辑草稿
|
||||
* @returns 与原对象隔离的项目配置快照
|
||||
*/
|
||||
export function creativeProfileDraft(profile: CreativeProfileInput): CreativeProfileInput {
|
||||
return {
|
||||
aspectRatio: profile.aspectRatio,
|
||||
imageProvider: profile.imageProvider,
|
||||
imageModel: profile.imageModel,
|
||||
imageOptions: { ...profile.imageOptions },
|
||||
videoProvider: profile.videoProvider,
|
||||
videoModel: profile.videoModel,
|
||||
videoOptions: { ...profile.videoOptions }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按真实模型目录检查配置能否保存。
|
||||
* @param profile 当前项目配置草稿
|
||||
* @param catalog 后端实际模型目录
|
||||
* @returns 可展示的参数问题列表
|
||||
*/
|
||||
export function creativeProfileIssues(profile: CreativeProfileInput, catalog: GenerationModelCatalog): string[] {
|
||||
const issues: string[] = []
|
||||
for (const media of ['image', 'video'] as const) {
|
||||
const label = media === 'image' ? '图片配置' : '视频配置'
|
||||
const models = media === 'image' ? catalog.images : catalog.videos
|
||||
const model = models.find(
|
||||
item =>
|
||||
item.enabled && item.provider === profile[`${media}Provider`] && item.model === profile[`${media}Model`]
|
||||
)
|
||||
if (!model) {
|
||||
issues.push(`${label}:已保存的模型当前不可用,请重新选择模型。`)
|
||||
continue
|
||||
}
|
||||
const values = profile[`${media}Options`]
|
||||
for (const schema of model.generationOptions) {
|
||||
const value = values[schema.key]
|
||||
const field = `${label} · ${schema.label}`
|
||||
if (value === undefined || value === '') {
|
||||
if (schema.required) issues.push(`${field}:请填写必填参数。`)
|
||||
continue
|
||||
}
|
||||
const validType =
|
||||
schema.type === 'boolean'
|
||||
? typeof value === 'boolean'
|
||||
: schema.type === 'integer'
|
||||
? typeof value === 'number' && Number.isInteger(value)
|
||||
: schema.type === 'number'
|
||||
? typeof value === 'number' && Number.isFinite(value)
|
||||
: typeof value === 'string'
|
||||
if (!validType) {
|
||||
issues.push(`${field}:参数格式不正确。`)
|
||||
continue
|
||||
}
|
||||
if (schema.options?.length && !schema.options.some(option => option.value === value)) {
|
||||
issues.push(`${field}:当前值 ${String(value)} 已不在模型支持范围内,请重新选择。`)
|
||||
continue
|
||||
}
|
||||
if (typeof value === 'number' && !schema.specialValues?.some(option => option.value === value)) {
|
||||
if (schema.min !== undefined && value < schema.min) issues.push(`${field}:不能小于 ${schema.min}。`)
|
||||
if (schema.max !== undefined && value > schema.max) issues.push(`${field}:不能大于 ${schema.max}。`)
|
||||
}
|
||||
}
|
||||
}
|
||||
return issues
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
@@ -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))
|
||||
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { NAlert, NButton, NFormItem, NInput, NPopconfirm, NSelect, NTag, NTooltip } from 'naive-ui'
|
||||
import { RefreshCw, Search, Trash2, Upload } from '@lucide/vue'
|
||||
import { Search, Trash2, Upload } from '@lucide/vue'
|
||||
import { AppDialog, AssetImage, EmptyState } from '../../components/ui'
|
||||
import AppForm from '../../components/ui/AppForm.vue'
|
||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
@@ -111,11 +111,6 @@ function clearFilters() {
|
||||
category.value = null
|
||||
}
|
||||
|
||||
/** 同时刷新图片与上传所需的剧本选项。 */
|
||||
async function refreshAll() {
|
||||
await Promise.all([query.refresh(), projectsQuery.refresh()])
|
||||
}
|
||||
|
||||
/** 先校验本地文件,再在当前页选择剧本并确认资料。 */
|
||||
function selectFile(event: Event) {
|
||||
const input = event.target as HTMLInputElement
|
||||
@@ -237,16 +232,6 @@ async function removeAsset() {
|
||||
>
|
||||
<template #icon><Upload :size="16" /></template>上传图片
|
||||
</NButton>
|
||||
<NButton
|
||||
quaternary
|
||||
class="icon-button"
|
||||
:loading="query.loading.value || projectsQuery.loading.value"
|
||||
aria-label="刷新资产库"
|
||||
title="刷新资产库"
|
||||
@click="refreshAll"
|
||||
>
|
||||
<template #icon><RefreshCw :size="16" /></template>
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { NAlert, NButton, NFormItem, NInput, NPopconfirm, NSelect, NTag } from 'naive-ui'
|
||||
import { Pencil, RefreshCw, Search, Trash2, Upload } from '@lucide/vue'
|
||||
import { Pencil, Search, Trash2, Upload } from '@lucide/vue'
|
||||
import { AppDialog, AssetImage, EmptyState } from '../../components/ui'
|
||||
import AppForm from '../../components/ui/AppForm.vue'
|
||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
@@ -187,15 +187,6 @@ async function removeAsset(asset: ProjectAsset) {
|
||||
<NButton type="primary" :disabled="disabled" @click="fileInput?.click()">
|
||||
<template #icon><Upload :size="16" /></template>上传图片
|
||||
</NButton>
|
||||
<NButton
|
||||
quaternary
|
||||
class="icon-button"
|
||||
aria-label="刷新资产库"
|
||||
title="刷新资产库"
|
||||
:loading="query.loading.value"
|
||||
@click="query.refresh"
|
||||
><template #icon><RefreshCw :size="16" /></template
|
||||
></NButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, onScopeDispose, provide, watchEffect } from 'vue'
|
||||
import { computed, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { NScrollbar, NAlert, NButton, NPageHeader, NSpin, NEllipsis } from 'naive-ui'
|
||||
import { EmptyState } from '../../components/ui'
|
||||
@@ -9,6 +9,8 @@ import { projectAccessKey, projectSectionFromPath, type ProjectAccess } from './
|
||||
import { useProjectStageAccess } from './useProjectStageAccess'
|
||||
import { useWorkflowExecution } from '../workflows/execution'
|
||||
import { clearEpisodeSourceInvalidations, invalidateEpisodeSource } from '../storyboard/model'
|
||||
import ProjectSettingsDialog from '../generation-config/components/ProjectSettingsDialog.vue'
|
||||
import { projectGenerationRevisionKey } from '../generation-config/context'
|
||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||
|
||||
/** 项目标题只保留名称;下游工作区在剧本完成前不挂载,直接链接也无法越过限制。 */
|
||||
@@ -22,6 +24,32 @@ const isGallery = computed(() => {
|
||||
})
|
||||
const context = useProjectData(id)
|
||||
provide(projectContextKey, context)
|
||||
/** 项目全局配置保存后更新已挂载生成表单。 */
|
||||
const generationRevision = ref(0)
|
||||
provide(projectGenerationRevisionKey, generationRevision)
|
||||
/** 项目标题栏共用配置弹窗开关。 */
|
||||
const settingsOpen = ref(false)
|
||||
/** 既有配置恢复链接打开同一个全局弹窗,不切换工作区。 */
|
||||
watch(
|
||||
() => route.query.configure,
|
||||
value => {
|
||||
if (value === 'profile') settingsOpen.value = true
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
/** 关闭弹窗清除仅用于打开配置的参数,保留镜头与其它地址信息。 */
|
||||
watch(settingsOpen, shown => {
|
||||
if (!shown && route.query.configure === 'profile') {
|
||||
const query = { ...route.query }
|
||||
delete query.configure
|
||||
void router.replace({ path: route.path, query, hash: route.hash })
|
||||
}
|
||||
})
|
||||
/** 切项目时关闭旧配置,禁止把草稿带入其它项目。 */
|
||||
watch(id, () => {
|
||||
settingsOpen.value = false
|
||||
generationRevision.value = 0
|
||||
})
|
||||
const operation = computed(() => getOperation(id.value))
|
||||
const createDramaExecution = useWorkflowExecution(id, 'create-drama')
|
||||
/** 项目内跨页面继续观察首帧后台任务,维持活动锁并在真实终态后释放。 */
|
||||
@@ -128,13 +156,12 @@ function resolveOperationError() {
|
||||
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')
|
||||
void router.push({
|
||||
path: onIdentityPage ? route.path : `/projects/${id.value}/production`,
|
||||
query: { ...route.query, configure: 'profile' }
|
||||
})
|
||||
}
|
||||
else if (target === 'profile') settingsOpen.value = true
|
||||
}
|
||||
/** 配置真实保存后更新当前项目的就绪门禁并解除配置缺失提示。 */
|
||||
function projectSettingsSaved() {
|
||||
if (operationGuide.value?.target === 'profile') operation.value.error = ''
|
||||
void context.refreshStageReadiness()
|
||||
}
|
||||
const access = inject(projectAccessKey, undefined)
|
||||
let published: ProjectAccess | null = null
|
||||
@@ -149,12 +176,18 @@ onScopeDispose(() => {
|
||||
<template>
|
||||
<section class="project-frame">
|
||||
<header class="project-header">
|
||||
<!-- 以下是项目标题与全局配置入口模块 -->
|
||||
<NPageHeader @back="router.push('/projects')">
|
||||
<template #title
|
||||
><NEllipsis class="project-title" :tooltip="false">{{
|
||||
context.project.value?.title || context.project.value?.topic || '读取项目'
|
||||
}}</NEllipsis></template
|
||||
>
|
||||
<template #extra>
|
||||
<NButton size="small" :disabled="!context.project.value" @click="settingsOpen = true"
|
||||
>项目配置</NButton
|
||||
>
|
||||
</template>
|
||||
</NPageHeader>
|
||||
</header>
|
||||
<NScrollbar
|
||||
@@ -194,6 +227,15 @@ onScopeDispose(() => {
|
||||
@refresh="createDramaExecution.query.refresh"
|
||||
@dismiss="createDramaExecution.dismiss"
|
||||
/>
|
||||
<!-- 以下是当前项目图片与视频配置弹窗模块 -->
|
||||
<ProjectSettingsDialog
|
||||
:key="id"
|
||||
v-if="context.project.value?.id === id"
|
||||
v-model:open="settingsOpen"
|
||||
:project-id="id"
|
||||
:disabled="operation.pending"
|
||||
@saved="projectSettingsSaved"
|
||||
/>
|
||||
<div class="project-view">
|
||||
<RouterView v-if="context.project.value?.id === id && currentAccess?.enabled" :key="id" />
|
||||
<EmptyState
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
type DataTableColumns,
|
||||
type DataTableInst
|
||||
} from 'naive-ui'
|
||||
import { MoreHorizontal, Pencil, RefreshCw, Search, Trash2 } from '@lucide/vue'
|
||||
import { MoreHorizontal, Pencil, Search, Trash2 } from '@lucide/vue'
|
||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
import { useQuery } from '../../composables/useQuery'
|
||||
import { StatusBadge } from '../../components/ui'
|
||||
@@ -25,7 +25,7 @@ import DeleteProjectDialog from './components/DeleteProjectDialog.vue'
|
||||
|
||||
/** 项目表格使用固定表头与独立滚动;搜索筛选仍作用于真实接口数据。 */
|
||||
const router = useRouter()
|
||||
/** 列表已有刷新按钮,只在进入和手动刷新时读取;筛选在完整结果中进行。 */
|
||||
/** 列表在进入或自身操作完成后读取;筛选在完整结果中进行。 */
|
||||
const query = useQuery(ref('projects'), (_, signal) => projectsApi.list(signal))
|
||||
const search = ref('')
|
||||
const filter = ref('all')
|
||||
@@ -150,7 +150,7 @@ function clearFilters() {
|
||||
</div>
|
||||
<CreateProjectDialog @created="openProject" />
|
||||
</div>
|
||||
<!-- 以下是状态筛选、搜索与刷新 -->
|
||||
<!-- 以下是状态筛选与搜索模块 -->
|
||||
<div class="project-index-toolbar">
|
||||
<div class="project-status-filter-scroller">
|
||||
<NRadioGroup
|
||||
@@ -172,14 +172,6 @@ function clearFilters() {
|
||||
:input-props="{ 'aria-label': '搜索项目' }"
|
||||
><template #prefix><Search :size="15" /></template
|
||||
></NInput>
|
||||
<NButton
|
||||
class="icon-button"
|
||||
:loading="query.loading.value"
|
||||
aria-label="刷新项目"
|
||||
title="刷新项目"
|
||||
@click="query.refresh"
|
||||
><template #icon><RefreshCw :size="16" /></template
|
||||
></NButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import { request, optionalResource } from '../../lib/http'
|
||||
import type { Checkpoint } from '../workflows/types'
|
||||
import type { WorkflowExecutionStart } from '../workflows/execution.types'
|
||||
import type { CreateProjectInput, DramaState, Project, ProjectDetail, ProjectStageReadiness, UpdateProjectInput } from './types'
|
||||
import type {
|
||||
CreateProjectInput,
|
||||
DramaState,
|
||||
Project,
|
||||
ProjectDetail,
|
||||
ProjectStageReadiness,
|
||||
UpdateProjectInput
|
||||
} from './types'
|
||||
|
||||
/** 项目与 Create Drama API;路径严格对应后端 dev。 */
|
||||
export const projectsApi = {
|
||||
@@ -11,7 +18,10 @@ export const projectsApi = {
|
||||
stageReadiness: (id: string, signal?: AbortSignal) =>
|
||||
request<ProjectStageReadiness>(`/projects/${encodeURIComponent(id)}/stage-readiness`, { signal }),
|
||||
create: (input: CreateProjectInput) =>
|
||||
request<{ projectId: string; status: string; executionId: string }>('/projects', { method: 'POST', body: input }),
|
||||
request<{ projectId: string; status: string; executionId: string }>('/projects', {
|
||||
method: 'POST',
|
||||
body: input
|
||||
}),
|
||||
update: (id: string, input: UpdateProjectInput) =>
|
||||
request<Project>(`/projects/${encodeURIComponent(id)}`, { method: 'PUT', body: input }),
|
||||
deleteReadiness: (id: string, signal?: AbortSignal) =>
|
||||
|
||||
@@ -17,6 +17,8 @@ const open = ref(false)
|
||||
const busy = ref(false)
|
||||
/** 创建请求的错误提示。 */
|
||||
const error = ref('')
|
||||
/** 公共表单实例,底栏和回车提交共用同一字段校验。 */
|
||||
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||||
/** 与后端 POST /projects 入参一致的创建表单。 */
|
||||
const form = reactive({ title: '', topic: '', style: '', episodeCount: 1 })
|
||||
|
||||
@@ -61,6 +63,7 @@ const rules = {
|
||||
><NButton @click="open = true" type="primary"><Plus :size="16" />新建剧本</NButton></template
|
||||
>
|
||||
<AppForm
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:disabled="busy"
|
||||
@@ -116,11 +119,10 @@ const rules = {
|
||||
建议先用 1 集验证生成效果。生成会实际调用后端模型,产生相应费用。
|
||||
</p>
|
||||
<NAlert v-if="error" role="alert" type="error" :show-icon="false" class=" ">{{ error }}</NAlert>
|
||||
|
||||
</AppForm>
|
||||
<template #footer>
|
||||
<NButton :disabled="busy" @click="open = false">取消</NButton>
|
||||
<NButton :disabled="busy" type="primary" @click="submit">
|
||||
<NButton :disabled="busy" type="primary" @click="formRef?.validate(submit)">
|
||||
<LoaderCircle v-if="busy" :size="16" class="animate-spin" />
|
||||
开始生成
|
||||
<ArrowRight v-if="!busy" :size="16" />
|
||||
|
||||
@@ -53,18 +53,29 @@ async function remove() {
|
||||
<template>
|
||||
<AppDialog v-model:open="open" :title="`永久删除 · ${expected}`" description="删除后无法恢复。">
|
||||
<NAlert type="error" :show-icon="false" class="mt-4">
|
||||
会永久删除剧本、主体、身份、形态、分镜、首帧、视频、工作流记录,以及本地 Storage 中属于该项目的图片、视频和上传素材。
|
||||
会永久删除剧本、主体、身份、形态、分镜、首帧、视频、工作流记录,以及本地 Storage
|
||||
中属于该项目的图片、视频和上传素材。
|
||||
</NAlert>
|
||||
<NAlert v-if="readinessPending" type="info" :show-icon="false" class="mt-3">正在检查项目后台任务…</NAlert>
|
||||
<NAlert v-else-if="readiness && !readiness.canDelete" type="warning" :show-icon="false" class="mt-3">
|
||||
当前有 {{ readiness.totalActiveTasks }} 个后台任务正在执行,暂不能删除。请等待图片、首帧、视频或工作流任务结束后再试。
|
||||
当前有
|
||||
{{ readiness.totalActiveTasks }}
|
||||
个后台任务正在执行,暂不能删除。请等待图片、首帧、视频或工作流任务结束后再试。
|
||||
</NAlert>
|
||||
<NAlert v-if="state.error" type="error" :show-icon="false" class="mt-3">{{ state.error }}</NAlert>
|
||||
<p class="mt-5 text-xs">请输入 <strong>{{ expected }}</strong> 确认删除:</p>
|
||||
<p class="mt-5 text-xs">
|
||||
请输入 <strong>{{ expected }}</strong> 确认删除:
|
||||
</p>
|
||||
<NInput v-model:value="state.confirm" class="mt-2" placeholder="输入项目名称" />
|
||||
<template #footer>
|
||||
<NButton @click="open = false">取消</NButton>
|
||||
<NButton type="error" :loading="state.pending" :disabled="!confirmed || readinessPending || !readiness?.canDelete" @click="remove">永久删除项目</NButton>
|
||||
<NButton
|
||||
type="error"
|
||||
:loading="state.pending"
|
||||
:disabled="!confirmed || readinessPending || !readiness?.canDelete"
|
||||
@click="remove"
|
||||
>永久删除项目</NButton
|
||||
>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</template>
|
||||
@@ -31,11 +31,23 @@ watch(
|
||||
{ immediate: true }
|
||||
)
|
||||
async function save() {
|
||||
if (!props.project || state.pending || !dirty.value || !form.title.trim() || !form.topic.trim() || !form.style.trim()) return
|
||||
if (
|
||||
!props.project ||
|
||||
state.pending ||
|
||||
!dirty.value ||
|
||||
!form.title.trim() ||
|
||||
!form.topic.trim() ||
|
||||
!form.style.trim()
|
||||
)
|
||||
return
|
||||
state.pending = true
|
||||
state.error = ''
|
||||
try {
|
||||
await projectsApi.update(props.project.id, { title: form.title.trim(), topic: form.topic.trim(), style: form.style.trim() })
|
||||
await projectsApi.update(props.project.id, {
|
||||
title: form.title.trim(),
|
||||
topic: form.topic.trim(),
|
||||
style: form.style.trim()
|
||||
})
|
||||
emit('changed')
|
||||
open.value = false
|
||||
} catch (cause) {
|
||||
@@ -46,16 +58,32 @@ async function save() {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<AppDialog v-model:open="open" :title="`编辑项目 · ${project?.title || project?.topic || ''}`" description="仅更新项目基础信息,不自动重生成剧本或 Production 资产。">
|
||||
<AppDialog
|
||||
v-model:open="open"
|
||||
:title="`编辑项目 · ${project?.title || project?.topic || ''}`"
|
||||
description="仅更新项目基础信息,不自动重生成剧本或 Production 资产。"
|
||||
>
|
||||
<NAlert v-if="state.error" type="error" :show-icon="false" class="mt-4">{{ state.error }}</NAlert>
|
||||
<section class="dialog-form-stack">
|
||||
<label class="block text-xs">项目名称<NInput v-model:value="form.title" class="mt-2" /></label>
|
||||
<label class="block text-xs">故事主题<NInput v-model:value="form.topic" type="textarea" :autosize="{ minRows: 3, maxRows: 8 }" class="mt-2" /></label>
|
||||
<label class="block text-xs"
|
||||
>故事主题<NInput
|
||||
v-model:value="form.topic"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 3, maxRows: 8 }"
|
||||
class="mt-2"
|
||||
/></label>
|
||||
<label class="block text-xs">风格<NInput v-model:value="form.style" class="mt-2" /></label>
|
||||
</section>
|
||||
<template #footer>
|
||||
<NButton @click="open = false">取消</NButton>
|
||||
<NButton type="primary" :loading="state.pending" :disabled="!dirty || !form.title.trim() || !form.topic.trim() || !form.style.trim()" @click="save">保存项目</NButton>
|
||||
<NButton
|
||||
type="primary"
|
||||
:loading="state.pending"
|
||||
:disabled="!dirty || !form.title.trim() || !form.topic.trim() || !form.style.trim()"
|
||||
@click="save"
|
||||
>保存项目</NButton
|
||||
>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</template>
|
||||
@@ -23,7 +23,8 @@ export function useProjectData(id: Ref<string>) {
|
||||
const projectId = id.value
|
||||
if (!projectId || !query.data.value) return
|
||||
const nextReadiness = await projectsApi.stageReadiness(projectId)
|
||||
if (id.value === projectId && query.data.value) query.data.value = { ...query.data.value, stageReadiness: nextReadiness }
|
||||
if (id.value === projectId && query.data.value)
|
||||
query.data.value = { ...query.data.value, stageReadiness: nextReadiness }
|
||||
}
|
||||
return { ...query, project, checkpoints, stageReadiness, refreshStageReadiness }
|
||||
}
|
||||
|
||||
@@ -35,8 +35,16 @@ export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<Pro
|
||||
state?.visualStyle.reason ||
|
||||
state?.identity.reason ||
|
||||
'请先完成主体身份准备',
|
||||
nextPath: state?.visualStyle.ready ? 'subject-identity' : state?.breakdown.ready ? 'visual-style' : 'breakdown',
|
||||
nextLabel: state?.visualStyle.ready ? '前往主体身份' : state?.breakdown.ready ? '前往视觉风格' : '前往剧本拆解'
|
||||
nextPath: state?.visualStyle.ready
|
||||
? 'subject-identity'
|
||||
: state?.breakdown.ready
|
||||
? 'visual-style'
|
||||
: 'breakdown',
|
||||
nextLabel: state?.visualStyle.ready
|
||||
? '前往主体身份'
|
||||
: state?.breakdown.ready
|
||||
? '前往视觉风格'
|
||||
: '前往剧本拆解'
|
||||
},
|
||||
storyboard: {
|
||||
enabled: Boolean(state?.breakdown.ready && state?.subjectAssets.ready),
|
||||
@@ -51,8 +59,16 @@ export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<Pro
|
||||
state?.subjectAssets.reason ||
|
||||
state?.storyboard.reason ||
|
||||
'请先完成镜头制作准备',
|
||||
nextPath: state?.subjectAssets.ready ? 'storyboard' : state?.breakdown.ready ? 'subject-images' : 'breakdown',
|
||||
nextLabel: state?.subjectAssets.ready ? '前往分镜设计' : state?.breakdown.ready ? '前往形态图片' : '前往剧本拆解'
|
||||
nextPath: state?.subjectAssets.ready
|
||||
? 'storyboard'
|
||||
: state?.breakdown.ready
|
||||
? 'subject-images'
|
||||
: 'breakdown',
|
||||
nextLabel: state?.subjectAssets.ready
|
||||
? '前往分镜设计'
|
||||
: state?.breakdown.ready
|
||||
? '前往形态图片'
|
||||
: '前往剧本拆解'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
@@ -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))
|
||||
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from 'naive-ui'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { Check, Circle, RefreshCw, UserCheck } from '@lucide/vue'
|
||||
import { Check, Circle, UserCheck } from '@lucide/vue'
|
||||
import { AssetImage, DirectoryItem, EmptyState, StatusBadge } from '../../components/ui'
|
||||
import { downloadText } from '../../lib/format'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
@@ -154,12 +154,6 @@ function exportReceipt() {
|
||||
downloadText('subject-identities-receipt.json', JSON.stringify(session.value.receipt, null, 2), 'application/json')
|
||||
}
|
||||
|
||||
/** 目录刷新同时读取正式形态和 Character Casting,避免无形态角色状态滞后。 */
|
||||
function refreshDirectory() {
|
||||
thumbnailRefreshKey.value++
|
||||
void Promise.all([catalog.refresh(), castingQuery.refresh()])
|
||||
}
|
||||
|
||||
/** Character 使用确认选角事务;Scene / Prop 保留普通母版切换。 */
|
||||
async function submitIdentityImage(input: Parameters<typeof generateImage>[0]) {
|
||||
await generateImage(input)
|
||||
@@ -273,8 +267,8 @@ const nextAction = computed<{ action: IdentityFlowAction; title: string; descrip
|
||||
}
|
||||
})
|
||||
|
||||
/** 原配置恢复入口打开标题栏共用的全局配置弹窗。 */
|
||||
function openProfileSettings() {
|
||||
toolsOpen.value = true
|
||||
if (route.query.configure !== 'profile') void router.replace({ query: { ...route.query, configure: 'profile' } })
|
||||
}
|
||||
|
||||
@@ -301,14 +295,6 @@ async function profileSaved() {
|
||||
operation.value.error = ''
|
||||
await profileQuery.refresh()
|
||||
}
|
||||
|
||||
watch(
|
||||
() => route.query.configure,
|
||||
value => {
|
||||
if (value === 'profile') openProfileSettings()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -343,7 +329,11 @@ watch(
|
||||
title="角色选角总览与批量操作"
|
||||
:has-receipt="!!session.receipt"
|
||||
>
|
||||
<CreativeProfileSettings :project-id="projectId" @saved="profileSaved" />
|
||||
<CreativeProfileSettings
|
||||
:project-id="projectId"
|
||||
:disabled="operation.pending"
|
||||
@saved="profileSaved"
|
||||
/>
|
||||
<div class="identity-tools-intro flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<h2 class="text-lg font-semibold">主体身份</h2>
|
||||
@@ -633,16 +623,6 @@ watch(
|
||||
<h3>
|
||||
主体目录 <span>{{ filtered.length }} / {{ subjects.length }}</span>
|
||||
</h3>
|
||||
<NButton
|
||||
:disabled="catalog.loading.value || castingQuery.loading.value"
|
||||
@click="refreshDirectory"
|
||||
quaternary
|
||||
class="icon-button"
|
||||
size="small"
|
||||
aria-label="刷新主体目录"
|
||||
title="刷新主体目录"
|
||||
><template #icon><RefreshCw :size="14" /></template
|
||||
></NButton>
|
||||
</div>
|
||||
<div class="directory-filters">
|
||||
<NInput
|
||||
|
||||
@@ -4,11 +4,7 @@ import { computed, ref, watch } from 'vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import AppForm from '../../../components/ui/AppForm.vue'
|
||||
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||
import type {
|
||||
CreativeProfile,
|
||||
GenerationModelCatalog,
|
||||
GenerationOptions
|
||||
} from '../../generation-config/types'
|
||||
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
|
||||
import type { GenerateCastingCandidateInput } from '../types'
|
||||
|
||||
/** Character 选角候选表单固定使用 primary,每次独立生成且不会自动选择演员。 */
|
||||
@@ -32,7 +28,8 @@ const valid = computed(() => Boolean(provider.value))
|
||||
function reset() {
|
||||
prompt.value = ''
|
||||
provider.value = props.profile.imageProvider
|
||||
const selected = props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||
const selected =
|
||||
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||
props.catalog.images.find(item => item.enabled)
|
||||
provider.value = selected?.provider ?? ''
|
||||
generationOptions.value = {
|
||||
@@ -40,7 +37,10 @@ function reset() {
|
||||
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
|
||||
}
|
||||
const sizeSchema = selected?.generationOptions.find(item => item.key === 'size')
|
||||
if (sizeSchema?.options?.length && !sizeSchema.options.some(option => option.value === generationOptions.value.size)) {
|
||||
if (
|
||||
sizeSchema?.options?.length &&
|
||||
!sizeSchema.options.some(option => option.value === generationOptions.value.size)
|
||||
) {
|
||||
generationOptions.value.size = selected?.defaults.size ?? sizeSchema.options[0]?.value ?? ''
|
||||
}
|
||||
acknowledged.value = false
|
||||
@@ -110,15 +110,15 @@ const formModel = computed(() => ({ prompt: prompt.value }))
|
||||
</NCheckbox>
|
||||
</AppForm>
|
||||
<template #footer>
|
||||
<NButton @click="open = false">取消</NButton>
|
||||
<NButton
|
||||
:disabled="disabled || !valid || !acknowledged"
|
||||
:loading="disabled"
|
||||
type="primary"
|
||||
@click="formRef?.validate(submit)"
|
||||
>
|
||||
{{ disabled ? '生成中…' : '确认生成候选' }}
|
||||
</NButton>
|
||||
<NButton @click="open = false">取消</NButton>
|
||||
<NButton
|
||||
:disabled="disabled || !valid || !acknowledged"
|
||||
:loading="disabled"
|
||||
type="primary"
|
||||
@click="formRef?.validate(submit)"
|
||||
>
|
||||
{{ disabled ? '生成中…' : '确认生成候选' }}
|
||||
</NButton>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</template>
|
||||
@@ -6,7 +6,7 @@ import { NFormItem } from 'naive-ui'
|
||||
import { fieldRule } from '../../../lib/form-rules'
|
||||
import { NAlert, NButton, NCheckbox, NInput, NSelect } from 'naive-ui'
|
||||
import { computed, onBeforeUnmount, ref, watch } from 'vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import { AppDialog, FieldLabel } from '../../../components/ui'
|
||||
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
|
||||
import { subjectIdentityApi } from '../api'
|
||||
@@ -197,7 +197,14 @@ const rules = {
|
||||
path="referenceImageId"
|
||||
label="身份锚定来源"
|
||||
:label-props="{ for: 'identity-reference' }"
|
||||
><NSelect
|
||||
>
|
||||
<template #label>
|
||||
<FieldLabel
|
||||
label="身份锚定来源"
|
||||
description="只能选择此主体已完成的图片。后端需取得图片服务可访问的远程地址;本地预览可见不保证远程地址仍有效。"
|
||||
/>
|
||||
</template>
|
||||
<NSelect
|
||||
id="identity-reference"
|
||||
v-model:value="referenceImageId"
|
||||
:options="[
|
||||
@@ -213,9 +220,6 @@ const rules = {
|
||||
class="select-control"
|
||||
></NSelect
|
||||
></NFormItem>
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
只能选择此主体已完成的图片。后端需取得 Provider 可访问的远程地址;本地预览可见不保证远程地址仍有效。
|
||||
</p>
|
||||
<NFormItem
|
||||
class="block"
|
||||
path="prompt"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { usePolling } from '../../composables/usePolling'
|
||||
import { visualStyleApi } from '../visual-style'
|
||||
import { useProjectGenerationRevision } from '../generation-config/context'
|
||||
import { generationConfigApi } from '../generation-config/api'
|
||||
import { subjectImagesApi } from '../subject-images/api'
|
||||
import { hasRunningImages } from '../subject-images/model'
|
||||
@@ -35,7 +36,7 @@ export function useSubjectIdentity() {
|
||||
const concurrency = ref(3)
|
||||
const candidateLimit = ref(3)
|
||||
const force = ref(false)
|
||||
/** 目录与身份已有刷新按钮,查询只在进入、切换和手动刷新时读取。 */
|
||||
/** 主体与模型查询只在进入、切换和自身操作完成后读取。 */
|
||||
const generationModelsQuery = usePolling(
|
||||
projectId,
|
||||
async (_id, signal) => generationConfigApi.catalog(signal),
|
||||
@@ -67,9 +68,17 @@ export function useSubjectIdentity() {
|
||||
},
|
||||
false
|
||||
)
|
||||
/** 全局配置成功保存后重新读取主体生图的实际默认参数。 */
|
||||
const generationRevision = useProjectGenerationRevision()
|
||||
/** 配置查询按当前项目和修订号隔离。 */
|
||||
const profileKey = computed(() => JSON.stringify([projectId.value, generationRevision.value]))
|
||||
/** 主体身份使用保存后的正式项目配置。 */
|
||||
const profileQuery = usePolling(
|
||||
projectId,
|
||||
async (id, signal) => ({ profile: await generationConfigApi.profile(id, signal) }),
|
||||
profileKey,
|
||||
async (key, signal) => {
|
||||
const [id] = JSON.parse(key) as [string, number]
|
||||
return { profile: await generationConfigApi.profile(id, signal) }
|
||||
},
|
||||
false
|
||||
)
|
||||
const castingQuery = usePolling(
|
||||
|
||||
@@ -6,30 +6,10 @@ import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
||||
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
|
||||
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
|
||||
import {
|
||||
NAlert,
|
||||
NButton,
|
||||
NCheckbox,
|
||||
NInput,
|
||||
NInputNumber,
|
||||
NPopover,
|
||||
NScrollbar,
|
||||
NSelect,
|
||||
NTag
|
||||
} from 'naive-ui'
|
||||
import { NAlert, NButton, NCheckbox, NInput, NInputNumber, NPopover, NScrollbar, NSelect, NTag } from 'naive-ui'
|
||||
import { computed, onScopeDispose, ref, watch, type Directive } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import {
|
||||
Search,
|
||||
RefreshCw,
|
||||
Download,
|
||||
ImagePlus,
|
||||
ArrowLeft,
|
||||
ArrowRight,
|
||||
LayoutGrid,
|
||||
Columns3,
|
||||
Settings2
|
||||
} from '@lucide/vue'
|
||||
import { Search, Download, ImagePlus, ArrowLeft, ArrowRight, LayoutGrid, Columns3, Settings2 } from '@lucide/vue'
|
||||
import { AssetImage, EmptyState, StatusBadge } from '../../components/ui'
|
||||
import { downloadText } from '../../lib/format'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
@@ -377,60 +357,60 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
||||
</p>
|
||||
</div>
|
||||
<p class="mt-2 text-[11px] leading-6 text-muted">
|
||||
图库不自动刷新,可点击“刷新图库”读取最新记录。主图供分镜引用,候选图和历史失败记录均保留;过期主图不会自动删除或替换。
|
||||
图库在进入和操作完成后读取最新记录。主图供分镜引用,候选图和历史失败记录均保留;过期主图不会自动删除或替换。
|
||||
</p>
|
||||
<section class="mt-4 pt-4">
|
||||
<h3 class="text-sm font-semibold">项目批量生图</h3>
|
||||
<AppForm :model="formModel" :rules="rules" :disabled="operation.pending" validate-on-change>
|
||||
<div class="form-controls mt-4 flex flex-wrap gap-4">
|
||||
<NFormItem
|
||||
class="w-28"
|
||||
path="concurrency"
|
||||
label="批量并发"
|
||||
:label-props="{ for: 'image-concurrency' }"
|
||||
>
|
||||
<NInputNumber
|
||||
:disabled="operation.pending"
|
||||
:input-props="{ id: 'image-concurrency' }"
|
||||
:value="typeof concurrency === 'number' ? concurrency : null"
|
||||
@update:value="concurrency = $event ?? 0"
|
||||
:min="1"
|
||||
:step="1"
|
||||
></NInputNumber>
|
||||
</NFormItem>
|
||||
<NFormItem class="w-36" path="limit" label="本批上限(可选)"
|
||||
><NInputNumber
|
||||
:disabled="operation.pending"
|
||||
:value="typeof limit === 'number' ? limit : null"
|
||||
@update:value="limit = $event ?? ''"
|
||||
:min="1"
|
||||
:step="1"
|
||||
placeholder="不限制"
|
||||
:input-props="{ 'aria-label': '生图本批上限' }"
|
||||
/></NFormItem>
|
||||
<NCheckbox
|
||||
v-model:checked="force"
|
||||
<h3 class="text-sm font-semibold">项目批量生图</h3>
|
||||
<AppForm :model="formModel" :rules="rules" :disabled="operation.pending" validate-on-change>
|
||||
<div class="form-controls mt-4 flex flex-wrap gap-4">
|
||||
<NFormItem
|
||||
class="w-28"
|
||||
path="concurrency"
|
||||
label="批量并发"
|
||||
:label-props="{ for: 'image-concurrency' }"
|
||||
>
|
||||
<NInputNumber
|
||||
:disabled="operation.pending"
|
||||
class="control-row-checkbox text-xs"
|
||||
>已有主图也新增候选图
|
||||
</NCheckbox>
|
||||
<ConfirmAction
|
||||
:label="force ? '为全项目新增候选图' : '补齐项目主参考图'"
|
||||
:disabled="blocked || running || !batchValid || !forms.length"
|
||||
acknowledgement
|
||||
:description="
|
||||
force
|
||||
? '对项目全部形态调用图片模型新增一张图片。已有主图不会被替换,生成后可在图片记录中手动选择主图。'
|
||||
: '对缺少主图或主图已过期的形态调用图片模型,仍有效的主图跳过。已有过期主图不会被自动替换,生成后请在图片记录中确认新主图。操作面向整个项目,不受列表筛选影响。'
|
||||
"
|
||||
@confirm="generateProject"
|
||||
/>
|
||||
</div>
|
||||
</AppForm>
|
||||
<p class="mt-3 text-xs leading-6 text-muted">
|
||||
作用于整个项目,不受下方筛选影响。上限只限制本次真正生图数量,其余显示为“待后续处理”,不计入跳过。默认使用项目尺寸与正式提示词,不会启动视频生成。
|
||||
</p>
|
||||
</section>
|
||||
:input-props="{ id: 'image-concurrency' }"
|
||||
:value="typeof concurrency === 'number' ? concurrency : null"
|
||||
@update:value="concurrency = $event ?? 0"
|
||||
:min="1"
|
||||
:step="1"
|
||||
></NInputNumber>
|
||||
</NFormItem>
|
||||
<NFormItem class="w-36" path="limit" label="本批上限(可选)"
|
||||
><NInputNumber
|
||||
:disabled="operation.pending"
|
||||
:value="typeof limit === 'number' ? limit : null"
|
||||
@update:value="limit = $event ?? ''"
|
||||
:min="1"
|
||||
:step="1"
|
||||
placeholder="不限制"
|
||||
:input-props="{ 'aria-label': '生图本批上限' }"
|
||||
/></NFormItem>
|
||||
<NCheckbox
|
||||
v-model:checked="force"
|
||||
:disabled="operation.pending"
|
||||
class="control-row-checkbox text-xs"
|
||||
>已有主图也新增候选图
|
||||
</NCheckbox>
|
||||
<ConfirmAction
|
||||
:label="force ? '为全项目新增候选图' : '补齐项目主参考图'"
|
||||
:disabled="blocked || running || !batchValid || !forms.length"
|
||||
acknowledgement
|
||||
:description="
|
||||
force
|
||||
? '对项目全部形态调用图片模型新增一张图片。已有主图不会被替换,生成后可在图片记录中手动选择主图。'
|
||||
: '对缺少主图或主图已过期的形态调用图片模型,仍有效的主图跳过。已有过期主图不会被自动替换,生成后请在图片记录中确认新主图。操作面向整个项目,不受列表筛选影响。'
|
||||
"
|
||||
@confirm="generateProject"
|
||||
/>
|
||||
</div>
|
||||
</AppForm>
|
||||
<p class="mt-3 text-xs leading-6 text-muted">
|
||||
作用于整个项目,不受下方筛选影响。上限只限制本次真正生图数量,其余显示为“待后续处理”,不计入跳过。默认使用项目尺寸与正式提示词,不会启动视频生成。
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<section v-if="session.receipt" class="panel workspace-panel" aria-label="生图批量回执">
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
@@ -598,25 +578,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
||||
</template>
|
||||
瀑布流布局
|
||||
</NPopover>
|
||||
<NPopover trigger="hover" placement="top" :disabled="isMobile">
|
||||
<template #trigger>
|
||||
<NButton
|
||||
class="icon-button gallery-action-button"
|
||||
size="small"
|
||||
:disabled="query.loading.value || impact.query.loading.value"
|
||||
aria-label="刷新图库"
|
||||
@click="refreshAssets"
|
||||
>
|
||||
<template #icon>
|
||||
<RefreshCw
|
||||
:size="16"
|
||||
:class="{ 'animate-spin': query.loading.value }"
|
||||
/>
|
||||
</template>
|
||||
</NButton>
|
||||
</template>
|
||||
刷新图库
|
||||
</NPopover>
|
||||
|
||||
<NPopover trigger="hover" placement="top" :disabled="isMobile">
|
||||
<template #trigger>
|
||||
<NButton
|
||||
@@ -808,11 +770,11 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
||||
/>
|
||||
<NButton :disabled="blocked || hasRunningImages(form.images)" @click="openGenerate(form)"
|
||||
><ImagePlus :size="14" />
|
||||
{{
|
||||
form.images.some(image => image.status === 'completed' && image.imageUrl)
|
||||
? '再生成一张'
|
||||
: '生成图片'
|
||||
}}</NButton
|
||||
{{
|
||||
form.images.some(image => image.status === 'completed' && image.imageUrl)
|
||||
? '再生成一张'
|
||||
: '生成图片'
|
||||
}}</NButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,8 @@ watch(
|
||||
() => [open.value, props.form?.id],
|
||||
() => {
|
||||
prompt.value = ''
|
||||
const selected = props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||
const selected =
|
||||
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||
props.catalog.images.find(item => item.enabled)
|
||||
provider.value = selected?.provider ?? ''
|
||||
generationOptions.value = {
|
||||
@@ -43,7 +44,10 @@ watch(
|
||||
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
|
||||
}
|
||||
const sizeSchema = selected?.generationOptions.find(item => item.key === 'size')
|
||||
if (sizeSchema?.options?.length && !sizeSchema.options.some(option => option.value === generationOptions.value.size)) {
|
||||
if (
|
||||
sizeSchema?.options?.length &&
|
||||
!sizeSchema.options.some(option => option.value === generationOptions.value.size)
|
||||
) {
|
||||
generationOptions.value.size = selected?.defaults.size ?? sizeSchema.options[0]?.value ?? ''
|
||||
}
|
||||
acknowledged.value = false
|
||||
@@ -189,14 +193,14 @@ const rules = {}
|
||||
>
|
||||
</AppForm>
|
||||
<template #footer>
|
||||
<NButton @click="open = false">取消</NButton
|
||||
><NButton
|
||||
:disabled="disabled || !form || !provider || !acknowledged"
|
||||
type="primary"
|
||||
@click="formRef?.validate(submit)"
|
||||
>
|
||||
确认生成图片
|
||||
</NButton>
|
||||
<NButton @click="open = false">取消</NButton
|
||||
><NButton
|
||||
:disabled="disabled || !form || !provider || !acknowledged"
|
||||
type="primary"
|
||||
@click="formRef?.validate(submit)"
|
||||
>
|
||||
确认生成图片
|
||||
</NButton>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</template>
|
||||
@@ -4,6 +4,7 @@ import { ApiError } from '../../lib/http'
|
||||
import { useProjectContext } from '../projects/context'
|
||||
import { getOperation, runOperation } from '../workflows/operations'
|
||||
import { workflowCheckpoints } from '../workflows/selectors'
|
||||
import { useProjectGenerationRevision } from '../generation-config/context'
|
||||
import { generationConfigApi } from '../generation-config/api'
|
||||
import { subjectImagesApi } from './api'
|
||||
import { getImageSession, hasRunningImages } from './model'
|
||||
@@ -24,18 +25,26 @@ export function useSubjectImages() {
|
||||
const promptConcurrency = ref(3)
|
||||
const promptForce = ref(false)
|
||||
const batchModule = ref<'all' | SubjectModule>('all')
|
||||
const generationModelsQuery = usePolling(
|
||||
id,
|
||||
async (_id, signal) => generationConfigApi.catalog(signal),
|
||||
false
|
||||
)
|
||||
const generationModelsQuery = usePolling(id, async (_id, signal) => generationConfigApi.catalog(signal), false)
|
||||
/** 项目配置保存后重新读取实际默认参数,避免图库生图沿用旧模型。 */
|
||||
const generationRevision = useProjectGenerationRevision()
|
||||
/** 配置查询按项目和保存修订号隔离。 */
|
||||
const profileKey = computed(() => JSON.stringify([id.value, generationRevision.value]))
|
||||
/** 当前图库使用后端最新保存的项目配置。 */
|
||||
const profileQuery = usePolling(
|
||||
id,
|
||||
async (projectId, signal) => ({ profile: await generationConfigApi.profile(projectId, signal) }),
|
||||
profileKey,
|
||||
async (key, signal) => {
|
||||
const [projectId] = JSON.parse(key) as [string, number]
|
||||
return { profile: await generationConfigApi.profile(projectId, signal) }
|
||||
},
|
||||
false
|
||||
)
|
||||
const queryRef = {} as { current?: ReturnType<typeof usePolling<Awaited<ReturnType<typeof subjectImagesApi.listForms>>>> }
|
||||
const pollInterval = computed(() => queryDataHasRunningImages(queryRef.current?.data.value ?? null) ? 4000 : false)
|
||||
const queryRef = {} as {
|
||||
current?: ReturnType<typeof usePolling<Awaited<ReturnType<typeof subjectImagesApi.listForms>>>>
|
||||
}
|
||||
const pollInterval = computed(() =>
|
||||
queryDataHasRunningImages(queryRef.current?.data.value ?? null) ? 4000 : false
|
||||
)
|
||||
const query = usePolling(
|
||||
id,
|
||||
async (projectId, signal) => {
|
||||
@@ -53,10 +62,7 @@ export function useSubjectImages() {
|
||||
return forms
|
||||
} catch (error) {
|
||||
if (error instanceof ApiError && error.status === 404)
|
||||
throw new Error(
|
||||
'暂时无法读取形态图片,请稍后重试。',
|
||||
{ cause: error }
|
||||
)
|
||||
throw new Error('暂时无法读取形态图片,请稍后重试。', { cause: error })
|
||||
throw error
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
|
||||
import { NAlert, NButton } from 'naive-ui'
|
||||
import { LoaderCircle, LockKeyhole, LockKeyholeOpen, Palette, RefreshCw, TriangleAlert } from '@lucide/vue'
|
||||
import { LoaderCircle, LockKeyhole, LockKeyholeOpen, Palette, TriangleAlert } from '@lucide/vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useQuery } from '../../composables/useQuery'
|
||||
import { runOperation } from '../workflows/operations'
|
||||
@@ -32,7 +32,7 @@ const nextReady = computed(() => projectContext.stageReadiness.value?.visualStyl
|
||||
|
||||
/** 状态是只读说明,与操作按钮分组;读取失败不能被误报成尚未创建。 */
|
||||
const statusInfo = computed(() => {
|
||||
if (query.error.value) return { label: '读取失败', hint: '请刷新重试,现有内容不会被覆盖', icon: TriangleAlert }
|
||||
if (query.error.value) return { label: '读取失败', hint: '请重试读取,现有内容不会被覆盖', icon: TriangleAlert }
|
||||
if (!query.data.value) return { label: '正在读取', hint: '正在获取项目视觉风格', icon: LoaderCircle }
|
||||
if (!style.value) return { label: '尚未创建', hint: '可使用 AI 生成,或在下方手动填写', icon: Palette }
|
||||
return style.value.isLocked
|
||||
@@ -126,52 +126,46 @@ function removeImage(image: VisualStyleImage) {
|
||||
description="调用文本模型生成整体及分类风格。重新生成会覆盖已保存的文本与硬约束;旧身份、旧图片和已有提示词不会自动更新。"
|
||||
@confirm="generate"
|
||||
/>
|
||||
<NButton
|
||||
:loading="query.loading.value"
|
||||
@click="query.refresh"
|
||||
quaternary
|
||||
class="icon-button"
|
||||
aria-label="刷新风格"
|
||||
title="刷新风格"
|
||||
><template #icon><RefreshCw :size="16" /></template
|
||||
></NButton>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #notice>
|
||||
<NAlert v-if="nextReady" type="success" :show-icon="false">
|
||||
视觉风格已准备好,可以继续确认人物、场景和道具的主体身份。
|
||||
<RouterLink :to="`/projects/${projectId}/subject-identity`" class="text-button ml-2">继续主体身份 →</RouterLink>
|
||||
<RouterLink :to="`/projects/${projectId}/subject-identity`" class="text-button ml-2"
|
||||
>继续主体身份 →</RouterLink
|
||||
>
|
||||
</NAlert>
|
||||
</template>
|
||||
<div class="workspace-section-stack">
|
||||
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false"
|
||||
>{{ query.error.value }} 当前内容读取失败,请刷新后重试;已有内容不会被覆盖。
|
||||
</NAlert>
|
||||
<p v-if="dirty" class="mb-4 text-xs text-muted">
|
||||
有未保存修改,AI 重生成暂不可用。刷新不会覆盖编辑内容;离开页面不会自动保存。
|
||||
</p>
|
||||
<DetailDisclosure title="风格生成规则" >
|
||||
AI
|
||||
生成时,若项目和世界观没有明确其它人物背景,人物风格默认采用中国人物选角基线;人工填写的人物背景和角色事实优先。修改风格只影响之后的生成,旧资产不会自动更新。 </DetailDisclosure
|
||||
><StyleEditor
|
||||
v-if="query.data.value"
|
||||
:key="editorRevision"
|
||||
:visual-style="style"
|
||||
:disabled="disabled"
|
||||
@save="save"
|
||||
@dirty="dirty = $event" />
|
||||
<p v-else-if="query.loading.value" class="py-8 text-sm text-muted" role="status">正在读取视觉风格…</p>
|
||||
<StyleImages
|
||||
:key="imageRevision"
|
||||
:project-id="projectId"
|
||||
:images="style?.images ?? []"
|
||||
:disabled="disabled || !style"
|
||||
@add="addImage"
|
||||
@toggle="toggleImage"
|
||||
@remove="removeImage"
|
||||
/>
|
||||
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false"
|
||||
>{{ query.error.value }} 当前内容读取失败;已有内容不会被覆盖。
|
||||
<NButton text class="ml-3" :loading="query.loading.value" @click="query.refresh">重试读取</NButton>
|
||||
</NAlert>
|
||||
<p v-if="dirty" class="mb-4 text-xs text-muted">
|
||||
有未保存修改,AI 重生成暂不可用。刷新不会覆盖编辑内容;离开页面不会自动保存。
|
||||
</p>
|
||||
<DetailDisclosure title="风格生成规则">
|
||||
AI
|
||||
生成时,若项目和世界观没有明确其它人物背景,人物风格默认采用中国人物选角基线;人工填写的人物背景和角色事实优先。修改风格只影响之后的生成,旧资产不会自动更新。 </DetailDisclosure
|
||||
><StyleEditor
|
||||
v-if="query.data.value"
|
||||
:key="editorRevision"
|
||||
:visual-style="style"
|
||||
:disabled="disabled"
|
||||
@save="save"
|
||||
@dirty="dirty = $event"
|
||||
/>
|
||||
<p v-else-if="query.loading.value" class="py-8 text-sm text-muted" role="status">正在读取视觉风格…</p>
|
||||
<StyleImages
|
||||
:key="imageRevision"
|
||||
:project-id="projectId"
|
||||
:images="style?.images ?? []"
|
||||
:disabled="disabled || !style"
|
||||
@add="addImage"
|
||||
@toggle="toggleImage"
|
||||
@remove="removeImage"
|
||||
/>
|
||||
</div>
|
||||
</WorkspacePage>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { NAlert, NButton, NCollapse, NCollapseItem, NInput, NSelect, NTab, NTabs } from 'naive-ui'
|
||||
import { Download, RefreshCw, Search } from '@lucide/vue'
|
||||
import { Download, Search } from '@lucide/vue'
|
||||
import { AppDialog, EmptyState } from '../../components/ui'
|
||||
import { usePolling } from '../../composables/usePolling'
|
||||
import { downloadText, formatDate, nodeLabel } from '../../lib/format'
|
||||
@@ -96,13 +96,7 @@ function exportReport() {
|
||||
<div class="flex items-center gap-2">
|
||||
<NButton :disabled="!query.data.value" @click="exportReport"
|
||||
><template #icon><Download :size="14" /></template>导出诊断</NButton
|
||||
><NButton
|
||||
class="icon-button"
|
||||
:loading="query.loading.value"
|
||||
aria-label="刷新运行诊断"
|
||||
@click="query.refresh"
|
||||
><template #icon><RefreshCw :size="16" /></template
|
||||
></NButton>
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="diagnostics-filters mt-5">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { NAlert, NButton, NProgress, NTag } from 'naive-ui'
|
||||
import { RefreshCw, X } from '@lucide/vue'
|
||||
import { X } from '@lucide/vue'
|
||||
import { formatDate } from '../../lib/format'
|
||||
import { executionPercentage, executionStageLabel } from './execution'
|
||||
import type { WorkflowExecution } from './execution.types'
|
||||
@@ -88,14 +88,6 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<NButton
|
||||
class="icon-button"
|
||||
quaternary
|
||||
:loading="loading"
|
||||
aria-label="刷新制作任务状态"
|
||||
title="刷新制作任务状态"
|
||||
@click="emit('refresh')"
|
||||
><RefreshCw :size="15" /></NButton
|
||||
><NButton
|
||||
v-if="finished || error"
|
||||
class="icon-button"
|
||||
quaternary
|
||||
@@ -172,7 +164,8 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
</details>
|
||||
</template>
|
||||
<NAlert v-if="error" type="error" :show-icon="false" class="mt-3">
|
||||
{{ error }}。任务可能仍在运行,请先点击刷新;不要直接重复提交。
|
||||
{{ error }}。任务可能仍在运行,请先重新读取状态;不要直接重复提交。
|
||||
<NButton text class="ml-3" :loading="loading" @click="emit('refresh')">重试读取</NButton>
|
||||
</NAlert>
|
||||
</section>
|
||||
</template>
|
||||
@@ -3,7 +3,10 @@ import { NSelect } from 'naive-ui'
|
||||
|
||||
/** 工作区工具弹窗通过真实 Teleport 挂到 body,测试从外层读取,不禁用 Teleport 掩盖挂载问题。 */
|
||||
export function drawerPanel() {
|
||||
return new DOMWrapper(document.body).get<HTMLElement>('.workspace-tools-modal')
|
||||
const body = document.querySelector<HTMLElement>('.workspace-tools-body')
|
||||
const modal = body?.closest<HTMLElement>('.app-dialog')
|
||||
if (!modal) throw new Error('工作区工具弹窗未打开')
|
||||
return new DOMWrapper(modal)
|
||||
}
|
||||
|
||||
/** 通过真实菜单触发器访问低频功能,不直接调用组件内部方法绕过可见性。 */
|
||||
|
||||
Reference in new issue
Block a user