From 4ae7bec067cb6af598ded0a023582a9a2a23d97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 17 Sep 2025 11:14:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89one=5Fquery=5Fmode=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E4=BB=A5=E5=8F=8A=E7=94=A8=E6=88=B7=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=BE=93=E5=85=A5=20=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/DTO/movie_start_dto.ts | 2 -- app/service/Interaction/templateStoryService.ts | 10 +++++----- components/ChatInputBox/H5TemplateDrawer.tsx | 3 ++- components/ChatInputBox/PcTemplateModal.tsx | 6 ++---- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/api/DTO/movie_start_dto.ts b/api/DTO/movie_start_dto.ts index a5e0e7f..1d18456 100644 --- a/api/DTO/movie_start_dto.ts +++ b/api/DTO/movie_start_dto.ts @@ -210,8 +210,6 @@ export interface CreateMovieProjectV3Request { language: string; /**模板id */ template_id: string; - /** 单次查询模式 */ - one_query_mode: boolean; /** 自由输入 */ freeInput?: { /** 用户提示,提示给用户需要输入什么内容 */ diff --git a/app/service/Interaction/templateStoryService.ts b/app/service/Interaction/templateStoryService.ts index ffdc61a..9b67286 100644 --- a/app/service/Interaction/templateStoryService.ts +++ b/app/service/Interaction/templateStoryService.ts @@ -256,9 +256,10 @@ export const useTemplateStoryServiceHook = (): UseTemplateStoryService => { try { // 设置 loading 状态 setIsLoading(true); - // 没有角色以及道具 时,需要设置为true - const one_query_mode = selectedTemplate?.storyRole?.length === 0 && selectedTemplate?.storyItem?.length === 0; - const script = selectedTemplate?.freeInput && selectedTemplate.freeInput.length > 0 ? selectedTemplate.freeInput[0].free_input_text : selectedTemplate?.generateText || ""; + const script = selectedTemplate?.freeInput && selectedTemplate.freeInput.length > 0 ? selectedTemplate.freeInput[0].free_input_text : ""; + if (!script && !selectedTemplate?.storyRole.length && !selectedTemplate?.storyItem.length) { + throw new Error("please input what you want to generate"); + } const params: CreateMovieProjectV3Request = { script: script, @@ -270,8 +271,7 @@ export const useTemplateStoryServiceHook = (): UseTemplateStoryService => { storyItem: selectedTemplate?.storyItem || [], freeInput: selectedTemplate?.freeInput || [], language, - template_id: selectedTemplate?.template_id || "", - one_query_mode: one_query_mode + template_id: selectedTemplate?.template_id || "" }; console.log("params", params); const result = await MovieProjectService.createProject( diff --git a/components/ChatInputBox/H5TemplateDrawer.tsx b/components/ChatInputBox/H5TemplateDrawer.tsx index b51b3a4..a8a803b 100644 --- a/components/ChatInputBox/H5TemplateDrawer.tsx +++ b/components/ChatInputBox/H5TemplateDrawer.tsx @@ -128,9 +128,10 @@ export const H5TemplateDrawer = ({ setSelectedTemplate(null); } } catch (error) { + console.log("Failed to create story action:", error); + window.msg.error(error instanceof Error ? error.message : "Failed to create story action"); setIsTemplateCreating(false); setLocalLoading(0); - setSelectedTemplate(null); } finally { setLocalLoading(0); if (timer) clearInterval(timer); diff --git a/components/ChatInputBox/PcTemplateModal.tsx b/components/ChatInputBox/PcTemplateModal.tsx index cd171a9..bd7cc23 100644 --- a/components/ChatInputBox/PcTemplateModal.tsx +++ b/components/ChatInputBox/PcTemplateModal.tsx @@ -191,12 +191,10 @@ export const PcTemplateModal = ({ } console.log("Story action created:", projectId); } catch (error) { - console.error("Failed to create story action:", error); + console.log("Failed to create story action:", error); + window.msg.error(error instanceof Error ? error.message : "Failed to create story action"); setIsTemplateCreating(false); setLocalLoading(0); - // 这里可以添加 toast 提示 - // 重置状态 - setSelectedTemplate(null); } finally { setLocalLoading(0); if (timer) {