8eda27f241
PR #9 已完成首页和 layout 的视觉品牌迁移,此 commit 补齐剩余的 技术性改名 —— workspace 包名、source import、localStorage 键、 CSS keyframe、内部 header logo、.env.example、README。 - @yume/* → @infiplot/* (6 package.json + 17 imports + lockfile) - localStorage/sessionStorage: yume:* → infiplot:* (含 PR #9 新增的 yume:hintClosed) - CSS keyframe yume-ripple → infiplot-ripple - new/play 页面 header logo "云梦" → "InfiPlot" - 代码注释中的「云梦」style 形容词删除(layout.tsx, page.tsx) - 根 package.json name + description(描述跟齐 staging "AI 实时交互剧情游戏") - README: tagline / Vercel deploy URL / 目录树 / engine 描述 保留:prompts.ts 的 LLM 体裁术语「视觉小说/galgame」、CustomForm placeholder 的「视觉小说画风」(图像模型识别的风格名词)。 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 "@infiplot/engine";
|
||
import type { SceneRequest } from "@infiplot/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 });
|
||
}
|
||
}
|