From f0fbb10fd66bc2c89feb76180074e1322c12495c 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: Tue, 16 Sep 2025 19:19:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/DTO/movie_start_dto.ts | 13 +++++ .../Interaction/templateStoryService.ts | 49 ++++++++++--------- app/service/domain/Entities.ts | 6 ++- components/ChatInputBox/H5TemplateDrawer.tsx | 12 ++--- components/ChatInputBox/PcTemplateModal.tsx | 30 +++--------- 5 files changed, 57 insertions(+), 53 deletions(-) diff --git a/api/DTO/movie_start_dto.ts b/api/DTO/movie_start_dto.ts index a72e4ff..a5e0e7f 100644 --- a/api/DTO/movie_start_dto.ts +++ b/api/DTO/movie_start_dto.ts @@ -210,6 +210,19 @@ export interface CreateMovieProjectV3Request { language: string; /**模板id */ template_id: string; + /** 单次查询模式 */ + one_query_mode: boolean; + /** 自由输入 */ + freeInput?: { + /** 用户提示,提示给用户需要输入什么内容 */ + user_tips: string; + /** 约束,可选,用于传给ai,让ai去拦截用户不符合约束的输入内容 */ + constraints: string; + /** 自由输入文字 */ + free_input_text: string; + /** 输入名称 */ + input_name: string; + }[]; /** 故事角色 */ storyRole: { /** 角色名 */ diff --git a/app/service/Interaction/templateStoryService.ts b/app/service/Interaction/templateStoryService.ts index 8fa1dc4..c42764d 100644 --- a/app/service/Interaction/templateStoryService.ts +++ b/app/service/Interaction/templateStoryService.ts @@ -68,27 +68,27 @@ export const useTemplateStoryServiceHook = (): UseTemplateStoryService => { setIsLoading(true); const templates = await templateStoryUseCase.getTemplateStoryList(); - templates.forEach(template => { - if (template.id === 'f944abad-f42b-4899-b54a-a6beb9d27805') { - template.freeInputItem = { - user_tips: "How is coffee made?", - constraints: "", - free_input_text: "" - }; - // template.storyRole = []; - } - if (template.id === 'e7438cd8-a23d-4974-8cde-13b5671b410c') { - // template.freeInputItem = { - // user_tips: "Input an English word you wanna learn", - // constraints: "", - // free_input_text: "" - // }; - template.storyItem = [{ - ...template.storyItem[0], - item_name: "Choose an English word you wanna learn" - }]; - } - }); + // templates.forEach(template => { + // if (template.id === 'f944abad-f42b-4899-b54a-a6beb9d27805') { + // template.freeInputItem = { + // user_tips: "How is coffee made?", + // constraints: "", + // free_input_text: "" + // }; + // // template.storyRole = []; + // } + // if (template.id === 'e7438cd8-a23d-4974-8cde-13b5671b410c') { + // // template.freeInputItem = { + // // user_tips: "Input an English word you wanna learn", + // // constraints: "", + // // free_input_text: "" + // // }; + // template.storyItem = [{ + // ...template.storyItem[0], + // item_name: "Choose an English word you wanna learn" + // }]; + // } + // }); setTemplateStoryList(templates); setSelectedTemplate(templates[0]); @@ -256,17 +256,22 @@ export const useTemplateStoryServiceHook = (): UseTemplateStoryService => { try { // 设置 loading 状态 setIsLoading(true); + // 没有角色以及道具 时,需要设置为true + const one_query_mode = selectedTemplate?.storyRole?.length === 0 && selectedTemplate?.storyItem?.length === 0; + const script = selectedTemplate?.freeInputItem && selectedTemplate.freeInputItem.length > 0 ? selectedTemplate.freeInputItem[0].free_input_text : selectedTemplate?.generateText || ""; const params: CreateMovieProjectV3Request = { - script: selectedTemplate?.freeInputItem?.free_input_text || selectedTemplate?.generateText || "", + script: script, category: selectedTemplate?.category || "", user_id, mode, resolution, storyRole: selectedTemplate?.storyRole || [], storyItem: selectedTemplate?.storyItem || [], + freeInput: selectedTemplate?.freeInputItem || [], language, template_id: selectedTemplate?.template_id || "", + one_query_mode: one_query_mode }; console.log("params", params); const result = await MovieProjectService.createProject( diff --git a/app/service/domain/Entities.ts b/app/service/domain/Entities.ts index 0f26ff8..bd39596 100644 --- a/app/service/domain/Entities.ts +++ b/app/service/domain/Entities.ts @@ -173,12 +173,14 @@ export interface StoryTemplateEntity { photo_url: string; }[]; /** 自由输入文字 */ - freeInputItem?: { + freeInputItem: { /** 用户提示,提示给用户需要输入什么内容 */ user_tips: string; /** 约束,可选,用于传给ai,让ai去拦截用户不符合约束的输入内容 */ constraints: string; /** 自由输入文字 */ free_input_text: string; - } + /** 输入名称 */ + input_name: string; + }[]; } diff --git a/components/ChatInputBox/H5TemplateDrawer.tsx b/components/ChatInputBox/H5TemplateDrawer.tsx index 693fc3c..a0ca6c4 100644 --- a/components/ChatInputBox/H5TemplateDrawer.tsx +++ b/components/ChatInputBox/H5TemplateDrawer.tsx @@ -491,20 +491,20 @@ export const H5TemplateDrawer = ({