Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions apps/website/app/api/embeddings/openai/small/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ if (!apiKey) {
);
}

const openai = new OpenAI({
apiKey: apiKey,
});
const openai = apiKey ? new OpenAI({ apiKey }) : null;

type RequestBody = {
input: string | string[];
Expand Down Expand Up @@ -68,7 +66,7 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
options.dimensions = dimensions;
}

const embeddingsPromise = openai.embeddings.create(options);
const embeddingsPromise = openai!.embeddings.create(options);
const timeoutPromise = new Promise((_, reject) =>
setTimeout(
() => reject(new Error("OpenAI API request timeout")),
Expand Down
1 change: 1 addition & 0 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@sindresorhus/slugify": "^2.2.1",
"gray-matter": "^4.0.3",
"next": "^15.0.3",
"openai": "^4.97.0",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
"rehype-parse": "^9.0.1",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"tailwindConfig": "./packages/tailwind-config/tailwind.config.ts"
},
"dependencies": {
"openai": "^4.97.0",
"posthog-js": "^1.203.1"
}
}