fix(canvas): 短剧分镜 - 支持多镜头并行生成并正确引用角色图声资产
This commit is contained in:
@@ -124,6 +124,20 @@ export async function runBackendGenerationTask(
|
||||
return createAndWaitGenerationTask({ projectId, mode, prompt, config, referenceImages, referenceVideos, referenceAudios, textHistory, signal, metadata, onTaskUpdate }, prepared, dependencies);
|
||||
}
|
||||
|
||||
// 分镜等后台生产流程只需要可靠提交任务;任务状态与产物由项目工作区轮询和
|
||||
// 后端自动回填负责,不能让页面 mutation 一直等待供应商完成。
|
||||
export async function submitBackendGenerationTask(
|
||||
options: BackendGenerationTaskOptions,
|
||||
dependencies: GenerationTaskDependencies = defaultDependencies,
|
||||
): Promise<GenerationTask> {
|
||||
throwIfAborted(options.signal);
|
||||
assertClientPromptLimit(options.mode, options.prompt, options.config, options.metadata);
|
||||
if (usesLocalDreamina(options.config)) throw new Error("本机即梦任务暂不支持后台提交");
|
||||
const prepared = await prepareGenerationReferences(options);
|
||||
throwIfAborted(options.signal);
|
||||
return createBackendGenerationTask(options, prepared, dependencies);
|
||||
}
|
||||
|
||||
export async function runBackendToolGenerationTask(options: {
|
||||
prompt: string;
|
||||
config: AiConfig;
|
||||
@@ -401,7 +415,14 @@ async function prepareGenerationReferences({
|
||||
}
|
||||
|
||||
async function createAndWaitGenerationTask(options: BackendGenerationTaskOptions, prepared: PreparedGenerationReferences, dependencies: GenerationTaskDependencies) {
|
||||
const { projectId, mode, prompt, config, signal, metadata, onTaskUpdate, onTextDelta } = options;
|
||||
const task = await createBackendGenerationTask(options, prepared, dependencies);
|
||||
const { signal, onTaskUpdate, onTextDelta } = options;
|
||||
const completed = await dependencies.waitTask(task.id, { signal, initialTask: task, onTaskUpdate, onTextDelta });
|
||||
return parseBackendGenerationResult(completed);
|
||||
}
|
||||
|
||||
async function createBackendGenerationTask(options: BackendGenerationTaskOptions, prepared: PreparedGenerationReferences, dependencies: GenerationTaskDependencies) {
|
||||
const { projectId, mode, prompt, config, metadata, onTaskUpdate } = options;
|
||||
const videoOperation = generationOperation(options);
|
||||
const workflow = resolveGenerationWorkflowExecution(config, mode);
|
||||
const logicalModelId = workflow ? "" : logicalModelIDForConfig(config);
|
||||
@@ -428,8 +449,7 @@ async function createAndWaitGenerationTask(options: BackendGenerationTaskOptions
|
||||
},
|
||||
});
|
||||
onTaskUpdate?.(task);
|
||||
const completed = await dependencies.waitTask(task.id, { signal, initialTask: task, onTaskUpdate, onTextDelta });
|
||||
return parseBackendGenerationResult(completed);
|
||||
return task;
|
||||
}
|
||||
|
||||
async function prepareBackendMediaReference(media: ReferenceVideo | ReferenceAudio) {
|
||||
|
||||
Reference in New Issue
Block a user