We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a44e321 commit 4e49958Copy full SHA for 4e49958
source/utils/openai.js
@@ -1,12 +1,11 @@
1
import execa from 'execa';
2
import OpenAI from 'openai';
3
-import dotenv from 'dotenv';
4
import config from './config.json';
+import { getOpenAIKey } from './api.js';
5
+import dotenv from 'dotenv';
6
7
dotenv.config();
8
-const openai = new OpenAI(process.env.OPENAI_API_KEY);
9
-
10
// remove any staged changes in git
11
async function initGit() {
12
try {
@@ -51,6 +50,8 @@ async function gitDiff() {
51
50
}
52
53
async function generatePrompt() {
+ const apiKey = await getOpenAIKey();
54
+ const openai = new OpenAI({apiKey: apiKey});
55
// get the staged changes
56
await initGit();
57
await gitStatus();
0 commit comments