我正在尝试对 GPT-3.5 API 进行 API 调用,但从 OpenAI 导入的任何内容都会出现“没有导出的成员”错误。
import { Configuration, OpenAIApi } from "openai";
import { auth } from "@clerk/nextjs";
import { NextResponse } from "next/server";
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY
});
const openai = new OpenAIApi(configuration);
export async function POST(
req: Request
) {
try {
const { userId } = auth();
const body = await req.json();
const { messages } = body;
if (!userId) {
return new NextResponse("Unauthorised", { status: 401 });
}
if (!configuration.apiKey) …Run Code Online (Sandbox Code Playgroud)