chore: remove openai api key check temporarily

This commit is contained in:
Steven
2023-05-08 23:47:54 +08:00
parent cd265a5c47
commit 0840aa584a

View File

@@ -1,10 +1,5 @@
import {
createParser,
ParsedEvent,
ReconnectInterval,
} from "eventsource-parser";
import { createParser, ParsedEvent, ReconnectInterval } from "eventsource-parser";
import { NextRequest } from "next/server";
import { API_KEY } from "@/env";
import { openAIApiEndpoint, openAIApiKey, gpt35 } from "@/utils";
export const config = {
@@ -18,15 +13,6 @@ const getApiEndpoint = (apiEndpoint: string) => {
};
const handler = async (req: NextRequest) => {
if (API_KEY) {
const auth = req.headers.get("Authorization");
if (!auth || auth !== `Bearer ${API_KEY}`) {
return new Response("Unauthorized", {
status: 401,
});
}
}
const reqBody = await req.json();
const openAIApiConfig = reqBody.openAIApiConfig;
const apiKey = openAIApiConfig?.key || openAIApiKey;