feat(workflow-run): implement resumable generation orchestration - #86
feat(workflow-run): implement resumable generation orchestration#86xyh202131 wants to merge 21 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
No issues found in this review.
Verified:
npm test -- --run src/entities/workflow-run/store.test.tsnpm run typecheck
Note: dependency installation completed with a Node engine warning because this sandbox uses Node 20 while react-router@8.3.0 declares Node >=22.22.0.
|
|
||
| /** | ||
| * 一个 Run 只有一个目标。新建角色和追加动作可在同一界面连续操作, | ||
| * 但是两次独立任务,因此使用两个 WorkflowRun。 |
There was a problem hiding this comment.
看起来我们这里的理解并不一致,我以为一个根节点对应的就是一个 workflow run,你这里的设定似乎是:一个像“生成角色并为之添加动作”的过程会包含两个或更多的 workflow run,这么设定的考虑是?
There was a problem hiding this comment.
我想的是,生成图片为一次任务,然后再据此生成动作资产为另一次任务,后面任务失败不影响前面任务成功,前面图片仍然能被保存
There was a problem hiding this comment.
生成图片为一次任务,然后再据此生成动作资产为另一次任务
你说的这个“任务”更接近服务端的 generation-task 概念?
按我们昨天跟服务端同学的讨论看,generation-task 跟 workflow-run 是两个独立的概念,数据也是各自独立的;只是由前端的逻辑同时负责构造 generation-task 和维护 workflow-run 状态,一个 workflow-run 可以对应 1 个或多个(甚至 0 个)generation task,同样地,一个 workflow-run 中的 step 也可以对应 1 个或多个(甚至 0 个)generation task
There was a problem hiding this comment.
应该是,因为图片生成和动作资产生成,本身就是不同的generation task
There was a problem hiding this comment.
我以为一个根节点对应的就是一个 workflow run,你这里的设定似乎是:一个像“生成角色并为之添加动作”的过程会包含两个或更多的 workflow run
那再回头考虑下这个设定?可能有这几个问题要回答:
- workflow editor 的对象不是一个 workflow-run,而是多个 workflow-run 了,那么它们怎么被关联起来?
- workflow editor 的 URL 参数是什么?
- 后续用户在检查台希望重新生成某一个 action 的话,回来 workflow editor 应该是带着什么样的 URL 参数回来以便定位到这个 action 的重新生成?
- 跟上一条类似,如果后续用户在资产库中一个已经存在的 character 页面,希望给这个 character 添加新的 action,应该是带着什么样的 URL 参数去 workflow editor 以定位到添加 action 的动作?
|
|
||
| /** | ||
| * Revision 级状态。用户从旧步骤重做时,旧 Revision 变为 abandoned, | ||
| * 并追加新 Revision;不覆盖历史,才能说清“这个结果从哪次重做而来”。 |
There was a problem hiding this comment.
用户从旧步骤重做的时候,为什么要保留历史?
才能说清“这个结果从哪次重做而来”。
这个没理解
There was a problem hiding this comment.
刚才我们已经和后端对齐过,因为后端采用树状纯存储模型,不提供回退或 Revision 历史能力。因此用户从旧步骤重做时,前端不再保留被废弃结果的历史链路,也不支持回退,当前 Quick Start 会移除这部分 revision 设计。
这样 ok 吗
There was a problem hiding this comment.
减少概念或机制我没问题,只要能实现你们想提供的用户功能就好
| add_action: [ | ||
| 'action-setup', | ||
| 'first-frame', | ||
| 'first-frame-candidate', |
There was a problem hiding this comment.
first-frame-candidate 和 first-frame 什么区别?以及
- character-template vs template-candidate
- complete-animation vs review
我也有相同的困惑
There was a problem hiding this comment.
character-template:调用生成接口,产生四张角色候选图。
template-candidate:用户从四张图中选择一张。
first-frame:调用接口生成四张动作首帧。
first-frame-candidate:用户选择其中一张首帧。
complete-animation:根据选中首帧生成完整动画。
review:用户审核完整动画。
主要是有一个选择过程
There was a problem hiding this comment.
character-template:调用生成接口,产生四张角色候选图。
template-candidate:用户从四张图中选择一张。
从 workflow editor 里看,这两个操作对应的应该是同一个“卡片”(只是卡片内部状态会因为用户做了选择而发生变化);所以你定义的 step 跟 UI 上表达步骤的“卡片”不是同一个概念?
There was a problem hiding this comment.
那你可能要考虑:是继续保持现在 step 数据跟 UI 上的卡片不一一对应的做法,还是做成一一对应
不一一对应的话,在展示层就需要额外的逻辑来将 step 列表转化为按卡片组织的列表数据?
| } | ||
|
|
||
| /** | ||
| * 验证 Revision 历史链,防止伪造或悬空引用。 |
There was a problem hiding this comment.
感觉我们需要单独对下 revision,这里似乎围绕 revision 实现了一整套机制,但是我没太理解
There was a problem hiding this comment.
revision其实我们当前quick start应该不需要,真正需要的是work editor
There was a problem hiding this comment.
我们当前quick start应该不需要
这个没关系,对于 workflow editor,revision 具体是怎么解决、解决了什么问题我也还需要理解下
| */ | ||
| export interface WorkflowRunStore { | ||
| create(input: CreateWorkflowRunInput): WorkflowRun | ||
| get(runId: WorkflowRun['id']): WorkflowRun | null |
There was a problem hiding this comment.
既然考虑对接服务端接口,那这里的接口 cretea、get、list、save 等就不能假设是同步的?
另外不应该会有 subscribe / subscribeAll 接口吧?它们是什么用途?
There was a problem hiding this comment.
目前的话受当前 localStorage 同步实现影响了,如果它要作为后续服务端持久化的抽象边界,create/get/list/save 应该统一定义为异步接口。subscribe/subscribeAll 原本分别用于创作页面监听单个 Run、历史列表监听全部 Run 的本地变化
There was a problem hiding this comment.
subscribe/subscribeAll 原本分别用于创作页面监听单个 Run、历史列表监听全部 Run 的本地变化
所有的 workflow-run 状态变更都是前端逻辑自己驱动的,它自己应该能知道什么时候状态变更了,而不需要专门的监听接口;就像我们不会有监听 project、asset 数据变更的接口一样
|
|
||
| export interface WorkflowRunService { | ||
| /** 暂停进行中的 Run;当前 Revision 和 active 步骤保持不变。 */ | ||
| interruptRun(runId: string): WorkflowRun |
There was a problem hiding this comment.
感觉把一个 workflow-run 内的操作/状态迁移也作为 WorkflowRunService 的方法并不好用?像这样去定义可能会更合适:
interface WorkflowRun {
interrupt(): ...
continue(): ...
start(): ...
resumeCharacterCandidates(): ...
}
interface WorkflowRunService {
create(): WorkflowRun
get(): WorkflowRun
}这个好处是大部分的逻辑不需要同时持有一个 WorkflowRunService 实例和一个 runId,而是持有一个 WorkflowRun 实例就好了,另外我们也可以做到把 WorkflowRun 上边的单次操作跟 WorkflowRun 整体的持久化(如保存到服务端)解耦,不一定每次对 WorkflowRun 做什么操作都立刻保存到服务端
…ore-clean # Conflicts: # README.md # frontend/README.md
|
@fennoai /review |
Review CompleteSubmitted a non-blocking PR review with one low-severity documentation finding: Verified locally:
Note: |
There was a problem hiding this comment.
Review findings:
- Low:
frontend/src/pages/home/index.tsx:32still documents the old eight-stepWORKFLOW_STEP_ORDERmodel (character-setup,template-candidate,complete-animation, etc.), but this PR replaces that public vocabulary with card-alignedWORKFLOW_STEP_ORDERScontainingcharacter/actionsteps and phase-based internals. Anyone updating the home workflow copy from this comment will now be pointed at deleted names and the wrong model shape. Please update or remove this comment alongside the WorkflowRun model change.
Verification run locally: npm run test, npm run typecheck, npm run lint, npm run build, and git diff --check 023bf0f86e8089681ae9a09427a12306b3c0b3dc...014e83a958d3b965b4ec5738e95ae805f9d188de. Note: npm ci emitted an engine warning because this sandbox uses Node v20.20.2 while react-router@8.3.0 declares Node >=22.22.0.
…ore-clean # Conflicts: # frontend/src/entities/index.ts
|
@fennoai /compact 根据当前PR 现状和评论列出未定事项,不要删除任何评论 |

目的
实现可恢复的 WorkflowRun 前端核心,并让数据结构与即将接入的 Workflow Editor 卡片语义保持一致。
当前设计
WorkflowRun;角色与动作生成是同一 Run 下的多个GenerationTaskdriver,运行模型不感知 Quick Start 是自动推进还是用户手动推进WorkflowStep与编辑器卡片一一对应,生成、选择、审核等卡片内部过程由phase表达WorkflowRevision:Editor 从某张卡片重做时追加执行分支,旧 Revision 只读create/get/list/save全部异步,并删除subscribe/subscribeAllWorkflowRunService只负责create/get,返回绑定具体 Run 的实例save();远程任务 ID 等恢复检查点及时持久化业务链路
范围
验证
npm run typecheck:通过npm run lint:通过npm run test:17 项通过npm run build:通过git diff --check:通过dist/、node_modules/未提交本 PR 仅供审核,不执行合并。替代已关闭且未合并的 #85。