Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import { NextResponse } from 'next/server' import { searchProfiles } from '@/lib/seed/embedding-search' import { withAuth } from '@/lib/auth/withAuth' /** * GET /api/debug/seed-students/search?q=... * * Natural language search over seed student profiles using embeddings. * Returns profile names ranked by semantic similarity to the query. */ export const GET = withAuth( async (req: Request) => { const { searchParams } = new URL(req.url) const query = searchParams.get('q')?.trim() if (!query || query.length < 3) { return NextResponse.json({ results: [] }) } try { const results = await searchProfiles(query) return NextResponse.json({ results }) } catch (error) { console.error('[seed-students/search] Failed:', error) return NextResponse.json( { error: error instanceof Error ? error.message : 'Search failed' }, { status: 500 } ) } }, { role: 'admin' } ) |