diff --git a/apps/ai-game-creator-shell/src/view/project-development/export/state/useXhsMinitoolExport.ts b/apps/ai-game-creator-shell/src/view/project-development/export/state/useXhsMinitoolExport.ts index 39f9450e0..bc1cf6086 100644 --- a/apps/ai-game-creator-shell/src/view/project-development/export/state/useXhsMinitoolExport.ts +++ b/apps/ai-game-creator-shell/src/view/project-development/export/state/useXhsMinitoolExport.ts @@ -89,6 +89,8 @@ export function useXhsMinitoolExport({ const [fieldError, setFieldError] = useState(null); const [conflict, setConflict] = useState(null); const [failure, setFailure] = useState(null); + // 界面上「有事要说」的那一句:读不到内容、打包结果、指令没发出去、失败修复的原因。 + // 用户刚点的动作本身不回执——「已交给陶泥儿」这类复述是噪音。 const [notice, setNotice] = useState(''); const [loading, setLoading] = useState(false); /** @@ -199,8 +201,8 @@ export function useXhsMinitoolExport({ setFieldError(null); setConflict(null); setFailure(null); - // 只撤掉「读不到」那一句:适配 / 打包的回执也是 `notice`,读到内容不等于用户读过了它, - // 每 2 秒重读一次就把回执擦掉会让回执根本来不及被看见。 + // 只撤掉「读不到」那一句:打包结果、失败修复的原因也是 `notice`,读到内容不等于用户读过了它, + // 每 2 秒重读一次就把它们擦掉会让这些话根本来不及被看见。 setNotice((previous) => previous === CONTENT_UNAVAILABLE_NOTICE ? '' : previous, ); @@ -392,12 +394,8 @@ export function useXhsMinitoolExport({ try { const hasScriptNow = await refresh(); if (hasScriptNow !== true) { + // 弹窗重新武装起来就是给用户的交代,状态行不再复述一遍。 setAdaptPromptDismissed(false); - if (hasScriptNow === false) { - setNotice( - '项目还没配置好导出,先让陶泥儿帮你调通,之后就能直接打包了', - ); - } return; } // 先 flush 自动保存:用户刚敲完就点打包时,注册表里可能还是上一份。 @@ -425,12 +423,12 @@ export function useXhsMinitoolExport({ /** * 把一条指令当用户消息发给项目会话。 * - * `sentNotice` 由调用方按「首次适配 / 失败修复」分别给:两条路径给 agent 的指令不同,给用户的 - * 回执也不该长一个样——失败修复那条必须把这次的失败原因复述出来,否则失败卡片收掉之后用户只剩 - * 一句「已交给 agent」。 + * 成功不回执:这几个动作都是用户刚点的那颗按钮,面板再复述一句「已交给陶泥儿」只是噪音。 + * 留在界面上的只有两种话——发不出去时的实话,和失败修复必须留下的出错原因(失败卡片收掉之后, + * 那是唯一还写着「刚才为什么开这一轮」的地方)。 */ const sendToAgent = useCallback( - async (instruction: string, sentNotice: string): Promise => { + async (instruction: string, sentNotice = ''): Promise => { const handedOver = await submitTurn([ { type: 'input_text', text: instruction }, ]); @@ -460,20 +458,14 @@ export function useXhsMinitoolExport({ if (dirty && !conflict && !fieldError) { await persist(form, baselineRef.current); } - await sendToAgent( - buildXhsMinitoolFormFillInstruction(), - '已让陶泥儿来填这三项,它改完会自动出现在上面', - ); + await sendToAgent(buildXhsMinitoolFormFillInstruction()); }, [projectPath, form, dirty, conflict, fieldError, persist, sendToAgent]); /** 一键适配(bootstrap):把首次适配指令发给同一个项目会话。发出即收起阻断提示,别让弹窗再拦住用户。 */ const adapt = useCallback((): void => { if (!projectPath) return; setAdaptPromptDismissed(true); - void sendToAgent( - buildXhsMinitoolAdaptationInstruction(), - '已让陶泥儿帮你调通导出,右侧会话里能看到它的进展', - ); + void sendToAgent(buildXhsMinitoolAdaptationInstruction()); }, [projectPath, sendToAgent]); /** @@ -496,10 +488,7 @@ export function useXhsMinitoolExport({ // 回执复述用户侧的说法;给 agent 的指令直接带原始错误,两者互不派生。 const reason = describeXhsMinitoolFailure(failure); setFailure(null); - void sendToAgent( - buildXhsMinitoolErrorFixInstruction(failure), - `已让陶泥儿来修。\n出错原因:${reason}`, - ); + void sendToAgent(buildXhsMinitoolErrorFixInstruction(failure), reason); }, [projectPath, failure, sendToAgent]); /** diff --git a/apps/ai-game-creator-shell/tests/xhsMinitoolExport.test.tsx b/apps/ai-game-creator-shell/tests/xhsMinitoolExport.test.tsx index 5caf51eb3..48d772549 100644 --- a/apps/ai-game-creator-shell/tests/xhsMinitoolExport.test.tsx +++ b/apps/ai-game-creator-shell/tests/xhsMinitoolExport.test.tsx @@ -885,10 +885,9 @@ describe('状态 hook', () => { expect(calls).toContain('read_xhs_minitool_export'); expect(calls).not.toContain('run_xhs_minitool_export_build'); // 还没有脚本就把「让陶泥儿帮你调通」重新递出来,而不是报个错把人晾在原地。 + // 这一路只重新武装弹窗,状态行不再复述一遍。 expect(result.current.adaptPromptDismissed).toBe(false); - expect(result.current.notice).toBe( - '项目还没配置好导出,先让陶泥儿帮你调通,之后就能直接打包了', - ); + expect(result.current.notice).toBe(''); expect(result.current.running).toBe(false); });