This commit is contained in:
annie
2024-06-28 16:06:33 -07:00
parent b1f859fe91
commit 331f6633ca
29 changed files with 1239 additions and 0 deletions

16
app/api/chat/route.ts Normal file
View File

@@ -0,0 +1,16 @@
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-4-turbo"),
messages,
});
return result.toAIStreamResponse();
}