forked from 77media/video-flow
修复bug
This commit is contained in:
parent
f147b72db6
commit
5c6b452e59
@ -484,13 +484,7 @@ export interface CharacterUpdateAndRegenerateResponse {
|
|||||||
/** 角色描述(已更新) */
|
/** 角色描述(已更新) */
|
||||||
character_description: string;
|
character_description: string;
|
||||||
/** 重新生成产物的图片地址 */
|
/** 重新生成产物的图片地址 */
|
||||||
image_path?: string;
|
image_url?: string;
|
||||||
/** 角色类型/作用 */
|
|
||||||
role?: string;
|
|
||||||
/** 性别 */
|
|
||||||
gender?: string;
|
|
||||||
/** 角色简要说明/摘要 */
|
|
||||||
brief?: string;
|
|
||||||
/** 从角色描述提取的高亮关键词/短语 */
|
/** 从角色描述提取的高亮关键词/短语 */
|
||||||
highlights: string[];
|
highlights: string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -304,7 +304,7 @@ export const applyRoleToShots = async (request: {
|
|||||||
message?: string;
|
message?: string;
|
||||||
}>;
|
}>;
|
||||||
}>> => {
|
}>> => {
|
||||||
return post("/movie/apply_role_to_shots", request);
|
return post("/movie/regenerate_shot_video", request);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -164,7 +164,7 @@ export const useRoleServiceHook = (): UseRoleService => {
|
|||||||
console.error('优化角色文本失败:', error);
|
console.error('优化角色文本失败:', error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}, [roleEditUseCase, currentRoleText, selectedRole]);
|
}, [roleEditUseCase, currentRoleText, selectedRole, selectRole]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改AI文本
|
* 修改AI文本
|
||||||
@ -408,7 +408,7 @@ export const useRoleServiceHook = (): UseRoleService => {
|
|||||||
const result = await roleEditUseCase.saveRegeneratedCharacterToLibrary(
|
const result = await roleEditUseCase.saveRegeneratedCharacterToLibrary(
|
||||||
selectedRole,
|
selectedRole,
|
||||||
projectId,
|
projectId,
|
||||||
User.id
|
String(User.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log('角色保存到角色库成功:', result);
|
console.log('角色保存到角色库成功:', result);
|
||||||
|
|||||||
@ -149,12 +149,6 @@ export const useRoleShotServiceHook = (projectId: string,selectRole?:RoleEntity)
|
|||||||
*/
|
*/
|
||||||
const applyRoleToSelectedShots = useCallback(async (newRole: RoleEntity) => {
|
const applyRoleToSelectedShots = useCallback(async (newRole: RoleEntity) => {
|
||||||
try {
|
try {
|
||||||
// 检查是否有选中的分镜
|
|
||||||
const selectedShots = shotSelectionList.filter(shot => shot.selected);
|
|
||||||
if (selectedShots.length === 0) {
|
|
||||||
throw new Error('请先选择要应用角色的分镜');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否有选中的角色
|
// 检查是否有选中的角色
|
||||||
if (!selectedRole||!selectedRole.generateText ) {
|
if (!selectedRole||!selectedRole.generateText ) {
|
||||||
throw new Error('请先选择要应用的角色');
|
throw new Error('请先选择要应用的角色');
|
||||||
@ -179,7 +173,7 @@ export const useRoleShotServiceHook = (projectId: string,selectRole?:RoleEntity)
|
|||||||
];
|
];
|
||||||
|
|
||||||
// 循环调用接口,为每个选中的分镜单独调用
|
// 循环调用接口,为每个选中的分镜单独调用
|
||||||
selectedShots.forEach(async (shot) => {
|
shotSelectionList.forEach(async (shot) => {
|
||||||
try {
|
try {
|
||||||
// 调用应用角色到分镜接口(不等待完成)
|
// 调用应用角色到分镜接口(不等待完成)
|
||||||
applyRoleToShots({
|
applyRoleToShots({
|
||||||
@ -201,7 +195,7 @@ export const useRoleShotServiceHook = (projectId: string,selectRole?:RoleEntity)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`开始为 ${selectedShots.length} 个分镜替换角色`);
|
console.log(`开始为 ${shotSelectionList.length} 个分镜替换角色`);
|
||||||
|
|
||||||
// 延迟重置替换状态,给用户一些反馈时间
|
// 延迟重置替换状态,给用户一些反馈时间
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@ -76,7 +76,7 @@ export const useShotService = (): UseShotService => {
|
|||||||
const segments = await vidoEditUseCase.getVideoSegmentList(projectId);
|
const segments = await vidoEditUseCase.getVideoSegmentList(projectId);
|
||||||
setProjectId(projectId);
|
setProjectId(projectId);
|
||||||
setVideoSegments(segments);
|
setVideoSegments(segments);
|
||||||
setIntervalIdHandler();
|
setIntervalIdHandler(projectId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("获取视频片段列表失败:", error);
|
console.error("获取视频片段列表失败:", error);
|
||||||
} finally {
|
} finally {
|
||||||
@ -86,7 +86,8 @@ export const useShotService = (): UseShotService => {
|
|||||||
[vidoEditUseCase]
|
[vidoEditUseCase]
|
||||||
);
|
);
|
||||||
|
|
||||||
const setIntervalIdHandler = async (): Promise<void> => {
|
const setIntervalIdHandler = async (projectId: string): Promise<void> => {
|
||||||
|
|
||||||
// 每次执行前先清除之前的定时器,确保只存在一个定时器
|
// 每次执行前先清除之前的定时器,确保只存在一个定时器
|
||||||
if (intervalId) {
|
if (intervalId) {
|
||||||
clearInterval(intervalId);
|
clearInterval(intervalId);
|
||||||
@ -95,9 +96,6 @@ export const useShotService = (): UseShotService => {
|
|||||||
// 定义定时任务,每5秒执行一次
|
// 定义定时任务,每5秒执行一次
|
||||||
const newIntervalId = setInterval(async () => {
|
const newIntervalId = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
if (!projectId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const segments = await vidoEditUseCase.getVideoSegmentList(projectId);
|
const segments = await vidoEditUseCase.getVideoSegmentList(projectId);
|
||||||
|
|
||||||
setVideoSegments(prevSegments => {
|
setVideoSegments(prevSegments => {
|
||||||
|
|||||||
@ -240,12 +240,11 @@ export class RoleEditUseCase {
|
|||||||
loadingProgress: 100,
|
loadingProgress: 100,
|
||||||
disableEdit: false
|
disableEdit: false
|
||||||
})), // 将高亮关键词转换为TagValueObject格式
|
})), // 将高亮关键词转换为TagValueObject格式
|
||||||
imageUrl: characterData.image_path || '',
|
imageUrl: characterData.image_url || '',
|
||||||
loadingProgress: 100,
|
loadingProgress: 100,
|
||||||
disableEdit: false,
|
disableEdit: false,
|
||||||
updatedAt: Date.now()
|
updatedAt: Date.now()
|
||||||
};
|
};
|
||||||
|
|
||||||
return roleEntity;
|
return roleEntity;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('AI生成角色失败:', error);
|
console.error('AI生成角色失败:', error);
|
||||||
|
|||||||
@ -148,6 +148,7 @@ export function MediaViewer({
|
|||||||
|
|
||||||
// 包装编辑按钮点击事件
|
// 包装编辑按钮点击事件
|
||||||
const handleEditClick = (tab: string) => {
|
const handleEditClick = (tab: string) => {
|
||||||
|
// TODO 点击没有任何事件效果,页面没变化
|
||||||
setUserHasInteracted(true);
|
setUserHasInteracted(true);
|
||||||
onEditModalOpen(tab);
|
onEditModalOpen(tab);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -45,8 +45,9 @@ export const useEditData = (tabType: string) => {
|
|||||||
optimizeRoleText,
|
optimizeRoleText,
|
||||||
updateRoleText,
|
updateRoleText,
|
||||||
regenerateRole,
|
regenerateRole,
|
||||||
uploadImageToQiniu,
|
uploadImageAndUpdateRole,
|
||||||
saveRoleToLibrary
|
saveRoleToLibrary,
|
||||||
|
|
||||||
} = useRoleServiceHook();
|
} = useRoleServiceHook();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -58,9 +59,18 @@ export const useEditData = (tabType: string) => {
|
|||||||
toggleSelectAllShots,
|
toggleSelectAllShots,
|
||||||
toggleShotSelection,
|
toggleShotSelection,
|
||||||
applyRoleToSelectedShots,
|
applyRoleToSelectedShots,
|
||||||
clearShotSelection
|
clearShotSelection,
|
||||||
|
setSelectedRole
|
||||||
} = useRoleShotServiceHook(projectId, selectedRole || undefined);
|
} = useRoleShotServiceHook(projectId, selectedRole || undefined);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('useEditData-----selectedRole', selectedRole);
|
||||||
|
if(selectedRole){
|
||||||
|
setSelectedRole(selectedRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, [selectedRole]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (tabType === 'shot') {
|
if (tabType === 'shot') {
|
||||||
getVideoSegmentList(projectId).then(() => {
|
getVideoSegmentList(projectId).then(() => {
|
||||||
@ -107,7 +117,7 @@ export const useEditData = (tabType: string) => {
|
|||||||
updateRoleText,
|
updateRoleText,
|
||||||
regenerateRole,
|
regenerateRole,
|
||||||
fetchUserRoleLibrary,
|
fetchUserRoleLibrary,
|
||||||
uploadImageToQiniu,
|
uploadImageAndUpdateRole,
|
||||||
// role shot
|
// role shot
|
||||||
shotSelectionList,
|
shotSelectionList,
|
||||||
selectedRoleId,
|
selectedRoleId,
|
||||||
|
|||||||
@ -93,7 +93,8 @@ export function useWorkflowData() {
|
|||||||
} = useScriptService();
|
} = useScriptService();
|
||||||
// 初始化剧本
|
// 初始化剧本
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('开始初始化剧本', originalText);
|
console.log('开始初始化剧本', originalText,episodeId);
|
||||||
|
// TODO 为什么一开始没项目id
|
||||||
originalText && initializeFromProject(episodeId, originalText).then(() => {
|
originalText && initializeFromProject(episodeId, originalText).then(() => {
|
||||||
console.log('应用剧本');
|
console.log('应用剧本');
|
||||||
// 自动模式下 应用剧本;手动模式 需要点击 下一步 触发
|
// 自动模式下 应用剧本;手动模式 需要点击 下一步 触发
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export function CharacterTabContent({
|
|||||||
updateRoleText,
|
updateRoleText,
|
||||||
regenerateRole,
|
regenerateRole,
|
||||||
fetchUserRoleLibrary,
|
fetchUserRoleLibrary,
|
||||||
uploadImageToQiniu,
|
uploadImageAndUpdateRole,
|
||||||
// role shot
|
// role shot
|
||||||
shotSelectionList,
|
shotSelectionList,
|
||||||
fetchRoleShots,
|
fetchRoleShots,
|
||||||
@ -230,7 +230,7 @@ export function CharacterTabContent({
|
|||||||
}
|
}
|
||||||
setIsUploading(true);
|
setIsUploading(true);
|
||||||
|
|
||||||
uploadImageToQiniu(file).then((data) => {
|
uploadImageAndUpdateRole(file).then((data) => {
|
||||||
console.log('上传图片成功', data);
|
console.log('上传图片成功', data);
|
||||||
// 清空input的值,这样同一个文件可以重复选择
|
// 清空input的值,这样同一个文件可以重复选择
|
||||||
event.target.value = '';
|
event.target.value = '';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user