28932297b3
Adds an optional textarea below the main text input where users can provide clarifications to guide the LLM — e.g. year anchors, actor aliases, or focus instructions. Notes are injected into the prompt as a clearly delimited block and translated across all four UI languages (en/no/uk/pl). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
1.4 KiB
PHP
34 lines
1.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../includes/LegalTools.php';
|
|
|
|
dbnToolsRequireMethod('POST');
|
|
dbnToolsRequireAuth();
|
|
$ftUid = dbnToolsFreeTierCheck('timeline');
|
|
$ftRemaining = dbnToolsFreeTierDeduct($ftUid, 'timeline');
|
|
if ($ftRemaining >= 0) { header('X-Credits-Remaining: ' . $ftRemaining); }
|
|
$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;
|
|
$userNotes = dbnToolsString($input, 'user_notes', 2000, false);
|
|
|
|
return (new DbnLegalToolsService())->timeline($text, $language, $engine, $focus, $confidenceFilter, $includeRelative, $includeBackground, $userNotes);
|
|
});
|