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 060174f3f..61c1df11d 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 @@ -200,7 +200,6 @@ export function useUiEditorSession( ); const [saveError, setSaveError] = useState(null); const [isSaving, setIsSaving] = useState(false); - const [generateError, setGenerateError] = useState(null); const [isGenerating, setIsGenerating] = useState(false); const normalizedInitialStepIndex = initialStep === 'reference-analysis' @@ -300,7 +299,6 @@ export function useUiEditorSession( setPersistedRevision(0); setSavedStateSignature(JSON.stringify(EMPTY_UI_EDITOR_STATE)); setSaveError(null); - setGenerateError(null); setIsGenerating(false); setHiddenNodeIds(new Set()); return; @@ -311,7 +309,6 @@ export function useUiEditorSession( setLoadError(null); setPersistedRevision(null); setSaveError(null); - setGenerateError(null); setIsGenerating(false); void stateStore .load(resourceId) @@ -1427,7 +1424,6 @@ export function useUiEditorSession( }; } setSaveError(null); - setGenerateError(null); setIsSaving(true); try { return await editor.runWithStateLocked(async (snapshot) => { @@ -1475,17 +1471,14 @@ export function useUiEditorSession( persistedRevision === null || editor.isLocked ) { - setGenerateError('当前状态不允许生成代码,请稍后重试。'); return null; } - setGenerateError(null); setIsGenerating(true); try { return await editor.runWithStateLocked(() => stateStore.generateCode(resourceId), ); - } catch (cause) { - setGenerateError(cause instanceof Error ? cause.message : String(cause)); + } catch { return null; } finally { setIsGenerating(false); @@ -1510,7 +1503,6 @@ export function useUiEditorSession( }; } setSaveError(null); - setGenerateError(null); setIsSaving(true); setIsGenerating(true); try { @@ -1548,7 +1540,6 @@ export function useUiEditorSession( } catch (cause) { const message = cause instanceof Error ? cause.message : String(cause); - setGenerateError(message); return { status: 'failed' as const, phase: 'generate' as const, @@ -1744,7 +1735,6 @@ export function useUiEditorSession( isDirty, saveError, isGenerating, - generateError, hasWarnings: () => postCheckIssuesForSave(editor.state).length > 0, warnings: () => postCheckIssuesForSave(editor.state), save,