Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions frontend/src/features/workflow-controller/controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,25 @@ describe('WorkflowController', () => {
})
})

it('还没写描述也能先把参考图存下来', async () => {
// 用户常常先传图再想文案。在这里拒空的话,上传成功了却因为描述为空而回写失败,
// 图就丢了 —— 而界面上参考图那栏标的是「选填」。真正必填的是提交生成那一刻,
// 那道闸在生成按钮上。
const { controller } = createController()

await controller.updateCharacterSetup('setup-1', {
prompt: '',
referenceMedia: ['https://img/my-own-character.png' as never],
})

expect(controller.getWorkflow().nodes[0]).toMatchObject({
input: {
prompt: '',
referenceMedia: ['https://img/my-own-character.png'],
},
})
})

it('接受上传母版时完成角色设定和母版节点', async () => {
const { controller } = createController()

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/features/workflow-controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,11 @@ export function createWorkflowController({
input: Pick<WorkflowCharacterInput, 'prompt' | 'referenceMedia'>,
) {
ensureRunning()
const prompt = nonEmpty(input.prompt, 'prompt')
// 描述**允许为空**。这个方法既保存描述也保存参考图,而用户常常先传图再想文案 ——
// 在这里拒空等于「上传成功了,但因为你还没写描述,图丢了」,而界面上参考图那栏
// 标的是「选填」。真正必填的是**提交生成**那一刻,那道闸在生成按钮上(prompt 为空
// 时按钮置灰),不需要这里再拦一次。
const prompt = input.prompt ?? ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Retain prompt validation at the generation boundary

This now persists an empty prompt, but the separate character-template node's ready-state action remains enabled and calls generateCharacterTemplate without an options.input override. That path consumes setupNode.input.prompt directly and submits it to the generation API, so a user who uploads a reference image first can click that button and start generation with an empty required description. Please keep the empty value for the upload/update operation while validating the stored prompt in generateCharacterTemplate/the submission path (or otherwise disable that second entry point when it is empty).

return persist((run) =>
updateNode(run, nodeId, (node) => {
if (node.type !== 'character-setup') throw new Error('目标节点不是角色设定')
Expand Down
Loading