feat(tools): add letter length + summary depth controls; harden korrespond §-discipline

- Summarize: new depth param (brief/standard/detailed) with depth-aware prompt
  instructions and coverage mandate; wired through API + JS
- Korrespond: new letter length param (concise/standard/detailed) injected as
  Lengde: instruction in draft pass; wired through API + JS
- Korrespond draft prompt: add §-discipline rule (cite only directly relevant §§)
  plus Opphevet guard (aligned with dobetterlegal-tools)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 13:44:02 +02:00
parent 8b99ceec3b
commit 3f7d4eef13
8 changed files with 61 additions and 9 deletions
+3 -1
View File
@@ -11,6 +11,8 @@ $ftUid = dbnToolsFreeTierCheck('summarize');
$input = dbnToolsJsonInput(400000);
$language = dbnToolsNormalizeLanguage($input['language'] ?? 'en');
$engine = ToolModels::engineForUser($ftUid, (string)($input['engine'] ?? 'azure_mini'));
$depth = in_array($input['depth'] ?? '', ['brief', 'standard', 'detailed'], true)
? (string)$input['depth'] : 'standard';
$slices = is_array($input['slices'] ?? null) ? array_values(array_filter($input['slices'])) : [];
// Streaming headers — flush each NDJSON line as it's written
@@ -68,7 +70,7 @@ try {
'detail' => 'Generating summary…',
]);
$result = (new DbnLegalToolsService())->summarizeWithContext($text, $language, $engine, $corpusContext);
$result = (new DbnLegalToolsService())->summarizeWithContext($text, $language, $engine, $corpusContext, $depth);
if ($ftUid > 0) {
$balance = dbnToolsFreeTierDeduct($ftUid, 'summarize');