Skip to content

Commit

Permalink
refactor - taking API keys through enviornment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Anurag2293 committed Oct 29, 2023
1 parent d7a3cef commit fb2b50c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/controllers/code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { exec } from 'child_process';

export const main = async (args: { prompt: string }) => {
try {
const openai = new OpenAI({ apiKey: "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" });
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

// console.log(process.env.OPENAI_API_KEY);

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/do/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const main = async (args: { prompt: string }) => {
messages[messages.length - 1].content += args.prompt;

// console.log(messages);
const openai = new OpenAI({ apiKey: "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" });
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const completion = await openai.chat.completions.create({
messages: messages,
model: "gpt-3.5-turbo",
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/fs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createFile, createFolder, deleteFile, deleteFolder, readFile, writeFile

export const main = async (args: { prompt: string }) => {
try {
const openai = new OpenAI({ apiKey: "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" });
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

// console.log(process.env.OPENAI_API_KEY);

Expand Down

0 comments on commit fb2b50c

Please sign in to comment.