From c8ef7ab262077aa6cade7b5a7c4a4743a3ff3a82 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Aug 2026 14:22:45 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix(editing):=20=E6=A8=A1=E6=9D=BF=E7=89=87?= =?UTF-8?q?=E6=AE=B5=E6=97=B6=E9=95=BF=E4=BB=8E=E8=8C=83=E5=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=9B=BA=E5=AE=9A=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 改前:duration_min = Math.max(1, c.duration - 2), duration_max = c.duration + 2 改后:duration_min = c.duration, duration_max = c.duration 确保保存模板时每个片段的时长区间收敛为固定值, 避免后端生成流程按 min~max 随机选时长导致片段时长不一致。 --- .../hooks/template-management/useTemplateSave.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts b/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts index d4f03146f..d6c0d162f 100644 --- a/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts +++ b/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts @@ -98,8 +98,8 @@ export function useTemplateSave(options: UseTemplateSaveOptions) { estimated_duration: totalDuration, segments: clips.map((c, i) => ({ segment_order: i, - duration_min: Math.max(1, c.duration - 2), - duration_max: c.duration + 2, + duration_min: c.duration, + duration_max: c.duration, material_type: c.type === "voice" ? "voiceover" : "video", transition: c.transition ? { type: c.transition.type, duration: c.transition.duration } -- 2.54.0 From c6dea033673dcd94156b5d6da7d5c403f77cc8ef Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Aug 2026 14:35:03 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(editing):=20duration=5Fmin=20=E5=8A=A0?= =?UTF-8?q?=20Math.max(1,=20...)=20=E5=85=9C=E5=BA=95=EF=BC=88AI=20Review?= =?UTF-8?q?=20=E5=BB=BA=E8=AE=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit duration_max 保持 c.duration 不变;duration_min 加最小值保护, 防止 c.duration 为 0 时写入非法值。正常 clip duration > 0 时两者相等。 --- .../hooks/template-management/useTemplateSave.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts b/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts index d6c0d162f..021ca4af0 100644 --- a/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts +++ b/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts @@ -98,7 +98,7 @@ export function useTemplateSave(options: UseTemplateSaveOptions) { estimated_duration: totalDuration, segments: clips.map((c, i) => ({ segment_order: i, - duration_min: c.duration, + duration_min: Math.max(1, c.duration), duration_max: c.duration, material_type: c.type === "voice" ? "voiceover" : "video", transition: c.transition -- 2.54.0 From aadb13c97d1c1bca97b934c37108d7707a31d904 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Aug 2026 14:41:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(editing):=20duration=5Fmax=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=20Math.max(1,=20...)=20=E4=BF=9D=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免 c.duration < 1 时 duration_min > duration_max 产生无效区间 --- .../hooks/template-management/useTemplateSave.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts b/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts index 021ca4af0..37c697ff7 100644 --- a/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts +++ b/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts @@ -99,7 +99,7 @@ export function useTemplateSave(options: UseTemplateSaveOptions) { segments: clips.map((c, i) => ({ segment_order: i, duration_min: Math.max(1, c.duration), - duration_max: c.duration, + duration_max: Math.max(1, c.duration), material_type: c.type === "voice" ? "voiceover" : "video", transition: c.transition ? { type: c.transition.type, duration: c.transition.duration } -- 2.54.0 From 4b703531dcdc31b88ac480b054fd9b2eb9e230ca Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Aug 2026 14:51:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix(editing):=20=E6=81=A2=E5=A4=8D=E4=B8=BA?= =?UTF-8?q?=20c.duration=20=E5=9B=BA=E5=AE=9A=E5=80=BC=EF=BC=88=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E9=9C=80=E6=B1=82=EF=BC=9A=E4=B8=8D=E8=A6=81=E6=97=B6?= =?UTF-8?q?=E9=95=BF=E5=AE=B9=E5=B7=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 业务明确要求模板片段时长从范围(±2s)改为固定值。 c.duration 在上游 clip 创建时已保证为正整数,无需额外兜底。 min == max 是设计意图——精确匹配片段时长,不做模糊匹配。 --- .../hooks/template-management/useTemplateSave.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts b/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts index 37c697ff7..d6c0d162f 100644 --- a/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts +++ b/apps/web/src/pages/editing-planner/hooks/template-management/useTemplateSave.ts @@ -98,8 +98,8 @@ export function useTemplateSave(options: UseTemplateSaveOptions) { estimated_duration: totalDuration, segments: clips.map((c, i) => ({ segment_order: i, - duration_min: Math.max(1, c.duration), - duration_max: Math.max(1, c.duration), + duration_min: c.duration, + duration_max: c.duration, material_type: c.type === "voice" ? "voiceover" : "video", transition: c.transition ? { type: c.transition.type, duration: c.transition.duration } -- 2.54.0