662fbf7d6d
Generalize the family-locked legal tools into caveauAI persona profiles (client 57 chat profiles, resolved in-process via the chat_profiles bridge). Each tool accepts an optional `profile` slug that scopes the corpus package(s), search method, system prompt and synthesis model; omitting it falls back to the family-legal package so existing behaviour is unchanged. - dbnToolsResolvePersona / dbnToolsListPersonas / dbnToolsBootChatProfiles in bootstrap.php; new api/personas.php + dbn.list_personas MCP tool. - LegalTools search/ask/corpusContextForSummarize and the BvjAnalyzer / LegalAnalysis / translate paths take the persona's packages + prompt + model. - Persona <select> on ask/search/summarize (populated from api/personas.php). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
28 lines
1.2 KiB
PHP
28 lines
1.2 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../includes/LegalTools.php';
|
|
|
|
dbnToolsRequireMethod('POST');
|
|
dbnToolsRequireAuth();
|
|
$input = dbnToolsJsonInput(12000);
|
|
$language = dbnToolsNormalizeLanguage($input['language'] ?? 'en');
|
|
|
|
dbnToolsWithTelemetry('search', $language, function () use ($input, $language): array {
|
|
$query = dbnToolsString($input, 'query', 2000);
|
|
$limit = max(1, min(10, (int)($input['limit'] ?? 6)));
|
|
$temporalMode = in_array($input['temporal_mode'] ?? '', ['legal_conservative', 'disabled'], true)
|
|
? $input['temporal_mode']
|
|
: 'disabled';
|
|
$asOfDate = isset($input['as_of_date']) && preg_match('/^\d{4}(-\d{2}(-\d{2})?)?$/', $input['as_of_date'])
|
|
? $input['as_of_date']
|
|
: null;
|
|
$scope = in_array($input['corpus_scope'] ?? '', ['shared', 'private', 'both'], true)
|
|
? $input['corpus_scope']
|
|
: 'both';
|
|
$persona = (isset($input['profile']) && is_string($input['profile']) && trim($input['profile']) !== '')
|
|
? trim($input['profile'])
|
|
: null;
|
|
return (new DbnLegalToolsService())->search($query, $language, $limit, $temporalMode, $asOfDate, $scope, $persona);
|
|
});
|