112 lines
5.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { parseMDXContent } from '@/lib/mdx';
import { BASE_URL } from '@/api/constants';
export const dynamic = 'force-dynamic';
export const runtime = 'edge';
export async function GET() {
try {
const content = `[分析场景核心] 一位舞者对<Annot type="circle">完美</Annot>的执念,<Annot type="highlight" color="#ef4444">使她的美丽舞蹈转化为一种自我毁灭的仪式</Annot>。
### <Annot type="highlight">第一幕:开端</Annot>
内景 · 舞蹈室 - 傍晚
夕阳透过窗户,阳光携带着飞舞的尘埃,划出一块金色矩形洒在斑驳的木地板上。墙面苍白、剥落。一整面落地镜映出这空旷房间的寂静。
<Annot type="box" color="#a855f7">ELARA</Annot>20岁出头身姿优雅至极立于光影正中。她赤脚穿着一件简单的黑色紧身舞衣随着一段大提琴独奏起舞——旋律哀伤而高昂。
她的身体如流水般线条优雅。一只手臂伸展,手指在空气中描绘出无形的轨迹。她缓缓旋转,像是违抗了重力的引力。<Annot type="highlight" color="#84cc16">在这一刻,她是完美的化身。</Annot>
但她的双眼,始终盯着镜中的自己,突然微微眯起——<Annot type="highlight" color="#f59e0b">一丝自我厌弃的情绪一闪而过</Annot>。<Annot type="highlight" color="#f59e0b">那个旋转,不够纯净。不够完美。对她而言。</Annot>
她打断了舞姿。现在,她的呼吸变得可闻,如利刃般切入大提琴的温柔旋律。
她毫不迟疑地重新起舞。这一次,更快、更狠。<Annot type="highlight" color="#ef4444">舞姿仍美,却变得尖锐,带着绝望的锋芒。</Annot>
一滴汗水,从她的太阳穴滑落。
她再次旋转,又旋转。一个狂热、残酷的段落。她的脸不再沉静,而是绷紧的面具,咬牙切齿。音乐愈发高亢,但我们所听见的,只有她脚步在木地板上滑出的尖锐声响,以及她粗重、急促的喘息。
<Annot type="highlight" color="#ef4444">镜中的倒影已模糊成一道疯狂的涂抹。</Annot>她强迫自己再做一个旋转——那种超越极限的最后一圈。
<Annot type="highlight" color="#ef4444">她的脚踝崩溃了。</Annot>
不是咔嚓断裂的声响,而是一种沉默、恶心的扭曲。<Annot type="box" color="#a855f7">Elara</Annot> 倒在地上,如阳光外的一团残骸,四肢交错,失去光环。
大提琴继续演奏,平静、冷漠。
<Annot type="highlight" color="#06b6d4">她喉间发出一声哽咽般的呜咽,是房间中唯一的声音。</Annot>镜头穿过她起伏的肩膀,聚焦她的脚——足弓紧绷,脚趾青紫,地板上划出一丝血痕。
### <Annot type="highlight">导演与表演附录</Annot>
【<Annot type="highlight">导演风格解码</Annot>】
• 核心视觉基调: 高反差明暗对比,采用单一自然光源(窗户)。随着角色状态的恶化,色调从温暖金色逐渐转为冷峻的蓝灰。
• 关键镜头处理建议: 开始用宽阔流畅的镜头呼应舞者的优雅;当其内心破裂时,剪切到突兀的特写镜头:颤抖的大腿肌肉、颈侧汗珠、扭曲的表情与模糊的镜中倒影。最后一个镜头采用固定机位,锁定她瘫倒的身体,强化突然静止的冲击感。她的舞步原本是以光影为中心的循环,她的倒地打破了这一循环,使她落入阴影。
### <Annot type="highlight">核心表演关键</Annot>
• 角色肢体表现: 表演需呈现双重性——外在看似毫不费力的优雅与内在痛苦的微妙细节同在。崩溃时不应夸张,而应如过度拉紧的身体对重力的安静屈服。
• 潜台词驱动: 这是与"无形评审"——镜中自己——之间的战争。每一个动作都是抗议,每一个旋转是一种恳求,每一次喘息都是诅咒。<Annot type="highlight" color="#a855f7">核心动机是:"我要强迫这个不完美的身体创造一个完美的瞬间,即使这将摧毁我。"</Annot>
### <Annot type="highlight">当代表达的连接</Annot>
这个故事呼应了当代数字时代"精心营造的完美主义"现象,在理想化的自我形象背后,隐藏着焦虑与倦怠的真实生活。
`;
console.log('开始解析 MDX 内容...');
const chunks = await parseMDXContent(content);
console.log('解析完成,获得块数:', chunks?.length);
if (!chunks || chunks.length === 0) {
console.error('没有生成有效的内容块');
return new Response(
JSON.stringify({ error: '内容解析失败' }),
{
status: 500,
headers: { 'Content-Type': 'application/json' }
}
);
}
// 创建一个可写流来处理数据
const stream = new TransformStream();
const writer = stream.writable.getWriter();
const encoder = new TextEncoder();
// 异步处理数据流
(async () => {
try {
for (const chunk of chunks) {
const data = encoder.encode(JSON.stringify(chunk) + '\n');
await writer.write(data);
}
} catch (error) {
console.error('写入流时出错:', error);
} finally {
await writer.close();
}
})();
return new Response(stream.readable, {
headers: {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
'Connection': 'keep-alive',
},
});
} catch (error) {
console.error('API 路由处理出错:', error);
return new Response(
JSON.stringify({
error: '服务器处理请求时出错',
details: error instanceof Error ? error.message : '未知错误'
}),
{
status: 500,
headers: { 'Content-Type': 'application/json' }
}
);
}
}