Files
dobetternorge-tools/api/timeline.php
T
daveadmin d2f9831472 feat: Corpus Intelligence page + timeline background events
Adds /corpus.php — a data transparency page showing what powers the
legal tools: 9 coverage categories with live doc counts, a full
sources table pulled from the corpus DB, the AI stack (LLMs, Whisper,
Qdrant, Azure AI Search, embeddings, chunking), and a pipeline flow
diagram. Stats are live via a new /api/corpus-stats.php endpoint
(queries dobetter_rag + bnl_admin). The reasoning sidebar is repurposed
as a Corpus health panel on this page.

Also ships the in-progress timeline background events toggle:
API and UI wired together via include_background param.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 11:31:24 +02:00

30 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../includes/LegalTools.php';
dbnToolsRequireMethod('POST');
dbnToolsRequireAuth();
$input = dbnToolsJsonInput(400000);
$language = dbnToolsNormalizeLanguage($input['language'] ?? 'en');
dbnToolsWithTelemetry('timeline', $language, function () use ($input, $language): array {
$text = dbnToolsString($input, 'text', 128000);
$validEngines = ['azure_mini', 'azure_full', 'gpu'];
$engine = in_array((string)($input['engine'] ?? ''), $validEngines, true)
? (string)$input['engine'] : 'azure_mini';
$validFocus = ['all', 'deadlines', 'hearings', 'cps'];
$focus = in_array((string)($input['focus'] ?? ''), $validFocus, true)
? (string)$input['focus'] : 'all';
$confidenceFilter = (string)($input['confidence_filter'] ?? '') === 'high_medium'
? 'high_medium' : 'all';
$includeRelative = ($input['include_relative'] ?? true) !== false;
$includeBackground = ($input['include_background'] ?? true) !== false;
return (new DbnLegalToolsService())->timeline($text, $language, $engine, $focus, $confidenceFilter, $includeRelative, $includeBackground);
});