feat: add export to .md button

This commit is contained in:
Yifei Zhang
2023-03-15 17:24:03 +00:00
parent 64e331a3e3
commit bab470d000
11 changed files with 181 additions and 18 deletions

View File

@@ -1,7 +1,6 @@
import { OpenAIApi, Configuration } from "openai";
import { ChatRequest } from "./typing";
const isProd = process.env.NODE_ENV === "production";
const apiKey = process.env.OPENAI_API_KEY;
const openai = new OpenAIApi(
@@ -16,16 +15,7 @@ export async function POST(req: Request) {
const completion = await openai!.createChatCompletion(
{
...requestBody,
},
isProd
? {}
: {
proxy: {
protocol: "socks",
host: "127.0.0.1",
port: 7890,
},
}
}
);
return new Response(JSON.stringify(completion.data));