Skip to content

Commit

Permalink
Update packages/server/src/model/ai.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Stephan Kulla <git.mail@kulla.me>
  • Loading branch information
CodingDive and kulla authored Nov 14, 2023
1 parent 8b39a26 commit 21467a1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/server/src/model/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ import { UserInputError } from '~/errors'
let openai: OpenAI | undefined

function getOpenAIInstance() {
if (!process.env.OPENAI_API_KEY) {
// eslint-disable-next-line no-console
console.error('OpenAI API key is not defined.')
return undefined
}

if (!openai) {
if (process.env.OPENAI_API_KEY !== undefined && openai === undefined) {
openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
})
Expand Down

0 comments on commit 21467a1

Please sign in to comment.