feat: Barnevernet Analyzer — document analysis + partisan RAG brief
7-step agent pipeline: document classification, party extraction, timeline extraction, corpus RAG (child_welfare/echr/family_core/bufdir_guidance), and synthesis using the user's chosen engine (including dbn-legal-agent). Progressive NDJSON streaming renders doc_meta, parties, and timeline cards before the final advocacy brief and procedural red flags arrive. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../includes/bootstrap.php';
|
||||
require_once __DIR__ . '/../includes/BvjAnalyzerAgent.php';
|
||||
|
||||
dbnToolsRequireMethod('POST');
|
||||
dbnToolsRequireAuth();
|
||||
|
||||
@ini_set('output_buffering', '0');
|
||||
@ini_set('zlib.output_compression', '0');
|
||||
@ini_set('implicit_flush', '1');
|
||||
while (ob_get_level() > 0) { @ob_end_clean(); }
|
||||
ob_implicit_flush(true);
|
||||
|
||||
header('Content-Type: application/x-ndjson; charset=utf-8');
|
||||
header('Cache-Control: no-store');
|
||||
header('X-Accel-Buffering: no');
|
||||
|
||||
$language = 'en';
|
||||
$startTime = microtime(true);
|
||||
|
||||
$emit = function (string $event, array $payload = []) use ($startTime): void {
|
||||
$payload['event'] = $event;
|
||||
$payload['t_ms'] = (int)round((microtime(true) - $startTime) * 1000);
|
||||
echo json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n";
|
||||
@flush();
|
||||
};
|
||||
|
||||
try {
|
||||
$isMultipart = stripos((string)($_SERVER['CONTENT_TYPE'] ?? ''), 'multipart/form-data') !== false;
|
||||
if ($isMultipart) {
|
||||
$payloadRaw = (string)($_POST['payload'] ?? '');
|
||||
if ($payloadRaw === '') {
|
||||
throw new DbnToolsHttpException('Multipart request missing payload.', 422, 'missing_payload');
|
||||
}
|
||||
$input = json_decode($payloadRaw, true);
|
||||
if (!is_array($input)) {
|
||||
throw new DbnToolsHttpException('Invalid payload JSON.', 422, 'invalid_payload_json');
|
||||
}
|
||||
} else {
|
||||
$raw = file_get_contents('php://input');
|
||||
if ($raw === false || strlen($raw) > 120000) {
|
||||
throw new DbnToolsHttpException('Request body unreadable or too large.', 413, 'body_too_large');
|
||||
}
|
||||
$input = json_decode((string)$raw, true);
|
||||
if (!is_array($input)) {
|
||||
throw new DbnToolsHttpException('Request body must be valid JSON.', 400, 'invalid_json');
|
||||
}
|
||||
}
|
||||
|
||||
$language = dbnToolsNormalizeLanguage($input['language'] ?? 'en');
|
||||
$advocateRole = trim((string)($input['advocate_role'] ?? ''));
|
||||
$engine = (string)($input['engine'] ?? 'azure_mini');
|
||||
$sliceInput = $input['slices'] ?? [];
|
||||
$controls = is_array($input['controls'] ?? null) ? $input['controls'] : [];
|
||||
$additionalNotes = mb_substr(trim((string)($input['additional_notes'] ?? '')), 0, 2000, 'UTF-8');
|
||||
|
||||
if (mb_strlen($advocateRole, 'UTF-8') > 200) {
|
||||
throw new DbnToolsHttpException('advocate_role is too long.', 422, 'advocate_role_too_long');
|
||||
}
|
||||
if (mb_strlen($additionalNotes, 'UTF-8') > 2000) {
|
||||
throw new DbnToolsHttpException('additional_notes is too long.', 422, 'notes_too_long');
|
||||
}
|
||||
|
||||
$emit('progress', ['detail' => 'Reading upload(s)…']);
|
||||
|
||||
$uploadedFiles = [];
|
||||
if (!empty($_FILES['files']) && is_array($_FILES['files']['tmp_name'] ?? null)) {
|
||||
$count = count($_FILES['files']['tmp_name']);
|
||||
if ($count > 5) {
|
||||
throw new DbnToolsHttpException('At most 5 files can be uploaded per request.', 413, 'too_many_files');
|
||||
}
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$file = [
|
||||
'name' => $_FILES['files']['name'][$i] ?? '',
|
||||
'type' => $_FILES['files']['type'][$i] ?? '',
|
||||
'tmp_name' => $_FILES['files']['tmp_name'][$i] ?? '',
|
||||
'error' => $_FILES['files']['error'][$i] ?? UPLOAD_ERR_NO_FILE,
|
||||
'size' => $_FILES['files']['size'][$i] ?? 0,
|
||||
];
|
||||
$extracted = dbnToolsExtractUploadedFile($file);
|
||||
$uploadedFiles[] = [
|
||||
'filename' => $extracted['filename'],
|
||||
'text' => $extracted['text'],
|
||||
'chars' => $extracted['chars'],
|
||||
'truncated' => $extracted['truncated'],
|
||||
];
|
||||
$emit('progress', [
|
||||
'detail' => sprintf('Extracted %s (%d chars%s)',
|
||||
$extracted['filename'],
|
||||
$extracted['chars'],
|
||||
!empty($extracted['truncated']) ? ', truncated' : ''
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($uploadedFiles)) {
|
||||
throw new DbnToolsHttpException(
|
||||
'Upload at least one BVJ document (PDF, DOCX, or TXT) before running the analyzer.',
|
||||
422, 'no_uploads'
|
||||
);
|
||||
}
|
||||
|
||||
$emit('start', [
|
||||
'engine' => $engine,
|
||||
'language' => $language,
|
||||
'file_count' => count($uploadedFiles),
|
||||
]);
|
||||
|
||||
$result = (new DbnBvjAnalyzerAgent())->run(
|
||||
$uploadedFiles,
|
||||
$advocateRole,
|
||||
$engine,
|
||||
$language,
|
||||
is_array($sliceInput) ? $sliceInput : [],
|
||||
$controls,
|
||||
$additionalNotes,
|
||||
$emit
|
||||
);
|
||||
|
||||
$result['ok'] = true;
|
||||
$result['latency_ms'] = (int)round((microtime(true) - $startTime) * 1000);
|
||||
|
||||
dbnToolsLogMetadata([
|
||||
'tool' => 'bvj_analyzer',
|
||||
'language' => $language,
|
||||
'ok' => true,
|
||||
'latency_ms' => $result['latency_ms'],
|
||||
'chunk_count' => (int)($result['trace_metadata']['chunk_count'] ?? 0),
|
||||
'source_count' => (int)($result['trace_metadata']['source_count'] ?? 0),
|
||||
'deployment' => $result['trace_metadata']['deployment'] ?? null,
|
||||
'advocate_role' => $advocateRole !== '' ? $advocateRole : null,
|
||||
'bvj_doc_type' => $result['doc_meta']['doc_type'] ?? null,
|
||||
]);
|
||||
|
||||
$emit('final', ['result' => $result]);
|
||||
|
||||
} catch (DbnToolsHttpException $e) {
|
||||
$latency = (int)round((microtime(true) - $startTime) * 1000);
|
||||
dbnToolsLogMetadata([
|
||||
'tool' => 'bvj_analyzer',
|
||||
'language' => $language,
|
||||
'ok' => false,
|
||||
'latency_ms' => $latency,
|
||||
'error_code' => $e->errorCode,
|
||||
]);
|
||||
$emit('error', ['code' => $e->errorCode, 'message' => $e->getMessage(), 'status' => $e->status]);
|
||||
} catch (Throwable $e) {
|
||||
error_log('DBN BVJ analyzer fatal: ' . $e->getMessage());
|
||||
$latency = (int)round((microtime(true) - $startTime) * 1000);
|
||||
dbnToolsLogMetadata([
|
||||
'tool' => 'bvj_analyzer',
|
||||
'language' => $language,
|
||||
'ok' => false,
|
||||
'latency_ms' => $latency,
|
||||
'error_code' => 'internal_error',
|
||||
]);
|
||||
$emit('error', ['code' => 'internal_error', 'message' => 'The analyzer could not complete this request.']);
|
||||
}
|
||||
@@ -3376,3 +3376,339 @@ a.dr-source-title-link:hover {
|
||||
color: var(--muted);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
BVJ Analyzer — document meta, parties, timeline, red flags
|
||||
============================================================ */
|
||||
|
||||
.bvj-doc-meta {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
padding: 16px 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.bvj-doc-meta__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.bvj-doc-meta__authority {
|
||||
font-weight: 700;
|
||||
color: var(--ink);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.bvj-doc-type-badge {
|
||||
display: inline-block;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
background: var(--soft-teal);
|
||||
color: var(--teal-dark);
|
||||
border: 1px solid #b2dbd6;
|
||||
border-radius: 20px;
|
||||
padding: 2px 10px;
|
||||
}
|
||||
|
||||
.bvj-doc-meta__fields {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 20px;
|
||||
}
|
||||
|
||||
.bvj-doc-meta__field {
|
||||
font-size: 0.84rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.bvj-doc-meta__field strong {
|
||||
color: var(--ink);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* --- Parties grid --- */
|
||||
|
||||
.bvj-parties-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.bvj-party-card {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
}
|
||||
|
||||
.bvj-party-card__name {
|
||||
font-weight: 700;
|
||||
font-size: 0.92rem;
|
||||
color: var(--ink);
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
.bvj-party-card__org {
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
margin: 0 0 6px;
|
||||
}
|
||||
|
||||
.bvj-party-card__rel {
|
||||
font-size: 0.8rem;
|
||||
font-style: italic;
|
||||
color: var(--muted);
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.bvj-party-role {
|
||||
display: inline-block;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.03em;
|
||||
border-radius: 20px;
|
||||
padding: 2px 9px;
|
||||
}
|
||||
|
||||
.bvj-party-role--bvv {
|
||||
background: #e8f0fe;
|
||||
color: #2d5fa6;
|
||||
border: 1px solid #c3d4f8;
|
||||
}
|
||||
|
||||
.bvj-party-role--parent {
|
||||
background: var(--soft-teal);
|
||||
color: var(--teal-dark);
|
||||
border: 1px solid #b2dbd6;
|
||||
}
|
||||
|
||||
.bvj-party-role--child {
|
||||
background: #ecfdf5;
|
||||
color: #166534;
|
||||
border: 1px solid #bbf7d0;
|
||||
}
|
||||
|
||||
.bvj-party-role--third {
|
||||
background: #f3f4f6;
|
||||
color: #4b5563;
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.bvj-party-role--other {
|
||||
background: #fafafa;
|
||||
color: var(--muted);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
|
||||
/* --- Timeline --- */
|
||||
|
||||
.bvj-timeline-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.bvj-timeline-event {
|
||||
display: grid;
|
||||
grid-template-columns: 130px 1fr;
|
||||
border-left: 3px solid var(--line);
|
||||
border-radius: 0 6px 6px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bvj-timeline-event--high { border-left-color: var(--coral); }
|
||||
.bvj-timeline-event--medium { border-left-color: var(--amber); }
|
||||
.bvj-timeline-event--low { border-left-color: var(--line); }
|
||||
|
||||
.bvj-timeline-date {
|
||||
font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
|
||||
font-size: 0.78rem;
|
||||
color: var(--muted);
|
||||
background: #f3f4f6;
|
||||
border-right: 1px solid var(--line);
|
||||
padding: 10px 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.bvj-timeline-time {
|
||||
font-size: 0.72rem;
|
||||
color: var(--muted);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.bvj-timeline-body {
|
||||
background: var(--panel);
|
||||
padding: 10px 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.bvj-timeline-actor {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
color: var(--teal-dark);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.bvj-timeline-action {
|
||||
font-size: 0.88rem;
|
||||
color: var(--ink);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* --- Red flags --- */
|
||||
|
||||
.bvj-red-flags {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.bvj-red-flag {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.bvj-red-flag--high { border-left: 3px solid var(--coral); }
|
||||
.bvj-red-flag--medium { border-left: 3px solid var(--amber); }
|
||||
.bvj-red-flag--low { border-left: 3px solid var(--line); }
|
||||
|
||||
.bvj-red-flag__head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.bvj-red-flag__desc {
|
||||
font-weight: 700;
|
||||
font-size: 0.9rem;
|
||||
color: var(--ink);
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.bvj-red-flag__legal {
|
||||
display: inline-block;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
background: var(--soft-teal);
|
||||
color: var(--teal-dark);
|
||||
border: 1px solid #b2dbd6;
|
||||
border-radius: 20px;
|
||||
padding: 2px 9px;
|
||||
white-space: nowrap;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.bvj-red-flag__details {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.bvj-red-flag__details summary {
|
||||
font-size: 0.8rem;
|
||||
color: var(--teal);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.bvj-red-flag__check {
|
||||
font-size: 0.84rem;
|
||||
font-style: italic;
|
||||
color: var(--muted);
|
||||
margin: 6px 0 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* --- Severity badges --- */
|
||||
|
||||
.bvj-severity {
|
||||
display: inline-block;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
border-radius: 20px;
|
||||
padding: 2px 9px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.bvj-severity-high {
|
||||
background: var(--soft-coral);
|
||||
color: var(--coral);
|
||||
border: 1px solid #f9c6ae;
|
||||
}
|
||||
|
||||
.bvj-severity-medium {
|
||||
background: #fffbeb;
|
||||
color: var(--amber);
|
||||
border: 1px solid #fde68a;
|
||||
}
|
||||
|
||||
.bvj-severity-low {
|
||||
background: #f3f4f6;
|
||||
color: var(--muted);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
|
||||
/* --- BVJ result banner (role + doc type header) --- */
|
||||
|
||||
.bvj-banner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 16px;
|
||||
background: var(--soft-teal);
|
||||
border: 1px solid #b2dbd6;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.bvj-banner__label {
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.bvj-banner__role {
|
||||
font-size: 0.88rem;
|
||||
font-weight: 700;
|
||||
color: var(--teal-dark);
|
||||
}
|
||||
|
||||
/* --- [DOC] citation inline marker --- */
|
||||
|
||||
.dr-cite--doc {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
background: #e8f0fe;
|
||||
color: #2d5fa6;
|
||||
border: 1px solid #c3d4f8;
|
||||
border-radius: 4px;
|
||||
padding: 1px 5px;
|
||||
margin: 0 1px;
|
||||
cursor: default;
|
||||
vertical-align: baseline;
|
||||
position: relative;
|
||||
top: -1px;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+227
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
$toolName = 'barnevernet';
|
||||
$toolTitle = 'BVJ Analyzer';
|
||||
$toolKind = 'Barnevernet document';
|
||||
$toolBadge = 'Document + RAG';
|
||||
$extraScripts = ['assets/js/barnevernet.js'];
|
||||
require_once __DIR__ . '/includes/layout.php';
|
||||
?>
|
||||
<form id="bvjForm" class="tool-form deep-research" enctype="multipart/form-data">
|
||||
|
||||
<div class="lang-switcher" id="bvjLangSwitcher" role="group" aria-label="UI language">
|
||||
<button type="button" class="lang-btn is-active" data-lang="en">🇬🇧 EN</button>
|
||||
<button type="button" class="lang-btn" data-lang="no">🇳🇴 NO</button>
|
||||
</div>
|
||||
|
||||
<!-- Role selector -->
|
||||
<div class="adv-role-row">
|
||||
<label class="control-label" for="bvjRoleSelect">Who are you representing?</label>
|
||||
<select id="bvjRoleSelect" class="adv-role-select" required>
|
||||
<option value="">— Select a role —</option>
|
||||
<option value="Biological mother">Biological mother</option>
|
||||
<option value="Biological father">Biological father</option>
|
||||
<option value="Both biological parents">Both biological parents</option>
|
||||
<option value="Foster carer / long-term placement">Foster carer / long-term placement</option>
|
||||
<option value="Adoptive parent">Adoptive parent</option>
|
||||
<option value="Child (via representative)">Child (via representative)</option>
|
||||
<option value="Extended family (grandparent, sibling, aunt/uncle)">Extended family (grandparent, sibling, aunt/uncle)</option>
|
||||
<option value="Child welfare services (Barnevernet)">Child welfare services (Barnevernet)</option>
|
||||
<option value="__other__">Other — describe below</option>
|
||||
</select>
|
||||
<input type="text" id="bvjRoleCustom" class="adv-role-custom is-hidden"
|
||||
placeholder="Describe the party you represent…" maxlength="200">
|
||||
<p class="upload-hint">The agent will analyse the document from <em>your</em> perspective — identifying supporting statutes, procedural red flags, and ECHR arguments for your position.</p>
|
||||
</div>
|
||||
|
||||
<div class="control-row" id="bvjEngineControl">
|
||||
<span class="control-label">Engine</span>
|
||||
<label><input type="radio" name="bvjEngine" value="azure_mini" checked> Azure gpt-4o-mini ★ <small class="control-hint">(~30-60s)</small></label>
|
||||
<label><input type="radio" name="bvjEngine" value="azure_full"> Azure gpt-4o <small class="control-hint">(best · ~90-180s)</small></label>
|
||||
<label><input type="radio" name="bvjEngine" value="gpu"> GPU (cuttlefish) <small class="control-hint">(local · ~45-90s)</small></label>
|
||||
<label><input type="radio" name="bvjEngine" value="dbn_legal"> 🇳🇴 Norwegian specialist <small class="control-hint">(dbn-legal-agent · ~60-120s)</small></label>
|
||||
</div>
|
||||
<p class="upload-hint">Engine applies to the final advocacy synthesis only. Document classification, party extraction, and timeline are always fast (azure-mini). Norwegian specialist is best for Barnevernloven, ECHR Article 8, and Bufdir analysis.</p>
|
||||
|
||||
<div class="dr-slice-section">
|
||||
<p class="control-label">Corpus slices</p>
|
||||
<p class="upload-hint">Child Welfare, ECHR, Family Law Core, and Bufdir Guidance are on by default — these cover the core Barnevernet legal framework. Enable Norwegian Courts for case law.</p>
|
||||
<div class="dr-slice-grid">
|
||||
<button type="button" class="adv-slice is-on" data-slice="child_welfare" aria-pressed="true">
|
||||
<div class="dr-slice__head">
|
||||
<span class="dr-slice__title">Child Welfare</span>
|
||||
<span class="dr-slice__badge">on</span>
|
||||
</div>
|
||||
<p class="dr-slice__tagline">Barnevern, omsorgsovertakelse, foster care</p>
|
||||
</button>
|
||||
<button type="button" class="adv-slice is-on" data-slice="echr" aria-pressed="true">
|
||||
<div class="dr-slice__head">
|
||||
<span class="dr-slice__title">ECHR</span>
|
||||
<span class="dr-slice__badge">on</span>
|
||||
</div>
|
||||
<p class="dr-slice__tagline">Art. 8 family life, Art. 9 religion, HUDOC vs Norway</p>
|
||||
</button>
|
||||
<button type="button" class="adv-slice is-on" data-slice="family_core" aria-pressed="true">
|
||||
<div class="dr-slice__head">
|
||||
<span class="dr-slice__title">Family Law Core</span>
|
||||
<span class="dr-slice__badge">on</span>
|
||||
</div>
|
||||
<p class="dr-slice__tagline">Barneloven, custody, samvær, mediation</p>
|
||||
</button>
|
||||
<button type="button" class="adv-slice is-on" data-slice="bufdir_guidance" aria-pressed="true">
|
||||
<div class="dr-slice__head">
|
||||
<span class="dr-slice__title">Bufdir Guidance</span>
|
||||
<span class="dr-slice__badge">on</span>
|
||||
</div>
|
||||
<p class="dr-slice__tagline">Bufdir, Barneombudet, Statsforvalteren guidance</p>
|
||||
</button>
|
||||
<button type="button" class="adv-slice" data-slice="norwegian_courts" aria-pressed="false">
|
||||
<div class="dr-slice__head">
|
||||
<span class="dr-slice__title">Norwegian Courts</span>
|
||||
<span class="dr-slice__badge">off</span>
|
||||
</div>
|
||||
<p class="dr-slice__tagline">Høyesterett + Lagmannsrett family decisions</p>
|
||||
</button>
|
||||
<button type="button" class="adv-slice" data-slice="hague" aria-pressed="false">
|
||||
<div class="dr-slice__head">
|
||||
<span class="dr-slice__title">Hague Convention</span>
|
||||
<span class="dr-slice__badge">off</span>
|
||||
</div>
|
||||
<p class="dr-slice__tagline">INCADAT, cross-border abduction, wrongful removal</p>
|
||||
</button>
|
||||
<button type="button" class="adv-slice" data-slice="broader_legal" aria-pressed="false">
|
||||
<div class="dr-slice__head">
|
||||
<span class="dr-slice__title">Broader Legal Support</span>
|
||||
<span class="dr-slice__badge">off</span>
|
||||
</div>
|
||||
<p class="dr-slice__tagline">Arbeidsmiljøloven, NOUer, statutes, government background</p>
|
||||
</button>
|
||||
<button type="button" class="adv-slice" data-slice="dbn_resources" aria-pressed="false">
|
||||
<div class="dr-slice__head">
|
||||
<span class="dr-slice__title">DBN Resources</span>
|
||||
<span class="dr-slice__badge">off</span>
|
||||
</div>
|
||||
<p class="dr-slice__tagline">Do Better Norge guides, flashcards, resource directory</p>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<details class="advanced-panel" id="bvjAdvanced">
|
||||
<summary class="advanced-toggle">Advanced controls</summary>
|
||||
<div class="dr-control-grid">
|
||||
<div class="dr-control-card">
|
||||
<label>Sub-questions <span id="bvjSubQValue" class="dr-control-value">4</span></label>
|
||||
<input type="range" id="bvjSubQ" min="3" max="5" step="1" value="4">
|
||||
<small>Legal angles generated to search the corpus (each supports your position).</small>
|
||||
</div>
|
||||
<div class="dr-control-card">
|
||||
<label>Chunks / sub-Q <span id="bvjChunkLimitValue" class="dr-control-value">6</span></label>
|
||||
<input type="range" id="bvjChunkLimit" min="4" max="10" step="1" value="6">
|
||||
<small>Corpus chunks retrieved per sub-question.</small>
|
||||
</div>
|
||||
<div class="dr-control-card">
|
||||
<label>Similarity floor <span id="bvjSimValue" class="dr-control-value">0.30</span></label>
|
||||
<input type="range" id="bvjSim" min="0.20" max="0.60" step="0.05" value="0.30">
|
||||
<small>Minimum similarity for upload chunks to be included.</small>
|
||||
</div>
|
||||
<div class="dr-control-card">
|
||||
<label>Sources kept <span id="bvjTopKValue" class="dr-control-value">12</span></label>
|
||||
<input type="range" id="bvjTopK" min="8" max="14" step="1" value="12">
|
||||
<small>Top sources kept after dedupe + rerank for synthesis.</small>
|
||||
</div>
|
||||
<div class="dr-control-card">
|
||||
<label>Temperature <span id="bvjTempValue" class="dr-control-value">0.15</span></label>
|
||||
<input type="range" id="bvjTemp" min="0.05" max="0.40" step="0.05" value="0.15">
|
||||
<small>Keep low for grounded legal analysis.</small>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<!-- File upload (required) -->
|
||||
<div class="upload-zone" id="bvjUploadZone" role="region" aria-label="File upload">
|
||||
<input type="file" id="bvjUploadInput" multiple accept=".pdf,.docx,.txt" aria-label="Choose BVJ document files">
|
||||
<div id="bvjUploadPrompt" class="upload-prompt">
|
||||
<span class="upload-icon" aria-hidden="true">⇧</span>
|
||||
<p>Drop BVJ document(s) here, or <label for="bvjUploadInput" class="upload-browse">browse</label></p>
|
||||
<p class="upload-hint"><strong>At least 1 file required.</strong> <strong>PDF</strong>, <strong>DOCX</strong>, <strong>TXT</strong> — up to 5 files — processed in memory only, never stored.</p>
|
||||
</div>
|
||||
<div id="bvjUploadFileInfo" class="upload-file is-hidden">
|
||||
<ul id="bvjUploadFileList" class="upload-file-list"></ul>
|
||||
<button type="button" id="bvjUploadClear" class="upload-clear">× Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Branch panel -->
|
||||
<div id="bvjBranchPanel" class="branch-panel is-hidden" aria-label="Branch context">
|
||||
<div class="branch-panel__head">
|
||||
<span class="branch-panel__label">Branching from sub-question</span>
|
||||
<button type="button" id="bvjBranchClear" class="upload-clear">× Clear branch</button>
|
||||
</div>
|
||||
<p id="bvjBranchOrigin" class="branch-panel__origin"></p>
|
||||
<details class="branch-panel__prior">
|
||||
<summary>Prior analysis summary</summary>
|
||||
<div id="bvjBranchSummary" class="branch-panel__brief"></div>
|
||||
</details>
|
||||
<label class="input-label" for="bvjBranchNotes">Add your notes / context</label>
|
||||
<textarea id="bvjBranchNotes" rows="3" placeholder="Optional: add observations, corrections, or additional context for this branch…"></textarea>
|
||||
</div>
|
||||
|
||||
<label class="input-label" for="bvjNotes">Additional case context <span class="optional-hint">(optional)</span></label>
|
||||
<textarea id="bvjNotes" name="bvjNotes" rows="4" placeholder="Add context about specific aspects of the case you want the agent to focus on, or clarify any information in the document. The document itself is the primary input."></textarea>
|
||||
|
||||
<div class="form-footer">
|
||||
<p id="bvjStatus" class="form-status" role="status" aria-live="polite"></p>
|
||||
<button id="bvjRunButton" type="submit">Analyse document</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<section id="bvjResults" class="results deep-research-results" aria-live="polite">
|
||||
<div class="empty-state">
|
||||
<h3>Ready</h3>
|
||||
<p>Upload a Barnevernet document (bekymringsmelding, vedtak, rapport), select who you represent, and run. The agent will extract the timeline and parties, search the legal corpus, and produce a partisan advocacy brief with procedural red flags.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Source modal -->
|
||||
<div id="bvjSourceModal" class="dr-source-modal is-hidden" role="dialog" aria-modal="true" aria-labelledby="bvjSourceModalTitle">
|
||||
<div class="dr-source-modal__dialog">
|
||||
<header class="dr-source-modal__head">
|
||||
<div>
|
||||
<p class="eyebrow" id="bvjSourceModalEyebrow">Source</p>
|
||||
<h3 id="bvjSourceModalTitle"></h3>
|
||||
</div>
|
||||
<button type="button" id="bvjSourceModalClose" class="upload-clear" aria-label="Close">×</button>
|
||||
</header>
|
||||
<div class="dr-source-modal__body">
|
||||
<aside class="dr-source-modal__meta" id="bvjSourceModalMeta"></aside>
|
||||
<div class="dr-source-modal__text" id="bvjSourceModalText"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Hidden stubs so tools.js element refs don't crash on this page -->
|
||||
<div class="is-hidden" id="languageControl" aria-hidden="true"><input type="radio" name="language" value="en" checked></div>
|
||||
<div class="is-hidden" id="redactionControl" aria-hidden="true"></div>
|
||||
<div class="is-hidden" id="audioZone" aria-hidden="true">
|
||||
<input type="file" id="audioInput" style="display:none">
|
||||
<div id="audioPrompt"></div>
|
||||
<div id="audioFileInfo"><ol id="audioQueueList"></ol><button type="button" id="audioClear"></button></div>
|
||||
</div>
|
||||
<div class="is-hidden" id="diarizeControl" aria-hidden="true">
|
||||
<input type="checkbox" id="diarizeCheck">
|
||||
<input type="number" id="numSpeakersInput">
|
||||
</div>
|
||||
<div class="is-hidden" id="transcribeLangControl" aria-hidden="true"><input type="radio" name="transcribeLang" value="no" checked></div>
|
||||
<div class="is-hidden" id="vocabControl" aria-hidden="true">
|
||||
<div id="vocabPresets"></div>
|
||||
<textarea id="initPromptInput"></textarea>
|
||||
</div>
|
||||
<div class="is-hidden" id="aliasSection" aria-hidden="true">
|
||||
<button type="button" id="addAliasRow"></button>
|
||||
<div id="aliasRows"></div>
|
||||
</div>
|
||||
<div class="is-hidden" id="exemptSection" aria-hidden="true">
|
||||
<button type="button" id="addExemptRow"></button>
|
||||
<div id="exemptRows"></div>
|
||||
</div>
|
||||
<?php require_once __DIR__ . '/includes/layout_footer.php'; ?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,7 @@ $navItems = [
|
||||
'search' => ['Search', 'Legal sources'],
|
||||
'deep-research' => ['Deep research', 'Agent + RAG'],
|
||||
'advocate' => ['Advocate', 'Take a side'],
|
||||
'barnevernet' => ['BVJ Analyzer', 'Document'],
|
||||
'summarize' => ['Summarize', 'Pasted text'],
|
||||
'timeline' => ['Timeline', 'Events'],
|
||||
'redact' => ['Redact', 'Privacy'],
|
||||
|
||||
Reference in New Issue
Block a user