Multi-stage LLM pipeline that produces structured analyses of Autotask tickets from local Postgres. Migration 069 + Zod schemas, Stage 0 preprocessor, IT Glue redaction + search, Anthropic SDK wrapper, Stages 1/3/4 (Haiku/Sonnet/Opus), pipeline + cost circuit breaker, job worker (opt-in autostart), 6 API routes, 3 frontend pages, share-row persistence (email send deferred to phase 7). 128 vitest tests, tsc clean. Build journal in docs/wulf-pulse-ticket-analyzer-build-notes.md. Sync: adds syncTicketNotes() + ticket_notes to ordered/date-filtered entities so the analyzer's local mirror stays current via scheduler. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
851 B
TypeScript
25 lines
851 B
TypeScript
/**
|
|
* GET /api/analyzer/needs-review
|
|
*
|
|
* Returns the queue of completed analyses where needs_human_review = true.
|
|
* Optional query params: limit (default 50, max 200), offset (default 0).
|
|
*/
|
|
|
|
import { NextRequest, NextResponse } from 'next/server';
|
|
import { requireAuth } from '@/lib/auth-utils';
|
|
import { listNeedsReview } from '@/lib/services/analyzer/persistence';
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const { error } = await requireAuth();
|
|
if (error) return error;
|
|
|
|
const params = request.nextUrl.searchParams;
|
|
const limit = parseInt(params.get('limit') ?? '50', 10);
|
|
const offset = parseInt(params.get('offset') ?? '0', 10);
|
|
|
|
const analyses = await listNeedsReview({
|
|
limit: Number.isFinite(limit) ? limit : 50,
|
|
offset: Number.isFinite(offset) ? offset : 0,
|
|
});
|
|
return NextResponse.json({ analyses });
|
|
}
|