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: serve stickman assets in development

wulien-centerdebff3e3394f
diff --git a/apps/daemon/src/api/server.ts b/apps/daemon/src/api/server.ts
index 0176c51f..5fdd6539 100644
--- a/apps/daemon/src/api/server.ts
+++ b/apps/daemon/src/api/server.ts
@@ -556,16 +556,23 @@ export async function buildServer(input: BuildServerInput) {
dirname(fileURLToPath(import.meta.url)),
'../../../../resources/stickman/visual-assets/catalog.json'
);
- const stickmanCatalogPath = existsSync(packagedStickmanCatalog)
- ? packagedStickmanCatalog
+ const developmentStickmanVisualAssetRoot = resolve(
+ dirname(fileURLToPath(import.meta.url)),
+ '../../../web/public/dashboard'
+ );
+ const stickmanVisualAssetOptions = existsSync(packagedStickmanCatalog)
+ ? {
+ root: stickmanRuntimeRoot,
+ catalogPath: packagedStickmanCatalog
+ }
: existsSync(developmentStickmanCatalog)
- ? developmentStickmanCatalog
+ ? {
+ root: developmentStickmanVisualAssetRoot,
+ catalogPath: developmentStickmanCatalog
+ }
: undefined;
- const stickmanVisualAssets = stickmanCatalogPath !== undefined
- ? createStickmanVisualAssetRegistry({
- root: stickmanRuntimeRoot,
- catalogPath: stickmanCatalogPath
- })
+ const stickmanVisualAssets = stickmanVisualAssetOptions !== undefined
+ ? createStickmanVisualAssetRegistry(stickmanVisualAssetOptions)
: undefined;
const creatorTesseractPath = [
process.env.OPENCREATOR_TESSERACT_PATH,
diff --git a/apps/daemon/test/integration/creator-api.test.ts b/apps/daemon/test/integration/creator-api.test.ts
index 258b7331..ca796652 100644
--- a/apps/daemon/test/integration/creator-api.test.ts
+++ b/apps/daemon/test/integration/creator-api.test.ts
@@ -32,6 +32,31 @@ afterEach(async () => {
});
describe('creator api', () => {
+ it('serves built-in stickman visual asset previews in development', async () => {
+ tempDir = mkdtempSync(join(tmpdir(), 'creator-api-'));
+ server = await buildServer({
+ token: 'secret',
+ dataDir: tempDir,
+ codexHome: join(tempDir, 'codex-home')
+ });
+
+ const catalog = await request(
+ 'GET',
+ '/creator/visual-assets?templateId=stickman-video'
+ );
+ expect(catalog.statusCode).toBe(200);
+ expect(catalog.json().assets).toHaveLength(14);
+
+ const preview = await server.inject({
+ method: 'GET',
+ url: '/creator/visual-assets/stickman.character.student/revisions/1/preview',
+ headers: { authorization: 'Bearer secret' }
+ });
+ expect(preview.statusCode).toBe(200);
+ expect(preview.headers['content-type']).toContain('image/png');
+ expect(preview.rawPayload.byteLength).toBeGreaterThan(1_000);
+ });
+
it('uploads a persistent inline image for a WeChat article', async () => {
await setupServer({});
const created = await request('POST', '/creator/jobs', {