Fix type error

This commit is contained in:
Jared Palmer 2023-06-02 10:05:21 -04:00
parent 240b14e7e1
commit 41dc996053

View file

@ -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,