diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index 76bce95..8267573 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -1,5 +1,5 @@ import { auth } from "@/auth"; -import { OpenAIStream, StreamingTextResponse } from "ai-connector"; +import { Message, OpenAIStream, StreamingTextResponse } from "ai-connector"; import { openai } from "@/lib/openai"; export const POST = auth(async function POST(req: Request) { @@ -9,7 +9,10 @@ export const POST = auth(async function POST(req: Request) { const res = await openai.createChatCompletion({ model: "gpt-3.5-turbo", - messages: json.messages.map((m) => ({ content: m.content, role: m.role })), + messages: json.messages.map((m: Message) => ({ + content: m.content, + role: m.role, + })), temperature: 0.7, top_p: 1, frequency_penalty: 1,