Add My Docs picker to deep-research, advocate, barnevernet, korrespond, citations

- PHP: Add docPickerSection (button + chips + hidden input) to all 5 tool pages
- JS: Send doc_ids in payload for deep-research, advocate, barnevernet, korrespond
- Backend: Inject selected corpus doc content into paste_text/narrative/notes via dbnToolsInjectDocContent
- Citations: Add upload zone (file → api/extract.php → textarea) + paste textarea with live Norwegian legal reference extraction (regex) + ref chips → title search; doc picker populates titleInput via MutationObserver

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 13:04:45 +02:00
parent 88555eb8a7
commit bffc714541
13 changed files with 214 additions and 13 deletions
+4 -3
View File
@@ -80,6 +80,7 @@ try {
'clarifications' => is_array($input['clarifications'] ?? null) ? $input['clarifications'] : [],
'use_my_case' => !empty($input['use_my_case']),
];
$intake['narrative'] = dbnToolsInjectDocContent($input, $intake['narrative']);
$forceDraft = !empty($input['force_draft']);
$hasClarif = !empty($intake['clarifications']);
@@ -166,14 +167,14 @@ try {
$ftUid = dbnToolsFreeTierCheck('korrespond');
$ftRemaining = dbnToolsFreeTierDeduct($ftUid, 'korrespond');
$creditDeducted = true;
if ($ftRemaining >= 0) {
header('X-Credits-Remaining: ' . $ftRemaining);
}
// ── Pass 2: retrieve law → draft → self-check → translate ──────────────────
$result = $agent->generate($intake, $classify, $emit);
$result['ok'] = true;
$result['latency_ms'] = (int)round((microtime(true) - $startTime) * 1000);
if ($ftRemaining >= 0) {
$result['balance'] = $ftRemaining;
}
dbnToolsLogMetadata([
'tool' => 'korrespond',