From 95fec72ef081dc389bbdda90df0bca9615434be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Thu, 24 Sep 2026 16:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E6=8E=89=E4=BC=9A=E8=AF=9D=E6=8A=95?= =?UTF-8?q?=E5=BD=B1=E9=87=8C=E6=97=A0=E4=BA=BA=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=20generateCode=20=E5=8C=85=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/view/ui-editor/useUiEditorPage.ts 移除 save.generateCode 及其实现:全仓只有 saveAndGenerateCode 与 stateStore.generateCode 有消费者,这个包装失败时静默返回 null,留着容易让后续调用方拿到没有原因的 null --- .../src/view/ui-editor/useUiEditorPage.ts | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts b/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts index 33d4719be..c88d3e111 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts +++ b/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts @@ -1367,31 +1367,6 @@ export function useUiEditorSession( } } - async function generateCode() { - if ( - !resourceId || - isGenerating || - isSaving || - isLoading || - isAiRunning || - loadError || - persistedRevision === null || - editor.isLocked - ) { - return null; - } - setIsGenerating(true); - try { - return await editor.runWithStateLocked(() => - stateStore.generateCode(resourceId), - ); - } catch { - return null; - } finally { - setIsGenerating(false); - } - } - async function saveAndGenerateCode() { if ( !resourceId || @@ -1630,7 +1605,6 @@ export function useUiEditorSession( hasWarnings: () => postCheckIssuesForSave(editor.state).length > 0, warnings: () => postCheckIssuesForSave(editor.state), save, - generateCode, saveAndGenerateCode, }, };