From 0840aa584a4f933bba46a3f4f6fa2f7e109a2746 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 8 May 2023 23:47:54 +0800 Subject: [PATCH] chore: remove openai api key check temporarily --- src/pages/api/chat.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/pages/api/chat.ts b/src/pages/api/chat.ts index 233ca1f..f644b3a 100644 --- a/src/pages/api/chat.ts +++ b/src/pages/api/chat.ts @@ -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;