From 2a0748394137e593d22f095a33fa352a9a903c0d Mon Sep 17 00:00:00 2001 From: GuaZi Date: Thu, 19 Sep 2024 17:54:22 +0800 Subject: [PATCH] v1.3 --- .gitignore | 3 ++- index.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b512c09..37d7e73 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +.env diff --git a/index.ts b/index.ts index 8ba4045..89992a8 100644 --- a/index.ts +++ b/index.ts @@ -1,7 +1,10 @@ import OpenAI from 'openai'; +import dotenv from 'dotenv'; + +dotenv.config() const openai = new OpenAI({ - apiKey: 'INSERT OPENAI API KEY HERE', + apiKey: process.env.OPENAI_API_KEY, }); async function getOpenAiResponse(prompt: string) {