addbede929
- Move vercel.json to apps/web/ with correct route paths; cap scene route
maxDuration 120→60s for Hobby. Root vercel.json removed. Vercel project's
Root Directory must be set to apps/web (Deploy button URL passes this).
- Switch image transport from base64-in-JSON to Runware-hosted URLs:
generateImage now uses outputType=URL and returns {imageUrl, imageUuid};
StartResponse/SceneResponse carry imageUrl; VisionRequest carries
prevImageUrl (server re-fetches the bytes for click annotation). This
eliminates the 4.5MB serverless body-size risk.
- Painter and director prefer URL over UUID for referenceImages — the UUID
returned by Runware imageInference isn't always recognized in the refs
pipeline (surfaces as `failedToTransferImage`).
- Client preloads scene images via `new Image().decode()` before committing
to React state, so URL transitions render instantly; prefetched scenes
also warm the HTTP cache.
- jsonParser uses the jsonrepair package (replaces hand-rolled repair) and
adds a targeted preRepair regex for the missing-key-close-quote pattern
that jsonrepair couldn't disambiguate. Full raw model output dumped on
failure for diagnostic visibility.
- Default text provider switched to DeepSeek v4-flash via direct API
(significantly more stable JSON than MiMo v2.5-pro). VISION/TTS stay on
MiMo (DeepSeek has no multimodal / TTS offerings).
- next.config: drop dead experimental.serverActions.bodySizeLimit (no
server actions used).
- README: real Deploy button URL (zonghaoyuan/yume + root-directory=apps/web
+ TTS/MOCK_IMAGE in env list); refreshed env vars table with optional
TTS section.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { requestScene } from "@yume/engine";
|
||
import type { SceneRequest } from "@yume/types";
|
||
import { NextResponse } from "next/server";
|
||
import { loadEngineConfig } from "@/lib/config";
|
||
|
||
export const runtime = "nodejs";
|
||
// Capped at 60 for Vercel Hobby (300 allowed on Pro). The scene pipeline is
|
||
// Writer + CharDesigner×N + Cinematographer + Painter — happy path 9–12s; the
|
||
// tail (cold provider, multiple new characters) can push 30–45s, so 60 is a
|
||
// reasonable headroom on Hobby.
|
||
export const maxDuration = 60;
|
||
|
||
export async function POST(req: Request) {
|
||
let body: SceneRequest;
|
||
try {
|
||
body = (await req.json()) as SceneRequest;
|
||
} catch {
|
||
return NextResponse.json({ error: "Invalid JSON" }, { status: 400 });
|
||
}
|
||
|
||
if (!body.session) {
|
||
return NextResponse.json({ error: "session is required" }, { status: 400 });
|
||
}
|
||
|
||
try {
|
||
const config = loadEngineConfig();
|
||
const result = await requestScene(config, body);
|
||
return NextResponse.json(result);
|
||
} catch (err) {
|
||
const message = err instanceof Error ? err.message : "Unknown error";
|
||
return NextResponse.json({ error: message }, { status: 500 });
|
||
}
|
||
}
|