From db29367c69a7e8017f048a5f266a2409e8981650 Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 4 Sep 2026 17:38:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=B3=E9=97=AD=E5=B7=B2=E6=9C=89?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E8=BD=AE=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- src/App.vue | 2 +- .../components/ShotProductionAssets.vue | 23 +++--- src/features/production/useProduction.ts | 33 +++++---- src/features/projects/ProjectsPage.vue | 3 +- src/features/storyboard/useStoryboard.ts | 39 +++++----- .../components/IdentityEditor.vue | 2 +- .../subject-identity/useSubjectIdentity.ts | 74 ++++++++++++------- src/features/visual-style/VisualStylePage.vue | 17 +++-- .../workflows/WorkflowDiagnosticsDialog.vue | 3 +- 10 files changed, 122 insertions(+), 80 deletions(-) diff --git a/README.md b/README.md index aa266cd..f3d2673 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Oxfmt 不负责代码质量,Oxlint 不负责 Vue 的完整类型推导;Vue S - 外层应用固定为视口高度;侧栏、顶栏、项目标题和工作流导航不会随正文滚动。 - 工作流只保留左侧导航,项目标题下不再重复展示相同标签。主体身份、分镜设计、镜头生产和图库采用内容优先布局:常用筛选/剧集选择/刷新在固定的紧凑工具栏,列表占据剩余高度。 -- 项目标题栏只显示返回入口和名称,不再放置状态标签与刷新按钮;除形态图库使用手动刷新外,其他项目工作区每 6 秒自动刷新,读取失败时在错误提示内提供重试入口。 +- 项目标题栏只显示返回入口和名称,不再放置状态标签与刷新按钮;已有刷新按钮的工作区不再定时轮询,剧本创作和拆解仍每 6 秒同步项目状态,读取失败时在错误提示内提供重试入口。 - 只有当前项目正式状态为 `completed` 才解锁下游工作区;草稿、生成中、待审核、失败和读取期间默认禁用下游导航。直接访问下游链接只显示返回剧本创作的引导,不挂载操作组件;轮询确认完成后自动解锁,切换项目立即重新判定。页面内提交守卫同步检查完成状态;这是前端交互限制,不代替后端权限与业务校验。 - 项目列表采用固定表头表格;剧本、分镜、身份与生产页的目录和详情独立滚动,其他工作区只滚动内容区。 - “我的剧本”状态筛选采用中号控件,与搜索框等高并扩大点击区域;刷新、主题、折叠和关闭等单图标按钮统一使用直角正方形,加载时保持尺寸不变,保留可访问名称。 @@ -201,7 +201,7 @@ API 层也提供 `state` 与 `breakdown/latest` 方法。页面通过共享 chec 1. `POST /projects` 返回顶层 `202 { projectId, status }`,其他接口通常返回 `{ data }`;HTTP 层分别兼容。 2. Breakdown、Storyboard 和恢复接口目前是**长 HTTP 请求**。不设客户端短超时,不自动重试 POST。关闭页面只会丢失请求连接,**不会取消后端任务**。 -3. 项目列表每 12 秒、项目详情每 6 秒串行刷新。形态图库暂停父布局和页面定时查询,返回其他工作区恢复轮询;图库直接链接被未完成状态拦截时可手动刷新项目状态。隐藏页面暂停自动查询。切换项目或离开布局时取消查询,旧响应不会覆盖新项目。 +3. 项目列表、视觉风格、主体身份、分镜、镜头生产、单镜头资产和运行诊断已有刷新按钮,只在进入、切换目标和手动刷新时读取。剧本创作与拆解仍每 6 秒同步项目详情和 checkpoint。形态图库暂停父布局和页面定时查询;图库直接链接被未完成状态拦截时可手动刷新项目状态。隐藏页面暂停自动查询。切换项目或离开布局时取消查询,旧响应不会覆盖新项目。 4. 抽取任务进度不是全流程进度。抽取完成之后还需要主体合并、形态、节拍、镜头和持久化。 5. 后端失败 checkpoint 可能只有错误。页面回看最近可用的完整快照以保留成果,同时使用最新记录的 execution 状态。显示的是**最近可用快照**,并不保证全部成果来自最后一次执行。 6. 后端并不为每个阶段提供持久化的 running 状态。没有明确终态时,页面显示“阶段快照 · 执行状态待确认”,不会猜测成功或失败。 @@ -217,7 +217,7 @@ API 层也提供 `state` 与 `breakdown/latest` 方法。页面通过共享 chec 5. 批量默认 `force: false`,跳过完整剧集。重新点击“补齐”用于重试未完成项,没有虚构独立 retry 接口。`force: true` 才覆盖全部。VisualState 可设置非负整数修复次数,`0` 表示不修复。 6. VisualState 单集生成需要该集所有正式镜头都有 Direction;批量接口由后端逐集检查,缺少前置条件的集数会单独失败。HTTP 200 也可能包含校验失败或部分失败,页面展示逐集诊断和修复次数,不视为全成功。 7. 上游重生成**不会自动使下游旧数据失效**。覆盖 Direction 后请重生成 VisualState,修改设计/状态/参考图后按需覆盖 Prompt。覆盖率只说明字段已保存,不能证明下游与新版本一致。 -8. 每 6 秒查询当前剧集的两类正式结果;这不是全项目实时进度。后端没有独立 Storyboard running / executionId 查询。回执只保留当前浏览器会话,切换页面不丢失,刷新浏览器会丢失。 +8. 分镜页用刷新按钮查询当前剧集的两类正式结果;这不是全项目实时进度。后端没有独立 Storyboard running / executionId 查询。回执只保留当前浏览器会话,切换页面不丢失,刷新浏览器会丢失。 9. 参考图和 GenerationSpec 按需 GET,切换镜头或设计变化时取消旧查询。GenerationSpec 需要有效的 Direction、VisualState 和形态关联,不生成图片或视频。 10. Video Prompt、Keyframe 与 Video 都有项目级 readiness。`force` 会重写 Prompt,普通首帧/视频新增候选;**过期首帧即使 force 也会更新主图**,非 force 的过期视频完成后会接替旧主视频。确认文案明确此差异。首帧支持可选 `limit` 和成对 `width`/`height`,只影响首帧,不污染提示词和视频参数。视频任务创建成功不代表成片完成,最终状态以后端轮询和持久化资产为准。 diff --git a/src/App.vue b/src/App.vue index c0a45c4..c14af74 100644 --- a/src/App.vue +++ b/src/App.vue @@ -229,7 +229,7 @@ const menuOptions = computed(() => [
生产环境
为 /api、/storage 配置反向代理,并为长工作流设置足够的超时。
状态更新
-
形态图库使用手动刷新,其他项目工作区每 6 秒更新;关闭页面不会取消后端任务。
+
已有刷新按钮的页面使用手动更新;剧本创作和拆解仍每 6 秒同步项目状态。关闭页面不会取消后端任务。
diff --git a/src/features/production/components/ShotProductionAssets.vue b/src/features/production/components/ShotProductionAssets.vue index e66362f..8290b1e 100644 --- a/src/features/production/components/ShotProductionAssets.vue +++ b/src/features/production/components/ShotProductionAssets.vue @@ -40,15 +40,20 @@ const props = defineProps<{ }>() const emit = defineEmits<{ changed: [] }>() const key = computed(() => props.shot.shotId) -const query = usePolling(key, async (shotId, signal) => { - const [keyframes, videos] = await Promise.all([ - productionApi.listKeyframes(shotId, signal), - productionApi.listVideos(shotId, signal) - ]) - if (keyframes.some(item => item.shotId !== shotId) || videos.some(item => item.shotId !== shotId)) - throw new Error('资产记录与当前镜头不匹配,请刷新后重试。') - return { keyframes, videos } -}) +/** 单镜头资产已有刷新入口,不再定时轮询。 */ +const query = usePolling( + key, + async (shotId, signal) => { + const [keyframes, videos] = await Promise.all([ + productionApi.listKeyframes(shotId, signal), + productionApi.listVideos(shotId, signal) + ]) + if (keyframes.some(item => item.shotId !== shotId) || videos.some(item => item.shotId !== shotId)) + throw new Error('资产记录与当前镜头不匹配,请刷新后重试。') + return { keyframes, videos } + }, + false +) const keyframes = computed(() => query.data.value?.keyframes ?? []) const videos = computed(() => query.data.value?.videos ?? []) const currentKeyframe = computed(() => primaryKeyframe(keyframes.value)) diff --git a/src/features/production/useProduction.ts b/src/features/production/useProduction.ts index 64a439d..d78f87f 100644 --- a/src/features/production/useProduction.ts +++ b/src/features/production/useProduction.ts @@ -42,20 +42,25 @@ export function useProduction() { 0 ) const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value, force.value])) - const query = usePolling(queryKey, async (key, signal) => { - const [projectId, number, overwrite] = JSON.parse(key) as [string, number, boolean] - if (!projectId || !number) return null - const [directions, prompts, keyframes, videos, videoStatus] = await Promise.all([ - storyboardApi.directions(projectId, number, signal), - productionApi.promptReadiness(projectId, overwrite, signal), - productionApi.keyframeReadiness(projectId, overwrite, signal), - productionApi.videoReadiness(projectId, overwrite, signal), - productionApi.projectVideoStatus(projectId, signal) - ]) - if (directions.projectId !== projectId || directions.episodeNo !== number) - throw new Error('镜头生产查询返回了不匹配的项目或剧集,请刷新后重试。') - return { directions, prompts, keyframes, videos, videoStatus } - }) + /** 生产页已有刷新按钮,就绪状态改为手动更新。 */ + const query = usePolling( + queryKey, + async (key, signal) => { + const [projectId, number, overwrite] = JSON.parse(key) as [string, number, boolean] + if (!projectId || !number) return null + const [directions, prompts, keyframes, videos, videoStatus] = await Promise.all([ + storyboardApi.directions(projectId, number, signal), + productionApi.promptReadiness(projectId, overwrite, signal), + productionApi.keyframeReadiness(projectId, overwrite, signal), + productionApi.videoReadiness(projectId, overwrite, signal), + productionApi.projectVideoStatus(projectId, signal) + ]) + if (directions.projectId !== projectId || directions.episodeNo !== number) + throw new Error('镜头生产查询返回了不匹配的项目或剧集,请刷新后重试。') + return { directions, prompts, keyframes, videos, videoStatus } + }, + false + ) const source = computed(() => sourceEpisodes.value.find(item => item.episodeNo === 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]) diff --git a/src/features/projects/ProjectsPage.vue b/src/features/projects/ProjectsPage.vue index bd0888f..e11ac3a 100644 --- a/src/features/projects/ProjectsPage.vue +++ b/src/features/projects/ProjectsPage.vue @@ -13,7 +13,8 @@ import CreateProjectDialog from './components/CreateProjectDialog.vue' /** 项目表格使用固定表头与独立滚动;搜索筛选仍作用于真实接口数据。 */ const router = useRouter() -const query = usePolling(ref('projects'), (_, signal) => projectsApi.list(signal), 12_000) +/** 列表已有刷新按钮,只在进入、筛选切换和手动刷新时读取。 */ +const query = usePolling(ref('projects'), (_, signal) => projectsApi.list(signal), false) const search = ref('') const filter = ref('all') const page = ref(1) diff --git a/src/features/storyboard/useStoryboard.ts b/src/features/storyboard/useStoryboard.ts index c630083..4256602 100644 --- a/src/features/storyboard/useStoryboard.ts +++ b/src/features/storyboard/useStoryboard.ts @@ -38,23 +38,28 @@ export function useStoryboard() { 0 ) const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value])) - const query = usePolling(queryKey, async (key, signal) => { - const [projectId, number] = JSON.parse(key) as [string, number] - if (!projectId || !number) return null - const [directions, visualStates] = await Promise.all([ - storyboardApi.directions(projectId, number, signal), - storyboardApi.visualStates(projectId, number, signal) - ]) - if ( - directions.projectId !== projectId || - visualStates.projectId !== projectId || - directions.episodeNo !== number || - visualStates.episodeNo !== number - ) { - throw new Error('分镜查询返回了不匹配的项目或剧集,请刷新后重试。') - } - return { directions, visualStates } - }) + /** 分镜页已有刷新按钮,不再定时轮询当前剧集。 */ + const query = usePolling( + queryKey, + async (key, signal) => { + const [projectId, number] = JSON.parse(key) as [string, number] + if (!projectId || !number) return null + const [directions, visualStates] = await Promise.all([ + storyboardApi.directions(projectId, number, signal), + storyboardApi.visualStates(projectId, number, signal) + ]) + if ( + directions.projectId !== projectId || + visualStates.projectId !== projectId || + directions.episodeNo !== number || + visualStates.episodeNo !== number + ) { + throw new Error('分镜查询返回了不匹配的项目或剧集,请刷新后重试。') + } + return { directions, visualStates } + }, + false + ) const data = query.data const source = computed(() => sourceEpisodes.value.find(item => item.episodeNo === episodeNo.value)) const shots = computed(() => diff --git a/src/features/subject-identity/components/IdentityEditor.vue b/src/features/subject-identity/components/IdentityEditor.vue index 93d4434..c529177 100644 --- a/src/features/subject-identity/components/IdentityEditor.vue +++ b/src/features/subject-identity/components/IdentityEditor.vue @@ -82,7 +82,7 @@ function save() { >
{{ - dirty ? '有未保存修改,自动刷新不会覆盖草稿。' : '图片以已保存的身份提示词为准。' + dirty ? '有未保存修改,刷新不会覆盖草稿。' : '图片以已保存的身份提示词为准。' }}保存主体身份
diff --git a/src/features/subject-identity/useSubjectIdentity.ts b/src/features/subject-identity/useSubjectIdentity.ts index 7342cbb..ee97526 100644 --- a/src/features/subject-identity/useSubjectIdentity.ts +++ b/src/features/subject-identity/useSubjectIdentity.ts @@ -30,39 +30,59 @@ export function useSubjectIdentity() { const concurrency = ref(3) const candidateLimit = ref(3) const force = ref(false) - const catalog = usePolling(projectId, async (id, signal) => { - const forms = await subjectImagesApi.listForms(id, signal) - if ( - forms.some( - form => form.subject.projectId !== id || form.images.some(image => image.subjectFormId !== form.id) + /** 目录与身份已有刷新按钮,查询只在进入、切换和手动刷新时读取。 */ + const catalog = usePolling( + projectId, + async (id, signal) => { + const forms = await subjectImagesApi.listForms(id, signal) + if ( + forms.some( + form => form.subject.projectId !== id || form.images.some(image => image.subjectFormId !== form.id) + ) ) - ) - throw new Error('主体目录与当前项目不匹配,请刷新后重试。') - return { subjects: groupIdentitySubjects(forms), running: forms.some(form => hasRunningImages(form.images)) } - }) - const styleQuery = usePolling(projectId, async (id, signal) => { - const style = await visualStyleApi.get(id, signal) - if (style && style.projectId !== id) throw new Error('视觉风格与当前项目不匹配。') - return { style } - }) - const castingQuery = usePolling(projectId, async (id, signal) => { - const readiness = await subjectIdentityApi.castingReadiness(id, signal) - return readiness - }) + throw new Error('主体目录与当前项目不匹配,请刷新后重试。') + return { + subjects: groupIdentitySubjects(forms), + running: forms.some(form => hasRunningImages(form.images)) + } + }, + false + ) + const styleQuery = usePolling( + projectId, + async (id, signal) => { + const style = await visualStyleApi.get(id, signal) + if (style && style.projectId !== id) throw new Error('视觉风格与当前项目不匹配。') + return { style } + }, + false + ) + const castingQuery = usePolling( + projectId, + async (id, signal) => { + const readiness = await subjectIdentityApi.castingReadiness(id, signal) + return readiness + }, + false + ) const subjects = computed(() => mergeCastingSubjects(catalog.data.value?.subjects ?? [], castingQuery.data.value?.items ?? [], projectId.value) ) const subject = computed(() => subjects.value.find(item => item.id === selectedId.value)) const selectionKey = computed(() => subject.value?.id ?? '') - const detail = usePolling(selectionKey, async (id, signal) => { - if (!id) return null - const identity = await subjectIdentityApi.get(id, signal) - if (!identity) return { identity: null, images: [] as IdentityImage[] } - assertIdentity(identity, id) - const images = await subjectIdentityApi.listImages(id, signal) - if (images.some(image => image.identityId !== identity.id)) throw new Error('身份图片与当前主体不匹配。') - return { identity, images } - }) + const detail = usePolling( + selectionKey, + async (id, signal) => { + if (!id) return null + const identity = await subjectIdentityApi.get(id, signal) + if (!identity) return { identity: null, images: [] as IdentityImage[] } + assertIdentity(identity, id) + const images = await subjectIdentityApi.listImages(id, signal) + if (images.some(image => image.identityId !== identity.id)) throw new Error('身份图片与当前主体不匹配。') + return { identity, images } + }, + false + ) const identity = computed(() => detail.data.value?.identity ?? null) const images = computed(() => detail.data.value?.images ?? []) const castingItem = computed(() => diff --git a/src/features/visual-style/VisualStylePage.vue b/src/features/visual-style/VisualStylePage.vue index e76a4a1..eb09d98 100644 --- a/src/features/visual-style/VisualStylePage.vue +++ b/src/features/visual-style/VisualStylePage.vue @@ -15,11 +15,16 @@ import StyleImages from './components/StyleImages.vue' /** 项目视觉风格工作区:文本编辑、锁定和风格图记录分开管理。 */ const { projectId, blocked } = useProjectMutationGuard() -const query = usePolling(projectId, async (id, signal) => { - const style = await visualStyleApi.get(id, signal) - assertProject(style, id) - return { style } -}) +/** 风格页已有刷新按钮,不再定时轮询。 */ +const query = usePolling( + projectId, + async (id, signal) => { + const style = await visualStyleApi.get(id, signal) + assertProject(style, id) + return { style } + }, + false +) const style = computed(() => query.data.value?.style ?? null) const disabled = computed(() => blocked.value || !!query.error.value || !query.data.value) const editorRevision = ref(0) @@ -143,7 +148,7 @@ function removeImage(image: VisualStyleImage) { >{{ query.error.value }} 请确认后端 dev 已更新并重启;查询失败不等同于尚未创建。

- 有未保存修改,AI 重生成暂不可用。自动刷新不会覆盖编辑内容;离开页面不会自动保存。 + 有未保存修改,AI 重生成暂不可用。刷新不会覆盖编辑内容;离开页面不会自动保存。

AI diff --git a/src/features/workflows/WorkflowDiagnosticsDialog.vue b/src/features/workflows/WorkflowDiagnosticsDialog.vue index ebf5ecb..fa8433d 100644 --- a/src/features/workflows/WorkflowDiagnosticsDialog.vue +++ b/src/features/workflows/WorkflowDiagnosticsDialog.vue @@ -12,7 +12,8 @@ import type { Checkpoint } from './types' const props = defineProps<{ projectId: string; checkpoints: Checkpoint[] }>() const open = defineModel('open', { default: false }) const key = computed(() => (open.value ? props.projectId : '')) -const query = usePolling(key, (id, signal) => (id ? loadWorkflowDiagnostics(id, signal) : Promise.resolve(null)), 12000) +/** 诊断弹窗已有刷新按钮,打开后只读取一次。 */ +const query = usePolling(key, (id, signal) => (id ? loadWorkflowDiagnostics(id, signal) : Promise.resolve(null)), false) const tab = ref('timeline') const workflow = ref('all') const search = ref('')