ba9cddf9a1
- Stripe: StripeClient.php, checkout/portal/webhook endpoints, idempotent event handling - FreeTier: tier-aware credits (free/light/pro/pro_plus), bonus_balance, hourly caps per tier - pricing.php + billing.php: 4-tier cards, 3 topups, Customer Portal, balance breakdown - Min Sak: CaseStore.php, AzureDocIntelligence.php, AzureSearchAdmin.php — per-user hybrid RAG - api/case/: upload, list, delete, ingest-callback (HMAC-auth'd from n8n) - award-survey-credits: inter-site HMAC endpoint for dobetternorge.no survey bonus - dashboard.php: tier badge, balance breakdown card, Min Sak CTA, survey CTA - KorrespondAgent + all 3 other agents: use_my_case toggle wired to dbnToolsCaseContext() - bootstrap.php: dbnToolsCaseContext(), dbnToolsIntersiteSecret(), dbnToolsCurrentTier() Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
235 lines
17 KiB
PHP
235 lines
17 KiB
PHP
<?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>
|
|
<button type="button" class="lang-btn" data-lang="uk">🇺🇦 UK</button>
|
|
<button type="button" class="lang-btn" data-lang="pl">🇵🇱 PL</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 qwen2.5:14b <small class="control-hint">(local · ~45-90s)</small></label>
|
|
<label><input type="radio" name="bvjEngine" value="dbn_legal_v3"> 🇳🇴 Norwegian specialist v3 ★ <small class="control-hint">(dbn-legal-agent-v3 · ~20-60s)</small></label>
|
|
</div>
|
|
<p class="upload-hint">Engine applies to the final advocacy synthesis only. Norwegian specialist v3 is the recommended choice for Barnevernet documents — it is fine-tuned on § 4-25, Strand Lobben, forvaltningsloven § 17/§ 41, and procedural red-flag detection. Classification, party extraction, and timeline always use azure-mini.</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>
|
|
<input type="radio" name="language" value="no">
|
|
<input type="radio" name="language" value="uk">
|
|
<input type="radio" name="language" value="pl">
|
|
</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'; ?>
|