From 41dc996053972260e883812d2a243a71f4b8a4f7 Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Fri, 2 Jun 2023 10:05:21 -0400 Subject: [PATCH] Fix type error --- app/api/chat/route.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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,