Fix type error
This commit is contained in:
parent
240b14e7e1
commit
41dc996053
1 changed files with 5 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { auth } from "@/auth";
|
import { auth } from "@/auth";
|
||||||
import { OpenAIStream, StreamingTextResponse } from "ai-connector";
|
import { Message, OpenAIStream, StreamingTextResponse } from "ai-connector";
|
||||||
import { openai } from "@/lib/openai";
|
import { openai } from "@/lib/openai";
|
||||||
|
|
||||||
export const POST = auth(async function POST(req: Request) {
|
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({
|
const res = await openai.createChatCompletion({
|
||||||
model: "gpt-3.5-turbo",
|
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,
|
temperature: 0.7,
|
||||||
top_p: 1,
|
top_p: 1,
|
||||||
frequency_penalty: 1,
|
frequency_penalty: 1,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue