quiz_flash / src /app /api /chat /route.ts
Shih-hungg's picture
Fix type errors
c7d096e
raw
history blame contribute delete
370 Bytes
import { openai } from '@ai-sdk/openai';
import { streamText } from 'ai';
// Allow streaming responses up to 30 seconds
export const maxDuration = 30;
export async function POST(req: Request) {
const { messages } = await req.json();
const result = await streamText({
model: openai('gpt-4o-mini'),
messages,
});
return result.toTextStreamResponse();
}