From ed79e49abe9b1a78d281641687ba9101ea5234c9 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: Sat, 16 Aug 2025 20:56:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E7=89=87=E6=AE=B5=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90=20?= =?UTF-8?q?=E7=82=B9=E5=87=BB=20Apply=20=E6=B2=A1=E6=9C=89=E4=BC=A0=20vide?= =?UTF-8?q?o=5Fid=20=E7=BB=99=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/adapter/oldErrAdapter.ts | 8 +++ app/service/adapter/textToShot.ts | 10 ++- components/pages/work-flow/media-viewer.tsx | 69 +++++++++---------- .../pages/work-flow/use-workflow-data.tsx | 2 - components/ui/shot-editor/CharacterToken.tsx | 2 +- components/ui/shot-editor/ShotsEditor.tsx | 8 +-- components/ui/shot-tab-content.tsx | 31 +++++---- 7 files changed, 71 insertions(+), 59 deletions(-) diff --git a/app/service/adapter/oldErrAdapter.ts b/app/service/adapter/oldErrAdapter.ts index d4a1791..d576d82 100644 --- a/app/service/adapter/oldErrAdapter.ts +++ b/app/service/adapter/oldErrAdapter.ts @@ -37,6 +37,10 @@ export class VideoSegmentEntityAdapter { task_status: string = ""; /** 任务结果 */ task_result: Array<{ + /** 任务ID */ + video_id: string; + /** 任务状态 */ + video_status: number|null; /** 叙事目标 */ narrative_goal: string; /** 镜头1描述 */ @@ -175,6 +179,8 @@ export class VideoSegmentEntityAdapter { */ static fromVideoSegmentEntity(entities: VideoSegmentEntity[]): VideoSegmentEntityAdapter { const taskResults: Array<{ + video_id: string; + video_status: number|null; narrative_goal: string; shot_1: string; shot_2: string; @@ -235,6 +241,8 @@ export class VideoSegmentEntityAdapter { taskResults.push({ narrative_goal: narrative_goal, + video_id: entity.id, + video_status: entity.status, shot_1: shots.shot_1 || "", shot_2: shots.shot_2 || "", shot_3: shots.shot_3 || "", diff --git a/app/service/adapter/textToShot.ts b/app/service/adapter/textToShot.ts index 3465975..5dd57ca 100644 --- a/app/service/adapter/textToShot.ts +++ b/app/service/adapter/textToShot.ts @@ -60,7 +60,15 @@ export class TextToShotAdapter { let currentText = text; // 按角色名称长度降序排序,避免短名称匹配到长名称的一部分 - const sortedRoles = [...roles].sort((a, b) => b.name.length - a.name.length); + // 既要兼容 首字母大写 其余小写、还要兼容 全部大写 + const sortedRoles = [...roles].sort((a, b) => b.name.length - a.name.length).map(role => ({ + ...role, + name: role.name.charAt(0).toUpperCase() + role.name.slice(1).toLowerCase() + })).concat([...roles].map(role => ({ + ...role, + name: role.name.toUpperCase() + }))); + while (currentText.length > 0) { let matchFound = false; diff --git a/components/pages/work-flow/media-viewer.tsx b/components/pages/work-flow/media-viewer.tsx index f3630d4..93b7278 100644 --- a/components/pages/work-flow/media-viewer.tsx +++ b/components/pages/work-flow/media-viewer.tsx @@ -432,10 +432,9 @@ export const MediaViewer = React.memo(function MediaViewer({
- {/* 只在生成过程中或没有视频时使用ProgressiveReveal */} -
- {/* 背景模糊的图片 */} -
+ {/* 背景模糊的图片 */} + {taskObject.videos.data[currentSketchIndex].video_status !== 1 && ( +
{/* 生成中 */} {taskObject.videos.data[currentSketchIndex].video_status === 0 && (
@@ -455,39 +454,39 @@ export const MediaViewer = React.memo(function MediaViewer({
)}
+ )} + - {/* 视频 多个 取第一个 */} - { taskObject.videos.data[currentSketchIndex].urls && ( - - - )} - -
+ {/* 视频 多个 取第一个 */} + { taskObject.videos.data[currentSketchIndex].urls && ( + + + )} {/* 操作按钮组 */} {/* 底部控制区域 */} - { taskObject.videos.data[currentSketchIndex] && ( + { taskObject.videos.data[currentSketchIndex].video_status === 1 && ( { - const defaultBgColors = ['RGB(45, 50, 70)', 'RGB(75, 80, 100)', 'RGB(105, 110, 130)']; - const bgColors = defaultBgColors; return (
{roles.map((role) => { - const isSelected = role.name === name; + const isSelected = role.name.toLowerCase() === name.toLowerCase(); return (
(function ShotsEdito ))}
- {/* */} + Add +
{/* 分镜内容 */} diff --git a/components/ui/shot-tab-content.tsx b/components/ui/shot-tab-content.tsx index 9a6b88a..bf381ca 100644 --- a/components/ui/shot-tab-content.tsx +++ b/components/ui/shot-tab-content.tsx @@ -18,10 +18,8 @@ interface ShotTabContentProps { roles?: any[]; } -export function ShotTabContent({ - currentSketchIndex = 0, - roles = [] -}: ShotTabContentProps) { +export const ShotTabContent = (props: ShotTabContentProps) => { + const { currentSketchIndex = 0, roles = [] } = props; const { loading, shotData, @@ -48,7 +46,7 @@ export function ShotTabContent({ const [selectedLibaryRole, setSelectedLibaryRole] = useState(null); const [isLoadingShots, setIsLoadingShots] = useState(false); const shotsEditorRef = useRef(null); - const videoRef = useRef(null); + const [isRegenerate, setIsRegenerate] = useState(false); useEffect(() => { console.log('shotTabContent-----roles', roles); @@ -163,15 +161,17 @@ export function ShotTabContent({ }; // 点击按钮重新生成 - const handleRegenerate = () => { + const handleRegenerate = async () => { console.log('regenerate'); + setIsRegenerate(true); const shotInfo = shotsEditorRef.current.getShotInfo(); console.log('shotTabContent-----shotInfo', shotInfo); setSelectedSegment({ ...shotData[selectedIndex], lens: shotInfo }); - regenerateVideoSegment(); + await regenerateVideoSegment(); + setIsRegenerate(false); }; // 新增分镜 @@ -394,8 +394,8 @@ export function ShotTabContent({ /> {/* 重新生成按钮、新增分镜按钮 */} -
- + {/* handleAddShot()} className="flex items-center justify-center gap-2 px-4 py-3 bg-pink-500/10 hover:bg-pink-500/20 text-pink-500 rounded-lg transition-colors" @@ -404,16 +404,17 @@ export function ShotTabContent({ > Add Shot - + */} handleRegenerate()} className="flex items-center justify-center gap-2 px-4 py-3 bg-blue-500/10 hover:bg-blue-500/20 text-blue-500 rounded-lg transition-colors" - whileHover={{ scale: 1.02 }} - whileTap={{ scale: 0.98 }} - > - - Regenerate + whileHover={{ scale: 1.02 }} + whileTap={{ scale: 0.98 }} + disabled={isRegenerate} + > + + {isRegenerate ? 'Regenerating...' : 'Regenerate'}