修复问题

This commit is contained in:
海龙 2025-08-07 19:39:21 +08:00
parent f7b1c62df3
commit 4b37d20df9
3 changed files with 1 additions and 170 deletions

View File

@ -517,24 +517,6 @@ export const regenerateShot = async (request: {
return post<ApiResponse<any>>("/movie/regenerate_shot", request);
};
/**
*
* @param request -
* @returns Promise<ApiResponse<修改后的分镜>>
*/
export const updateShotContent = async (request: {
/** 分镜ID */
shotId: string;
/** 新的对话内容ContentItem数量和ID顺序不能变只能修改content字段 */
content: Array<{
/** 角色ID */
roleId: string;
/** 对话内容 */
content: string;
}>;
}): Promise<ApiResponse<VideoSegmentEntity>> => {
return post<ApiResponse<any>>("/movie/update_shot_content", request);
};
/**
*

View File

@ -34,11 +34,6 @@ export interface UseShotService {
userRequirement: string,
lensData: LensType[]
) => Promise<LensType[]>;
/** 更新视频内容 */
updateVideoContent: (
shotId: string,
content: Array<{ roleId: string; content: string }>
) => Promise<VideoSegmentEntity>;
/** 中断当前操作 */
abortOperation: () => void;
/** 设置选中的视频片段 */
@ -176,47 +171,6 @@ export const useShotService = (): UseShotService => {
},
[shotEditUseCase]
);
/**
*
* @param shotId ID
* @param content
* @returns Promise<VideoSegmentEntity>
*/
const updateVideoContent = useCallback(
async (
shotId: string,
content: Array<{ roleId: string; content: string }>
): Promise<VideoSegmentEntity> => {
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 (
* <div>
* {loading && <div>...</div>}
* {error && <div>: {error}</div>}
* {videoSegments.map(segment => (
* <div key={segment.id}>
* <h3>{segment.name}</h3>
* <p>: {segment.status}</p>
* </div>
* ))}
* </div>
* );
* };
* ```
*/

View File

@ -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<VideoSegmentEntity>
*/
async updateVideoContent(
shotId: string,
content: Array<{
roleId: string;
content: string;
}>
): Promise<VideoSegmentEntity> {
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
*/