Files
dobetternorge-tools/includes/layout.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

70 lines
2.8 KiB
PHP

<?php
declare(strict_types=1);
// Required vars: $toolName (string), $toolTitle (string), $toolKind (string), $toolBadge (string)
require_once __DIR__ . '/bootstrap.php';
if (!dbnToolsIsAuthenticated()) {
$return = urlencode($_SERVER['REQUEST_URI'] ?? '/');
header('Location: /?return=' . $return);
exit;
}
$navItems = [
'ask' => ['Ask', 'Source-grounded'],
'search' => ['Search', 'Legal sources'],
'deep-research' => ['Deep research', 'Agent + RAG'],
'summarize' => ['Summarize', 'Pasted text'],
'timeline' => ['Timeline', 'Events'],
'redact' => ['Redact', 'Privacy'],
'transcribe' => ['Transcribe', 'Audio'],
'corpus' => ['Corpus', 'Data & stack'],
];
$toolName = $toolName ?? 'ask';
$toolTitle = $toolTitle ?? 'Legal Tools';
$toolKind = $toolKind ?? '';
$toolBadge = $toolBadge ?? '';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= htmlspecialchars($toolTitle) ?> — Do Better Norge</title>
<link rel="stylesheet" href="assets/css/tools.css">
</head>
<body data-authenticated="true" data-active-tool="<?= htmlspecialchars($toolName) ?>">
<script>window.DBN_TOOLS_AUTHENTICATED = true;</script>
<main id="appShell" class="app-shell">
<header class="topbar">
<div>
<p class="eyebrow">Do Better Norge</p>
<h1>Legal Tools</h1>
</div>
<div class="topbar-actions">
<span id="healthPill" class="status-pill">Session active</span>
<button id="healthButton" class="secondary-button" type="button">Health</button>
</div>
</header>
<div class="disclaimer" role="note">
Legal information and preparation support, not final legal advice. Pasted text is processed in memory by default.
</div>
<section class="workspace" aria-label="Legal tools workspace">
<nav class="tool-rail" aria-label="Tools">
<?php foreach ($navItems as $slug => [$label, $sub]): ?>
<a href="<?= $slug ?>.php" class="tool-tab<?= $slug === $toolName ? ' is-active' : '' ?>" data-tool="<?= $slug ?>"<?= $slug === $toolName ? ' aria-current="page"' : '' ?>>
<span><?= $label ?></span>
<small><?= $sub ?></small>
</a>
<?php endforeach; ?>
</nav>
<section class="tool-panel" aria-labelledby="toolTitle">
<div class="tool-heading">
<div>
<p id="toolKind" class="eyebrow"><?= htmlspecialchars($toolKind) ?></p>
<h2 id="toolTitle"><?= htmlspecialchars($toolTitle) ?></h2>
</div>
<span id="toolBadge" class="tool-badge"><?= htmlspecialchars($toolBadge) ?></span>
</div>