兼容字段是null

This commit is contained in:
北枳 2025-09-03 20:26:24 +08:00
parent 2820ce0c4d
commit 7efa73a524
2 changed files with 20 additions and 16 deletions

View File

@ -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; 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数组 * blocks数组
*/ */
@ -153,7 +157,7 @@ function transformSystemMessage(
if (isShotSketchGeneration(customData)) { if (isShotSketchGeneration(customData)) {
blocks = [{ blocks = [{
type: 'text', 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', type: 'image',
url: customData.url url: customData.url

View File

@ -115,24 +115,24 @@ export function useWorkflowData() {
} }
}, [taskObject.currentStage]); }, [taskObject.currentStage]);
const generateEditPlan = useCallback(async (isInit?: boolean) => { // const generateEditPlan = useCallback(async (isInit?: boolean) => {
if (isLoaded) { // if (isLoaded) {
return; // return;
} // }
localStorage.setItem(`isLoaded_plan_${episodeId}`, 'true'); // localStorage.setItem(`isLoaded_plan_${episodeId}`, 'true');
isInit && await getGenerateEditPlan({ project_id: episodeId }); // isInit && await getGenerateEditPlan({ project_id: episodeId });
openEditPlan(); // openEditPlan();
}, [episodeId]); // }, [episodeId]);
const openEditPlan = useCallback(async () => { const openEditPlan = useCallback(async () => {
window.open(`https://smartcut.movieflow.ai/ai-editor/${episodeId}?token=${token}&user_id=${useid}`, '_target'); window.open(`https://smartcut.movieflow.ai/ai-editor/${episodeId}?token=${token}&user_id=${useid}`, '_target');
}, [episodeId]); }, [episodeId]);
useEffect(() => { // useEffect(() => {
if (!from && canGoToCut && taskObject.status !== 'COMPLETED') { // if (!from && canGoToCut && taskObject.status !== 'COMPLETED') {
generateEditPlan(true); // generateEditPlan(true);
} // }
}, [canGoToCut, taskObject.status]); // }, [canGoToCut, taskObject.status]);
useUpdateEffect(() => { useUpdateEffect(() => {
@ -407,8 +407,8 @@ export function useWorkflowData() {
const titleResponse = await getScriptTitle({ project_id: episodeId }); const titleResponse = await getScriptTitle({ project_id: episodeId });
console.log('titleResponse', titleResponse); console.log('titleResponse', titleResponse);
if (titleResponse.successful) { if (titleResponse.successful) {
taskCurrent.title = titleResponse.data.title; taskCurrent.title = titleResponse.data.name;
taskCurrent.tags = titleResponse.data.tags || []; taskCurrent.tags = titleResponse.data.description.tags || [];
} }
} }