Files
ra-h-os/app/api/evals/comment/route.ts
T
“BeeRad”andClaude Opus 4.5 2f2ef10ec9 sync: bug fixes + eval system from private repo
- Fix chunk_status: pass chunk_status/chunk/metadata to context builder
- Fix vector search: scope by node_id BEFORE similarity search
- Add eval logging system (RAH_EVALS_LOG=1)
- Add eval dashboard at /evals
- Add vitest for testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:09:25 +11:00

25 lines
968 B
TypeScript

import { NextRequest } from 'next/server';
import { upsertEvalComment } from '@/services/evals/evalsStore';
export async function POST(request: NextRequest) {
const evalsEnabled = process.env.RAH_EVALS_LOG === '1' || process.env.RAH_EVALS_LOG === 'true';
if (process.env.NODE_ENV === 'production' || !evalsEnabled) {
return new Response('Not Found', { status: 404 });
}
const body = await request.json();
const traceId = typeof body?.traceId === 'string' ? body.traceId : null;
const scenarioId = typeof body?.scenarioId === 'string' ? body.scenarioId : null;
const comment = typeof body?.comment === 'string' ? body.comment : null;
if (!traceId || comment === null) {
return new Response(JSON.stringify({ error: 'Invalid payload' }), { status: 400 });
}
upsertEvalComment(traceId, scenarioId, comment);
return new Response(JSON.stringify({ ok: true }), {
status: 200,
headers: { 'Content-Type': 'application/json' },
});
}