Skip to content

[Bug]: 先传参考图会报「prompt 不能为空」,用户被迫先写描述 #907

Description

@johnnyzhang-eng

现象

在「01 角色设定」里,如果先点 Choose File 传参考图、还没写角色描述,上传后立刻弹出:

prompt 不能为空

图其实已经传上去了,但这条错误让人以为上传失败。用户此时的合理反应是「我只是传张图,为什么要我写 prompt」——而界面上那个输入框标的是「角色描述」,报错说的是「prompt」,两个词也对不上。

根因

uploadReferenceImage 在上传成功后立刻回写节点:

frontend/src/pages/workflow-editor/index.tsx:646
  input.uploadReferenceImage(file, signal)
    .then((reference) => input.controller.updateCharacterSetup(node.id, {
      prompt,                       // ← 此刻还是空字符串
      referenceMedia: [reference],
    }))

updateCharacterSetup 第一行就是:

controller.ts:885   const prompt = nonEmpty(input.prompt, 'prompt')

所以上传参考图这个动作被迫携带了一份当前还不存在的描述,校验直接拒。顺序被隐式规定成「必须先写描述、再传图」,而界面上没有任何提示说明这一点——参考图那一栏还标着「(选填)」。

影响

每一个「先传图、再想文案」的用户都会撞上,而这是很自然的操作顺序(尤其是手上已经有角色图的时候)。

建议

回写时不要带 prompt,或带上就允许它为空——这一步保存的是参考图,描述由用户之后填写时再校验。报错文案也应与界面用词一致(「角色描述」而非「prompt」)。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions