From 5e2fd1fff9f8186536996bb1339fd103857bf8c0 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: Mon, 18 Aug 2025 21:42:20 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=BC=B9=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ui/shot-editor/CharacterToken.tsx | 15 +++- components/ui/shot-editor/ShotsEditor.tsx | 10 +-- components/ui/shot-tab-content.tsx | 87 +++++++++++--------- 3 files changed, 60 insertions(+), 52 deletions(-) diff --git a/components/ui/shot-editor/CharacterToken.tsx b/components/ui/shot-editor/CharacterToken.tsx index 5cbcd90..a793080 100644 --- a/components/ui/shot-editor/CharacterToken.tsx +++ b/components/ui/shot-editor/CharacterToken.tsx @@ -11,7 +11,7 @@ interface CharacterTokenOptions { export function CharacterToken(props: ReactNodeViewProps) { const [showRoleList, setShowRoleList] = useState(false); - const [listPosition, setListPosition] = useState({ top: 0, left: 0 }); + const [listPosition, setListPosition] = useState({ top: 0, left: 0, bottom: 0 }); const { name } = props.node.attrs as ScriptRoleEntity; const extension = props.extension as Node; const roles = extension.options.roles || []; @@ -31,6 +31,7 @@ export function CharacterToken(props: ReactNodeViewProps) { // 计算理想的顶部位置(在token下方) let top = tokenRect.bottom + 8; // 8px 间距 let left = tokenRect.left; + let bottom = tokenRect.top; // 检查是否超出底部 if (top + listRect.height > viewportHeight) { @@ -44,10 +45,18 @@ export function CharacterToken(props: ReactNodeViewProps) { left = viewportWidth - listRect.width - 8; } + // 检查是否超出顶部 + if (bottom - listRect.height < 0) { + // 如果超出顶部,将列表显示在token下方 + bottom = tokenRect.bottom + 8; + } + // 确保不会超出左侧 left = Math.max(8, left); + // 确保不会超顶部 + top = Math.max(0, top); - setListPosition({ top, left }); + setListPosition({ top, left, bottom }); }; // 监听窗口大小变化 @@ -107,7 +116,7 @@ export function CharacterToken(props: ReactNodeViewProps) { exit={{ opacity: 0, y: 4 }} transition={{ duration: 0.2 }} ref={listRef} - className="fixed w-64 rounded-lg backdrop-blur-md bg-white/10 border border-white/20 p-2 z-[51]" + className="fixed w-64 rounded-lg backdrop-blur-md bg-white/10 border border-white/20 p-2 z-[51] overflow-y-auto" style={{ top: listPosition.top, left: listPosition.left diff --git a/components/ui/shot-editor/ShotsEditor.tsx b/components/ui/shot-editor/ShotsEditor.tsx index 9a562d9..4d80bf2 100644 --- a/components/ui/shot-editor/ShotsEditor.tsx +++ b/components/ui/shot-editor/ShotsEditor.tsx @@ -26,17 +26,11 @@ const createEmptyShot = (): Shot => ({ name: `shot${Date.now()}`, shotDescContent: [{ type: 'paragraph', - content: [{ - type: 'text', - text: 'Add shot description here...' - }] + content: [] }], shotDialogsContent: [{ type: 'paragraph', - content: [{ - type: 'text', - text: 'Add shot dialogue here...' - }] + content: [] }] }); diff --git a/components/ui/shot-tab-content.tsx b/components/ui/shot-tab-content.tsx index 8dcdfa6..9e748bf 100644 --- a/components/ui/shot-tab-content.tsx +++ b/components/ui/shot-tab-content.tsx @@ -342,55 +342,60 @@ export const ShotTabContent = (props: ShotTabContentProps) => {
{/* 选中的视频预览 */} <> - {shotData[selectedIndex]?.status === 0 && ( + {(shotData[selectedIndex]?.status === 0) && (
Loading...
)} - {shotData[selectedIndex]?.status === 1 && ( - - - - {/* 人物替换按钮 */} - handleScan()} - className={`p-2 backdrop-blur-sm transition-colors z-10 rounded-full - ${scanState === 'detected' - ? 'bg-cyan-500/50 hover:bg-cyan-500/70 text-white' - : 'bg-black/50 hover:bg-black/70 text-white' - }`} - whileHover={{ scale: 1.05 }} - whileTap={{ scale: 0.95 }} - > - {scanState === 'scanning' ? ( - - ) : scanState === 'detected' ? ( - - ) : ( - - )} - + + {shotData[selectedIndex]?.status === 1 && shotData[selectedIndex]?.videoUrl.length && ( + + + + {/* 人物替换按钮 */} + handleScan()} + className={`p-2 backdrop-blur-sm transition-colors z-10 rounded-full + ${scanState === 'detected' + ? 'bg-cyan-500/50 hover:bg-cyan-500/70 text-white' + : 'bg-black/50 hover:bg-black/70 text-white' + }`} + whileHover={{ scale: 1.05 }} + whileTap={{ scale: 0.95 }} + > + {scanState === 'scanning' ? ( + + ) : scanState === 'detected' ? ( + + ) : ( + + )} + + - - )} - {shotData[selectedIndex]?.status === 2 && ( + )} + + {(shotData[selectedIndex]?.status === 2 || !shotData[selectedIndex]?.videoUrl.length) && (
- 任务失败,点击重新生成 + Failed, click to regenerate
)} From b7fe03d5ee5224e7ca1ae00d51e7ec2a5303b767 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: Mon, 18 Aug 2025 22:36:12 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=85=BC=E5=AE=B9=20=E6=9C=AA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E9=95=9C=E5=A4=B4=E6=8F=8F=E8=BF=B0=E4=B9=9F?= =?UTF-8?q?=E8=83=BD=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/Interaction/ShotService.ts | 2 ++ components/ui/shot-tab-content.tsx | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/service/Interaction/ShotService.ts b/app/service/Interaction/ShotService.ts index 08010e4..cb2dd10 100644 --- a/app/service/Interaction/ShotService.ts +++ b/app/service/Interaction/ShotService.ts @@ -180,6 +180,8 @@ export const useShotService = (): UseShotService => { try { setLoading(true); + console.log('shotInfo-selectedSegment', selectedSegment); + // 调用API重新生成视频片段,返回任务状态信息 const taskResult = await vidoEditUseCase.regenerateVideoSegment( projectId, diff --git a/components/ui/shot-tab-content.tsx b/components/ui/shot-tab-content.tsx index 9e748bf..50eb4c4 100644 --- a/components/ui/shot-tab-content.tsx +++ b/components/ui/shot-tab-content.tsx @@ -56,10 +56,12 @@ export const ShotTabContent = (props: ShotTabContentProps) => { useEffect(() => { if (pendingRegeneration) { + console.log('pendingRegeneration', pendingRegeneration, shotData[selectedIndex]?.lens); regenerateVideoSegment(); setPendingRegeneration(false); + setIsRegenerate(false); } - }, [shotData[selectedIndex]?.lens]); + }, [pendingRegeneration]); // 监听当前选中index变化 useEffect(() => { @@ -179,7 +181,9 @@ export const ShotTabContent = (props: ShotTabContentProps) => { ...shotData[selectedIndex], lens: shotInfo }); - setPendingRegeneration(true); + setTimeout(() => { + setPendingRegeneration(true); + }, 1000); }; // 新增分镜 From 60217ffe96c57aad72c5ed4bc1d4d25059a82293 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: Mon, 18 Aug 2025 23:25:56 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=90=8E=E5=BC=80=E5=90=AF=E8=BD=AE=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/video_flow.ts | 13 ++++++- app/service/Interaction/ShotService.ts | 2 +- components/ui/edit-modal.tsx | 53 +++++++++++++++++++++++++- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/api/video_flow.ts b/api/video_flow.ts index f24c9ac..89c7ec2 100644 --- a/api/video_flow.ts +++ b/api/video_flow.ts @@ -871,7 +871,18 @@ export const updateShotPrompt = async (request: { /** 镜头描述 */ shot_descriptions: task_item; }): Promise> => { - return post("/movie/update_shot_prompt", request); + // 过滤掉第一层的空字符串字段 + const filteredDesc = Object.entries(request.shot_descriptions).reduce>((acc, [key, value]) => { + if (value !== '') { + acc[key] = value; + } + return acc; + }, {}); + + return post("/movie/update_shot_prompt", { + ...request, + shot_descriptions: filteredDesc + }); }; /** diff --git a/app/service/Interaction/ShotService.ts b/app/service/Interaction/ShotService.ts index cb2dd10..1aeb607 100644 --- a/app/service/Interaction/ShotService.ts +++ b/app/service/Interaction/ShotService.ts @@ -211,7 +211,7 @@ export const useShotService = (): UseShotService => { ) ); } - + setIntervalIdHandler(projectId); // 返回当前选中的片段,因为现在API返回的是任务状态而不是完整的片段 return selectedSegment!; } catch (error) { diff --git a/components/ui/edit-modal.tsx b/components/ui/edit-modal.tsx index b8c6c4f..da429cf 100644 --- a/components/ui/edit-modal.tsx +++ b/components/ui/edit-modal.tsx @@ -58,6 +58,7 @@ export function EditModal({ // 添加一个状态来标记是否是从切换tab触发的提醒 const [pendingSwitchTabId, setPendingSwitchTabId] = useState(null); const [disabledBtn, setDisabledBtn] = useState(false); + const [isRemindCloseOpen, setIsRemindCloseOpen] = useState(false); useEffect(() => { setCurrentIndex(currentSketchIndex); @@ -166,6 +167,23 @@ export function EditModal({ setResetKey(resetKey + 1); } + const handleClickClose = () => { + // TODO 关闭前 检查 当前tab 下是否有更新 如果有更新 则提醒用户 是否确认应用 + // 暂时 默认弹出提醒 + setIsRemindCloseOpen(true); + } + + const handleConfirmApply = () => { + console.log('handleConfirmApply'); + setIsRemindCloseOpen(false); + handleConfirmGotoFallback(); + } + + const handleCloseRemindClosePanel = () => { + setIsRemindCloseOpen(false); + onClose(); + } + const renderTabContent = () => { switch (activeTab) { case '0': @@ -235,7 +253,6 @@ export function EditModal({ initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} - onClick={onClose} /> {/* 弹窗内容 */} @@ -290,7 +307,7 @@ export function EditModal({ {/* 关闭按钮 */} @@ -407,6 +424,38 @@ export function EditModal({
+ + {/* 提醒用户 关闭当前弹窗 是否确认应用 */} + +
+
+ +

If you have modified the content, closing it will lose the modified content. Do you want to apply the modifications?

+
+
+ + +
+
+
)} From b560f907b7b2221d7c073a1241d7380a175a1c07 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: Mon, 18 Aug 2025 23:39:49 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E9=95=9C=E5=A4=B4?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=20=E8=A7=92=E8=89=B2=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/adapter/textToShot.ts | 2 +- components/ui/character-editor.tsx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/service/adapter/textToShot.ts b/app/service/adapter/textToShot.ts index cc466a3..6315f72 100644 --- a/app/service/adapter/textToShot.ts +++ b/app/service/adapter/textToShot.ts @@ -256,7 +256,7 @@ export class TextToShotAdapter { currentScript += node.text; } if (node.type === 'characterToken') { - currentScript = currentScript + node.attrs.name + ' ' + node.attrs.id; + currentScript = currentScript + node.attrs.name + ' [' + node.attrs.id + ']'; } }); } diff --git a/components/ui/character-editor.tsx b/components/ui/character-editor.tsx index 58689af..01b8fa9 100644 --- a/components/ui/character-editor.tsx +++ b/components/ui/character-editor.tsx @@ -82,3 +82,5 @@ export const CharacterEditor = forwardRef(({ ); }); + +CharacterEditor.displayName = 'CharacterEditor'; From ed4dff0c93e3ac1e662c9157781a5c1554b7ba71 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, 19 Aug 2025 00:08:01 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=8E=BB=E6=8E=89=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E7=94=9F=E6=88=90=20=E5=88=86=E9=95=9C=E8=A7=86=E9=A2=91=20?= =?UTF-8?q?=E8=B0=83=E7=94=A8update=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/usecase/ShotEditUsecase.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/service/usecase/ShotEditUsecase.ts b/app/service/usecase/ShotEditUsecase.ts index 1ed7458..2753140 100644 --- a/app/service/usecase/ShotEditUsecase.ts +++ b/app/service/usecase/ShotEditUsecase.ts @@ -188,9 +188,9 @@ export class VideoSegmentEditUseCase { this.loading = true; const shot_descriptions = VideoSegmentEntityAdapter.lensTypeToTaskItem(shot_Lens); // 如果有shot_id,先保存分镜数据 - if (shot_id) { - await this.saveShotPrompt(project_id, shot_id, shot_descriptions); - } + // if (shot_id) { + // await this.saveShotPrompt(project_id, shot_id, shot_descriptions); + // } const response = await regenerateShot({ project_id, From 692a6fdd8de9f7768a036bfab5871c8109400c3b 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, 19 Aug 2025 00:40:41 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9A=82=E5=81=9C?= =?UTF-8?q?=E7=BB=A7=E7=BB=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/pages/work-flow/use-workflow-data.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/pages/work-flow/use-workflow-data.tsx b/components/pages/work-flow/use-workflow-data.tsx index eca57f9..a6939fa 100644 --- a/components/pages/work-flow/use-workflow-data.tsx +++ b/components/pages/work-flow/use-workflow-data.tsx @@ -119,7 +119,7 @@ export function useWorkflowData() { }, [scriptBlocksMemo]); // 监听继续 请求更新数据 useUpdateEffect(() => { - if (taskObject.status !== 'IN_PROGRESS') { + if (taskObject.status === 'COMPLETED' || taskObject.status === 'FAILED') { return; } if (isPauseWorkFlow) {