Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

fix(creator): surface preflight failures

MijaelX0f7e6f8c7d33
diff --git a/apps/daemon/src/api/routes.creator.ts b/apps/daemon/src/api/routes.creator.ts
index 4bb6c0a4..c69cbdc2 100644
--- a/apps/daemon/src/api/routes.creator.ts
+++ b/apps/daemon/src/api/routes.creator.ts
@@ -889,7 +889,10 @@ export async function registerCreatorRoutes(
payload: { revision: job.revision, reset: true }
});
} else {
- for (const event of persistent.slice(cursorIndex + 1)) writeEvent(event);
+ for (const event of persistent.slice(cursorIndex + 1)) {
+ if (event.revision === job.revision && event.kind !== 'snapshot_changed') continue;
+ writeEvent(event);
+ }
}
}
replaying = false;
@@ -1043,6 +1046,14 @@ function readCreatorAgentSandbox(
}
function sendCreatorError(reply: FastifyReply, error: unknown) {
+ if (error instanceof CreatorPreflightError) {
+ return reply.code(400).send({
+ error: {
+ ...apiError(error.code as RuntimeErrorCode, error.message).error,
+ preflight: error.result
+ }
+ });
+ }
if (error instanceof StickmanVisualAssetError) {
const status = error.code.endsWith('_not_found') ? 404 : 422;
return reply.code(status).send(apiError(error.code as RuntimeErrorCode, error.message));
diff --git a/apps/daemon/src/creator/preflight.ts b/apps/daemon/src/creator/preflight.ts
index fc51ae60..f47bf3d2 100644
--- a/apps/daemon/src/creator/preflight.ts
+++ b/apps/daemon/src/creator/preflight.ts
@@ -185,7 +185,14 @@ function checkProviderConfig(
): void {
const needs = new Set<string>();
if (stage.executor === 'krillinai') {
- if (stage.id === 'subtitle') needs.add('llm');
+ if (
+ stage.id === 'subtitle'
+ && !job.artifacts.some(artifact => (
+ artifact.id === job.state.importedTargetSubtitleId
+ && artifact.kind === 'target_subtitle'
+ && artifact.status === 'completed'
+ ))
+ ) needs.add('llm');
if (stage.id === 'tts' && job.state.dubbing === true) needs.add('tts');
}
if (stage.executor === 'clip' || stage.executor === 'stickman') needs.add('llm');
diff --git a/apps/daemon/test/integration/creator-smart-dubbing.test.ts b/apps/daemon/test/integration/creator-smart-dubbing.test.ts
index b3ddb876..4ec186ea 100644
--- a/apps/daemon/test/integration/creator-smart-dubbing.test.ts
+++ b/apps/daemon/test/integration/creator-smart-dubbing.test.ts
@@ -21,6 +21,8 @@ describe('creator smart dubbing', () => {
it('runs TTS through Creator Job, Stage, Artifact and ResultSnapshot', async () => {
tempDir = await mkdtemp(join(tmpdir(), 'creator-smart-dubbing-'));
const config = createDefaultCreatorServicesConfig();
+ config.tts.openai.baseUrl = 'https://api.openai.com/v1';
+ config.tts.openai.apiKey = 'test-key';
const audio = Buffer.from('creator-smart-dubbing-audio');
const synthesize = vi.fn(async () => ({
content: audio,