feat(short-drama-agent-front): 支持母版复用并优化生成交互

This commit is contained in:
GJ committed 2026-10-12 15:22:03 +08:00
1 parent 49fb9c7a27
commit ee5e49957a
28 files changed
+634 -326

No files matched your search

@@ -6,10 +6,23 @@ import { formatDate } from '../../lib/format'
import { executionPercentage, executionStageLabel } from './execution'
import type { WorkflowExecution } from './execution.types'
/** 后台任务面板的展示数据与加载状态。 */
const props = withDefaults(
defineProps<{ title?: string; execution: WorkflowExecution | null; loading: boolean; error: string }>(),
{ title: '制作任务' }
defineProps<{
/** 任务标题。 */
title?: string
/** 后端任务记录。 */
execution: WorkflowExecution | null
/** 是否正在读取状态。 */
loading: boolean
/** 状态读取错误。 */
error: string
/** 是否展示运行与完成说明,已有消息及详细快照的页面可关闭。 */
showStatusHint?: boolean
}>(),
{ title: '制作任务', showStatusHint: true }
)
/** 刷新状态与隐藏任务记录事件。 */
const emit = defineEmits<{ refresh: []; dismiss: [] }>()
const percentage = computed(() => executionPercentage(props.execution?.current ?? 0, props.execution?.total ?? 0))
const result = computed(() => props.execution?.result ?? {})
@@ -21,6 +34,8 @@ const statusType = computed(() =>
props.execution?.status === 'completed' ? 'success' : props.execution?.status === 'failed' ? 'error' : 'warning'
)
const finished = computed(() => ['completed', 'failed'].includes(props.execution?.status ?? ''))
/** 是否为剧本创作任务,避免使用镜头素材的提示文案。 */
const scriptCreation = computed(() => props.execution?.workflowName === 'create-drama')
const videoQuality = computed(() => props.execution?.workflowName === 'video-quality')
/** 首帧质量后台任务使用独立的通过与修复失败统计,不套用普通生图字段。 */
const keyframeQuality = computed(() => props.execution?.workflowName === 'keyframe-quality')
@@ -110,18 +125,20 @@ function isInputMode(value: unknown, inputMode: string): boolean {
/>
<p class="mt-3 text-xs">
<template v-if="execution.total > 0">已处理 {{ execution.current }} / {{ execution.total }}</template>
<template v-else>正在准备本次任务</template>
<template v-if="execution.currentResourceId">
<template v-else>{{
finished ? '本次任务已结束' : scriptCreation ? '正在创作剧本' : '正在准备本次任务'
}}</template>
<template v-if="execution.currentResourceId && !scriptCreation">
· 当前镜头 <code>{{ execution.currentResourceId }}</code></template
>
</p>
<NAlert v-if="execution.status === 'running'" type="info" :show-icon="false" class="mt-3">
<NAlert v-if="execution.status === 'running' && showStatusHint" type="info" :show-icon="false" class="mt-3">
{{
videoQuality ? '系统会继续生成、检查并按需修复。' : '系统会继续处理剩余内容并保存已完成结果。'
}}可以离开或刷新页面,返回后会继续显示本次任务进度,请勿重复提交。
</NAlert>
<NAlert
v-else-if="execution.status === 'completed'"
v-else-if="execution.status === 'completed' && showStatusHint"
:type="
keyframeQuality && (!keyframeCounts || keyframeCounts.repairFailed + keyframeCounts.failed > 0)
? 'warning'
@@ -130,7 +147,13 @@ function isInputMode(value: unknown, inputMode: string): boolean {
:show-icon="false"
class="mt-3"
>
<p>本轮任务已结束,页面正在重新读取镜头资产状态。</p>
<p>
{{
scriptCreation
? '剧本创作任务已结束,页面正在重新读取剧本内容。'
: '本轮任务已结束,页面正在重新读取镜头资产状态。'
}}
</p>
<p v-if="videoQuality" class="mt-2 text-xs">
目标 {{ result.targetCount ?? execution.total }} · 通过 {{ result.passed ?? 0 }} · 修复耗尽
{{ result.exhausted ?? 0 }} · 模型失败 {{ result.providerFailed ?? 0 }} · 提交失败
@@ -147,7 +170,7 @@ function isInputMode(value: unknown, inputMode: string): boolean {
>
<template v-else>后端首帧质量统计不完整,请查看任务详情并刷新核对。</template>
</p>
<p v-else-if="!videoQuality" class="mt-2 text-xs">
<p v-else-if="!videoQuality && !scriptCreation" class="mt-2 text-xs">
共 {{ result.total ?? execution.total }} · 生成 {{ result.generated ?? execution.current }} · 跳过
{{ result.skipped ?? 0 }} · 阻塞 {{ result.blocked ?? 0 }} · 失败 {{ result.failed ?? 0 }}
</p>
@@ -155,7 +178,11 @@ function isInputMode(value: unknown, inputMode: string): boolean {
<NAlert v-else-if="execution.status === 'failed'" type="error" :show-icon="false" class="mt-3">
<p>{{ execution.error || '制作任务执行失败。' }}</p>
<p class="mt-2 text-xs">
请先刷新相关资产状态,确认已成功的镜头;处理报错原因后,只对仍处于“可执行”的镜头重新提交。
{{
scriptCreation
? '请先核对已保存的剧本内容,处理报错原因后从当前阶段恢复生成或改写。'
: '请先刷新相关资产状态,确认已成功的镜头;处理报错原因后,只对仍处于“可执行”的镜头重新提交。'
}}
</p>
</NAlert>
<details class="mt-3 text-[10px] text-muted">