Skip to content

Commit 2e27398

Browse files
committed
fix: try handling non-existent hubVectorize
1 parent 58ecf9b commit 2e27398

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/utils/embeddings.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getLabels, type Issue } from './github'
55

66
export async function getEmbeddingsForIssue(event: H3Event, issue: Issue) {
77
const storage = hubKV()
8-
const vectorize = hubVectorize('issues')
8+
const vectorize = typeof hubVectorize !== 'undefined' ? hubVectorize('issues') : null
99
if (!issue.repository) {
1010
const match = issue.repository_url.match(/\/(?<owner>[^/]+)\/(?<name>[^/]+)$/)
1111
if (match) {
@@ -31,7 +31,7 @@ export async function getEmbeddingsForIssue(event: H3Event, issue: Issue) {
3131
const embeddings = await generateEmbedding(event, text)
3232

3333
await Promise.all([
34-
vectorize.insert([{
34+
vectorize?.insert([{
3535
id: storageKey,
3636
values: embeddings,
3737
metadata: {

0 commit comments

Comments
 (0)