mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-17 02:01:29 +10:00
refactor(v4.0.0-alpha): beginning of a new era
This commit is contained in:
18
apps/client/src/services/openai/client.ts
Normal file
18
apps/client/src/services/openai/client.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { OpenAI } from "openai";
|
||||
|
||||
import { useOpenAiStore } from "@/client/stores/openai";
|
||||
|
||||
export const openai = () => {
|
||||
const { apiKey } = useOpenAiStore.getState();
|
||||
|
||||
if (!apiKey) {
|
||||
throw new Error(
|
||||
"Your OpenAI API Key has not been set yet. Please go to your account settings to enable OpenAI Integration.",
|
||||
);
|
||||
}
|
||||
|
||||
return new OpenAI({
|
||||
apiKey,
|
||||
dangerouslyAllowBrowser: true,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user