feat(MED-97): fix new OpenAI() throws error when key is missing in env
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
import OpenAI from 'openai';
|
import OpenAI from 'openai';
|
||||||
|
|
||||||
export const isValidOpenAiEnv = async () => {
|
export const isValidOpenAiEnv = async () => {
|
||||||
const client = new OpenAI();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const client = new OpenAI();
|
||||||
await client.models.list();
|
await client.models.list();
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user