mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 18:11:51 +08:00
27 lines
868 B
TypeScript
27 lines
868 B
TypeScript
import * as Sentry from '@sentry/nextjs'
|
|
import { type NextRequest } from 'next/server'
|
|
|
|
import { corsHeaders } from '../cors'
|
|
import { _handleEmbeddingsSearchRequest } from './route.utils'
|
|
|
|
export const runtime = 'edge'
|
|
|
|
export async function OPTIONS() {
|
|
return new Response(null, { headers: corsHeaders })
|
|
}
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const response = await _handleEmbeddingsSearchRequest(request)
|
|
Object.entries(corsHeaders).forEach(([key, value]) => response.headers.set(key, value))
|
|
return response
|
|
} catch (error) {
|
|
console.error('Error handling docs embeddings search request:', error)
|
|
Sentry.captureException(error, { tags: { route: 'search-embeddings' } })
|
|
return Response.json(
|
|
{ error: 'There was an error processing your request' },
|
|
{ status: 500, headers: corsHeaders }
|
|
)
|
|
}
|
|
}
|