forked from 77media/video-flow
Merge branch 'dev' of https://git.qikongjian.com/77media/video-flow into dev
This commit is contained in:
commit
43b42e3d09
@ -145,18 +145,19 @@ export class RoleEditUseCase {
|
|||||||
* @throws {Error} 如果数据格式不正确则抛出异常
|
* @throws {Error} 如果数据格式不正确则抛出异常
|
||||||
*/
|
*/
|
||||||
parseSimilarCharacterList(similarCharacterData: any): RoleEntity[] {
|
parseSimilarCharacterList(similarCharacterData: any): RoleEntity[] {
|
||||||
if (!similarCharacterData || !Array.isArray(similarCharacterData.characters)) {
|
// if (!similarCharacterData || !Array.isArray(similarCharacterData.characters)) {
|
||||||
throw new Error('相似角色数据格式错误');
|
// throw new Error('相似角色数据格式错误');
|
||||||
}
|
// }
|
||||||
|
const characters = [...similarCharacterData.similar_characters, ...similarCharacterData.user_characters];
|
||||||
|
|
||||||
return similarCharacterData.characters.map((char: any, index: number) => {
|
return characters.map((char: any, index: number) => {
|
||||||
/** 角色实体对象 */
|
/** 角色实体对象 */
|
||||||
const roleEntity: RoleEntity = {
|
const roleEntity: RoleEntity = {
|
||||||
id: char.id || `role_${Date.now()}_${index}`,
|
id: char.id || `role_${Date.now()}_${index}`,
|
||||||
name: char.name || '',
|
name: char.name || '',
|
||||||
generateText: char.description || '',
|
generateText: char.brief || '',
|
||||||
tags: [], // 相似角色接口可能不返回标签,暂时为空
|
tags: [], // 相似角色接口可能不返回标签,暂时为空
|
||||||
imageUrl: char.image_url || '',
|
imageUrl: char.avatar || '',
|
||||||
loadingProgress: 100,
|
loadingProgress: 100,
|
||||||
disableEdit: false,
|
disableEdit: false,
|
||||||
updatedAt: Date.now(),
|
updatedAt: Date.now(),
|
||||||
|
|||||||
@ -111,8 +111,8 @@ export function CharacterTabContent({
|
|||||||
}, [roleData, isInitialized]);
|
}, [roleData, isInitialized]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('获取选中项数据', selectedRole);
|
console.log('获取shotSelectionList数据', shotSelectionList);
|
||||||
}, [selectedRole]);
|
}, [shotSelectionList]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('获取角色库数据', userRoleLibrary);
|
console.log('获取角色库数据', userRoleLibrary);
|
||||||
@ -184,8 +184,12 @@ export function CharacterTabContent({
|
|||||||
setShowAddToLibrary(false);
|
setShowAddToLibrary(false);
|
||||||
|
|
||||||
// 使用真实的角色数据
|
// 使用真实的角色数据
|
||||||
const selectedRole = userRoleLibrary[index];
|
const role = userRoleLibrary[index];
|
||||||
if (selectedRole) {
|
if (role) {
|
||||||
|
selectRole({
|
||||||
|
...role,
|
||||||
|
name: selectedRole?.name || ''
|
||||||
|
});
|
||||||
handleStartReplaceCharacter();
|
handleStartReplaceCharacter();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -158,23 +158,22 @@ export function ReplacePanel({
|
|||||||
whileHover={{ scale: 1.02 }}
|
whileHover={{ scale: 1.02 }}
|
||||||
whileTap={{ scale: 0.98 }}
|
whileTap={{ scale: 0.98 }}
|
||||||
>
|
>
|
||||||
{shot.videoUrl && (
|
{shot.videoUrl && shot.videoUrl.length > 0 && (
|
||||||
<video
|
<video
|
||||||
ref={el => {
|
ref={el => {
|
||||||
if (el) videoRefs.current[shot.id] = el;
|
if (el) videoRefs.current[shot.id] = el;
|
||||||
}}
|
}}
|
||||||
src={shot.videoUrl}
|
src={shot.videoUrl[0]}
|
||||||
className="w-full h-full object-cover"
|
className="w-full h-full object-cover"
|
||||||
loop
|
loop
|
||||||
muted
|
muted
|
||||||
playsInline
|
playsInline
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!shot.videoUrl && (
|
{(!shot.videoUrl || shot.videoUrl.length === 0) && (
|
||||||
<>
|
<>
|
||||||
<img
|
<img
|
||||||
src={shot.sketchUrl}
|
src={shot.sketchUrl}
|
||||||
alt={`Shot ${shot.id}`}
|
|
||||||
className="w-full h-full object-cover"
|
className="w-full h-full object-cover"
|
||||||
/>
|
/>
|
||||||
<div className="absolute inset-0 bg-black/50 flex items-center justify-center">
|
<div className="absolute inset-0 bg-black/50 flex items-center justify-center">
|
||||||
@ -182,11 +181,6 @@ export function ReplacePanel({
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{selectedShots.includes(shot.id) && (
|
|
||||||
<div className="absolute top-2 right-2">
|
|
||||||
<Check className="w-4 h-4 text-blue-500" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</motion.div>
|
</motion.div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user