2793c06278
- 所有 workspace 包 @dada/* → @yume/*,根包 dada → yume - 全部导入路径同步更新 - 内部 ID 对齐:dada-ripple → yume-ripple,dada:custom → yume:custom - 首页 / new / play 用户文案整段中文化,保留 smallcaps + 衬线 + 罗马数字排版语汇 - README 标题改为 "# 云梦",部署链接与目录树 slug 改为 yume - 重新生成 pnpm-lock.yaml Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
963 B
TypeScript
33 lines
963 B
TypeScript
import { visionTurn } from "@yume/engine";
|
|
import type { VisionRequest } from "@yume/types";
|
|
import { NextResponse } from "next/server";
|
|
import { loadEngineConfig } from "@/lib/config";
|
|
|
|
export const runtime = "nodejs";
|
|
export const maxDuration = 60;
|
|
|
|
export async function POST(req: Request) {
|
|
let body: VisionRequest;
|
|
try {
|
|
body = (await req.json()) as VisionRequest;
|
|
} catch {
|
|
return NextResponse.json({ error: "Invalid JSON" }, { status: 400 });
|
|
}
|
|
|
|
if (!body.session || !body.prevImageBase64 || !body.click) {
|
|
return NextResponse.json(
|
|
{ error: "session, prevImageBase64, click are required" },
|
|
{ status: 400 },
|
|
);
|
|
}
|
|
|
|
try {
|
|
const config = loadEngineConfig();
|
|
const result = await visionTurn(config, body);
|
|
return NextResponse.json(result);
|
|
} catch (err) {
|
|
const message = err instanceof Error ? err.message : "Unknown error";
|
|
return NextResponse.json({ error: message }, { status: 500 });
|
|
}
|
|
}
|