From 4b37d20df98a1742c86b5d91d5d8c6ee075ec48f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E9=BE=99?= Date: Thu, 7 Aug 2025 19:39:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/video_flow.ts | 18 ---- app/service/Interaction/ShotService.ts | 115 ------------------------- app/service/usecase/ShotEditUsecase.ts | 38 +------- 3 files changed, 1 insertion(+), 170 deletions(-) diff --git a/api/video_flow.ts b/api/video_flow.ts index 9e2a896..e5c2a78 100644 --- a/api/video_flow.ts +++ b/api/video_flow.ts @@ -517,24 +517,6 @@ export const regenerateShot = async (request: { return post>("/movie/regenerate_shot", request); }; -/** - * 修改分镜对话内容 - * @param request - 修改分镜对话内容请求参数 - * @returns Promise> - */ -export const updateShotContent = async (request: { - /** 分镜ID */ - shotId: string; - /** 新的对话内容,ContentItem数量和ID顺序不能变,只能修改content字段 */ - content: Array<{ - /** 角色ID */ - roleId: string; - /** 对话内容 */ - content: string; - }>; -}): Promise> => { - return post>("/movie/update_shot_content", request); -}; /** * 获取分镜列表 diff --git a/app/service/Interaction/ShotService.ts b/app/service/Interaction/ShotService.ts index f824a69..0d88cbb 100644 --- a/app/service/Interaction/ShotService.ts +++ b/app/service/Interaction/ShotService.ts @@ -34,11 +34,6 @@ export interface UseShotService { userRequirement: string, lensData: LensType[] ) => Promise; - /** 更新视频内容 */ - updateVideoContent: ( - shotId: string, - content: Array<{ roleId: string; content: string }> - ) => Promise; /** 中断当前操作 */ abortOperation: () => void; /** 设置选中的视频片段 */ @@ -176,47 +171,6 @@ export const useShotService = (): UseShotService => { }, [shotEditUseCase] ); - - /** - * 更新视频内容 - * @param shotId 视频片段ID - * @param content 新的对话内容 - * @returns Promise 更新后的视频片段 - */ - const updateVideoContent = useCallback( - async ( - shotId: string, - content: Array<{ roleId: string; content: string }> - ): Promise => { - try { - setLoading(true); - setError(null); - - const updatedSegment = await shotEditUseCase.updateVideoContent( - shotId, - content - ); - - // 更新列表中的对应项 - setVideoSegments(prev => - prev.map(segment => - segment.id === shotId ? updatedSegment : segment - ) - ); - - return updatedSegment; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : "更新视频内容失败"; - setError(errorMessage); - console.error("更新视频内容失败:", error); - throw error; - } finally { - setLoading(false); - } - }, - [shotEditUseCase] - ); - /** * 中断当前操作 */ @@ -249,77 +203,8 @@ export const useShotService = (): UseShotService => { getVideoSegmentList, regenerateVideoSegment, optimizeVideoContent, - updateVideoContent, abortOperation, setSelectedSegment: setSelectedSegmentHandler, clearError, }; }; - -/** - * 使用示例: - * - * ```tsx - * import { useShotService } from '@/app/service/Interaction/ShotService'; - * - * const VideoSegmentComponent = () => { - * const { - * loading, - * videoSegments, - * selectedSegment, - * error, - * getVideoSegmentList, - * regenerateVideoSegment, - * optimizeVideoContent, - * updateVideoContent, - * setSelectedSegment, - * clearError - * } = useShotService(); - * - * // 获取视频片段列表 - * useEffect(() => { - * getVideoSegmentList('project-id'); - * }, [getVideoSegmentList]); - * - * // 重新生成视频片段 - * const handleRegenerate = async () => { - * try { - * await regenerateVideoSegment([ - * new LensType('特写', '镜头描述', '运镜') - * ]); - * } catch (error) { - * console.error('重新生成失败:', error); - * } - * }; - * - * // AI优化镜头数据 - * const handleOptimize = async () => { - * try { - * const optimizedLensData = await optimizeVideoContent( - * 'shot-id', - * '让镜头更加动态', - * [new LensType('特写', '当前镜头描述', '运镜')] - * ); - * - * // 处理优化后的镜头数据 - * console.log('优化后的镜头数据:', optimizedLensData); - * } catch (error) { - * console.error('优化失败:', error); - * } - * }; - * - * return ( - *
- * {loading &&
加载中...
} - * {error &&
错误: {error}
} - * {videoSegments.map(segment => ( - *
- *

{segment.name}

- *

状态: {segment.status}

- *
- * ))} - *
- * ); - * }; - * ``` - */ diff --git a/app/service/usecase/ShotEditUsecase.ts b/app/service/usecase/ShotEditUsecase.ts index 8d779c7..64603d9 100644 --- a/app/service/usecase/ShotEditUsecase.ts +++ b/app/service/usecase/ShotEditUsecase.ts @@ -1,9 +1,8 @@ import { VideoSegmentEntity } from "../domain/Entities"; -import { ContentItem, LensType } from "../domain/valueObject"; +import { LensType } from "../domain/valueObject"; import { getShotList, regenerateShot, - updateShotContent, optimizeShotContent, } from "@/api/video_flow"; @@ -118,41 +117,6 @@ export class VideoSegmentEditUseCase { this.loading = false; } } - - /** - * @description 更新视频片段的对话内容 - * @param shotId 视频片段ID - * @param content 新的对话内容 - * @returns Promise 更新后的视频片段 - */ - async updateVideoContent( - shotId: string, - content: Array<{ - roleId: string; - content: string; - }> - ): Promise { - try { - this.loading = true; - - const response = await updateShotContent({ - shotId, - content, - }); - - if (!response.successful) { - throw new Error(response.message || "更新视频内容失败"); - } - - return response.data; - } catch (error) { - console.error("更新视频内容失败:", error); - throw error; - } finally { - this.loading = false; - } - } - /** * @description 中断当前操作 */