From 4cc87fd69fa41fbb91809df0f4c3917eb36fbcca Mon Sep 17 00:00:00 2001 From: xiamuceer Date: Fri, 14 Nov 2025 19:54:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:1.=E4=BC=98=E5=8C=96=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E7=81=B5=E6=84=9F=E6=A8=A1=E5=BC=8F=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/Inspiration.tsx | 105 ++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 33 deletions(-) diff --git a/frontend/src/pages/Inspiration.tsx b/frontend/src/pages/Inspiration.tsx index 624e1e7..70cb7de 100644 --- a/frontend/src/pages/Inspiration.tsx +++ b/frontend/src/pages/Inspiration.tsx @@ -178,7 +178,7 @@ const Inspiration: React.FC = () => { setCurrentStep('title'); setLastFailedRequest(null); } else { - handleCustomInput(userInput); + await handleCustomInput(userInput); } } catch (error: any) { console.error('发送消息失败:', error); @@ -292,22 +292,30 @@ const Inspiration: React.FC = () => { }; const handleCustomInput = async (input: string) => { - const updatedData = { ...wizardData }; - - if (currentStep === 'title') { - updatedData.title = input; - } else if (currentStep === 'description') { - updatedData.description = input; - } else if (currentStep === 'theme') { - updatedData.theme = input; - } else if (currentStep === 'genre') { - updatedData.genre = [input]; - } else if (currentStep === 'perspective') { - updatedData.narrative_perspective = input; + setLoading(true); + try { + const updatedData = { ...wizardData }; + + if (currentStep === 'title') { + updatedData.title = input; + } else if (currentStep === 'description') { + updatedData.description = input; + } else if (currentStep === 'theme') { + updatedData.theme = input; + } else if (currentStep === 'genre') { + updatedData.genre = [input]; + } else if (currentStep === 'perspective') { + updatedData.narrative_perspective = input; + } + + setWizardData(updatedData); + await generateNextStep(updatedData); + } catch (error: any) { + console.error('处理自定义输入失败:', error); + message.error(error.response?.data?.detail || '处理失败,请重试'); + } finally { + setLoading(false); } - - setWizardData(updatedData); - await generateNextStep(updatedData); }; // 自动化生成项目流程 @@ -703,8 +711,7 @@ const Inspiration: React.FC = () => { { {/* 输入区域 */} - +