forked from 77media/video-flow
兼容字段是null
This commit is contained in:
parent
2820ce0c4d
commit
7efa73a524
@ -75,6 +75,10 @@ function isShotVideoGeneration(data: any): data is ShotVideoGeneration {
|
||||
return data && 'prompt_json' in data && 'urls' in data && 'completed_count' in data && 'total_count' in data;
|
||||
}
|
||||
|
||||
function displayText(title: string, content: string, isLast: boolean = false) {
|
||||
return `${content ? `${title}: ${content}${isLast ? '' : '\n'}` : ''}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统消息转换为blocks数组
|
||||
*/
|
||||
@ -153,7 +157,7 @@ function transformSystemMessage(
|
||||
if (isShotSketchGeneration(customData)) {
|
||||
blocks = [{
|
||||
type: 'text',
|
||||
text: `🎬 Storyboard static frame generation \nShot type: ${customData.shot_type}\nAtmosphere: ${customData.atmosphere}\nKey action: ${customData.key_action}`
|
||||
text: `🎬 Storyboard static frame generation \n${displayText('Shot type', customData.shot_type)}${displayText('Atmosphere', customData.atmosphere)}${displayText('Key action', customData.key_action, true)}`
|
||||
}, {
|
||||
type: 'image',
|
||||
url: customData.url
|
||||
|
||||
@ -115,24 +115,24 @@ export function useWorkflowData() {
|
||||
}
|
||||
}, [taskObject.currentStage]);
|
||||
|
||||
const generateEditPlan = useCallback(async (isInit?: boolean) => {
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
localStorage.setItem(`isLoaded_plan_${episodeId}`, 'true');
|
||||
isInit && await getGenerateEditPlan({ project_id: episodeId });
|
||||
openEditPlan();
|
||||
}, [episodeId]);
|
||||
// const generateEditPlan = useCallback(async (isInit?: boolean) => {
|
||||
// if (isLoaded) {
|
||||
// return;
|
||||
// }
|
||||
// localStorage.setItem(`isLoaded_plan_${episodeId}`, 'true');
|
||||
// isInit && await getGenerateEditPlan({ project_id: episodeId });
|
||||
// openEditPlan();
|
||||
// }, [episodeId]);
|
||||
|
||||
const openEditPlan = useCallback(async () => {
|
||||
window.open(`https://smartcut.movieflow.ai/ai-editor/${episodeId}?token=${token}&user_id=${useid}`, '_target');
|
||||
}, [episodeId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!from && canGoToCut && taskObject.status !== 'COMPLETED') {
|
||||
generateEditPlan(true);
|
||||
}
|
||||
}, [canGoToCut, taskObject.status]);
|
||||
// useEffect(() => {
|
||||
// if (!from && canGoToCut && taskObject.status !== 'COMPLETED') {
|
||||
// generateEditPlan(true);
|
||||
// }
|
||||
// }, [canGoToCut, taskObject.status]);
|
||||
|
||||
|
||||
useUpdateEffect(() => {
|
||||
@ -407,8 +407,8 @@ export function useWorkflowData() {
|
||||
const titleResponse = await getScriptTitle({ project_id: episodeId });
|
||||
console.log('titleResponse', titleResponse);
|
||||
if (titleResponse.successful) {
|
||||
taskCurrent.title = titleResponse.data.title;
|
||||
taskCurrent.tags = titleResponse.data.tags || [];
|
||||
taskCurrent.title = titleResponse.data.name;
|
||||
taskCurrent.tags = titleResponse.data.description.tags || [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user