修复同步类型

This commit is contained in:
海龙 2025-08-14 23:01:03 +08:00
parent 52339e2076
commit cafaf5102a
5 changed files with 43 additions and 29 deletions

View File

@ -985,7 +985,7 @@ export const batchUpdateVideoSegments = async (request: {
/** 新的视频地址列表 */ /** 新的视频地址列表 */
video_urls: string[]; video_urls: string[];
/** 新的状态 0:视频加载中 1:任务已完成 2:任务失败 */ /** 新的状态 0:视频加载中 1:任务已完成 2:任务失败 */
status: 0 | 1 | 2; status: number;
/** 优化后的描述文本 */ /** 优化后的描述文本 */
optimized_description?: string; optimized_description?: string;
/** 关键词列表 */ /** 关键词列表 */
@ -1026,7 +1026,11 @@ export const getCharacterShots = async (request: {
/** 视频ID */ /** 视频ID */
video_id: string; video_id: string;
/** 视频URL列表 */ /** 视频URL列表 */
video_urls: string[]; video_urls: {
video_url: string;
video_id: string;
video_status: number|null;
}[];
}>; }>;
/** 总数量 */ /** 总数量 */

View File

@ -223,7 +223,7 @@ export const useRoleShotServiceHook = (projectId: string,selectRole?:RoleEntity,
setIsReplacing(false); setIsReplacing(false);
throw error; throw error;
} }
}, [selectedRole, shotSelectionList, projectId, isReplacing]); }, [selectedRole, isReplacing, draftRoleList, shotSelectionList, projectId]);
/** /**
* *

View File

@ -63,6 +63,10 @@ export class VideoSegmentEntityAdapter {
videos: Array<{ videos: Array<{
/** 视频地址 */ /** 视频地址 */
video_url: string; video_url: string;
/** 视频ID */
video_id: string;
/**视频片段状态 0:视频加载中 1:任务已完成 2:任务失败 */
video_status: number|null;
}>; }>;
}> = []; }> = [];
@ -131,23 +135,21 @@ export class VideoSegmentEntityAdapter {
} }
// 提取视频URL列表 // 提取视频URL列表
const videoUrls: string[] = []; // const videoUrls: {
if (result.videos && result.videos.length > 0) { // video_url: string;
videoUrls.push(...result.videos.map(video => video.video_url)); // video_id: string;
} // video_status: number|null;
// }[] = result.videos;
// if (result.videos && result.videos.length > 0) {
// videoUrls.push(...result.videos.map(video => ({
// video_url: video.video_url,
// video_id: video.video_id,
// video_status: video.video_status||1
// })));
// }
// 根据task_status和videoUrls内容确定状态 // 根据task_status和videoUrls内容确定状态
let status: 0 | 1 | 2 = 1; // 默认为已完成状态 let status = result.videos[0]?.video_status||1
if (data.task_status === "INIT" || data.task_status === "IN_PROGRESS") {
// 进行中videoUrls[0]有内容为已完成,否则为处理中
status = videoUrls[0] ? 1 : 0;
} else if (data.task_status === "COMPLETED") {
// 已完成videoUrls[0]有内容为已完成,否则为失败
status = videoUrls[0] ? 1 : 2;
} else if (data.task_status === "FAILED") {
// 失败:全部为失败
status = 2;
}
// 创建VideoSegmentEntity // 创建VideoSegmentEntity
const entity: VideoSegmentEntity = { const entity: VideoSegmentEntity = {
@ -156,7 +158,7 @@ export class VideoSegmentEntityAdapter {
loadingProgress: status === 1 ? 100 : status === 0 ? 50 : 0, // 已完成100%进行中50%失败0% loadingProgress: status === 1 ? 100 : status === 0 ? 50 : 0, // 已完成100%进行中50%失败0%
name: `视频片段_${index}`, // 生成临时名称,包含索引 name: `视频片段_${index}`, // 生成临时名称,包含索引
sketchUrl: "", // 后端数据中没有sketchUrl设为空字符串 sketchUrl: "", // 后端数据中没有sketchUrl设为空字符串
videoUrl: videoUrls, videoUrl: result.videos,
status: status, status: status,
lens: lens lens: lens
}; };
@ -186,7 +188,7 @@ export class VideoSegmentEntityAdapter {
shot_8: string; shot_8: string;
shot_9: string; shot_9: string;
shot_10: string; shot_10: string;
videos: Array<{ video_url: string }>; videos: Array<{ video_url: string; video_id: string; video_status: number|null }>;
}> = []; }> = [];
// 遍历每个实体转换为task_result项 // 遍历每个实体转换为task_result项
@ -225,9 +227,13 @@ export class VideoSegmentEntityAdapter {
} }
// 构建videos数组 // 构建videos数组
const videos = entity.videoUrl.map(url => ({ const videos = entity.videoUrl.map(url => {
video_url: url return {
})); video_url: url.video_url,
video_id: url.video_id,
video_status: url.video_status
}
});
taskResults.push({ taskResults.push({
narrative_goal: narrative_goal, narrative_goal: narrative_goal,

View File

@ -67,9 +67,13 @@ export interface VideoSegmentEntity extends BaseEntity {
/**视频片段草图Url */ /**视频片段草图Url */
sketchUrl: string; sketchUrl: string;
/**视频片段视频Url */ /**视频片段视频Url */
videoUrl: string[]; videoUrl: {
video_url: string;
video_id: string;
video_status: number|null;
}[];
/**视频片段状态 0:视频加载中 1:任务已完成 2:任务失败 */ /**视频片段状态 0:视频加载中 1:任务已完成 2:任务失败 */
status: 0 | 1 | 2; status: number;
/**镜头项 */ /**镜头项 */
lens: LensType[]; lens: LensType[];
} }

View File

@ -94,8 +94,8 @@ export class VideoSegmentEditUseCase {
segments.forEach(segment => { segments.forEach(segment => {
if (segment.videoUrl && Array.isArray(segment.videoUrl)) { if (segment.videoUrl && Array.isArray(segment.videoUrl)) {
// 查找匹配的视频项 // 查找匹配的视频项
const matchedVideo = segment.videoUrl.find(url => urlToVideoMap.has(url)); const matchedVideo = segment.videoUrl.find(url => urlToVideoMap.has(url.video_url));
const videoItem = matchedVideo ? urlToVideoMap.get(matchedVideo) : null; const videoItem = matchedVideo ? urlToVideoMap.get(matchedVideo.video_url) : null;
if (videoItem) { if (videoItem) {
// 创建新的实体实例设置正确的id // 创建新的实体实例设置正确的id
@ -275,7 +275,7 @@ export class VideoSegmentEditUseCase {
// 准备更新数据 // 准备更新数据
const updateData = otherSegments.map(segment => ({ const updateData = otherSegments.map(segment => ({
shot_id: segment.id, shot_id: segment.id,
video_urls: segment.videoUrl || [], video_urls: segment.videoUrl.map(url=>url.video_url) || [],
status: segment.status, status: segment.status,
optimized_description: optimizedDescription, optimized_description: optimizedDescription,
keywords: keywords keywords: keywords