feat(tools): persona-driven multi-domain corpus + model routing
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>
This commit is contained in:
+12
-2
@@ -70,12 +70,22 @@ try {
|
||||
$sourceName = dbnToolsLanguageName($sourceLang);
|
||||
$targetName = dbnToolsLanguageName($targetLang);
|
||||
|
||||
// Persona-aware domain framing (default = Norwegian family law for back-compat).
|
||||
$client = dbnToolsRequireClient();
|
||||
$personaSlug = (isset($input['profile']) && is_string($input['profile']) && trim($input['profile']) !== '')
|
||||
? trim($input['profile'])
|
||||
: null;
|
||||
$persona = dbnToolsResolvePersona((int)$client['id'], $personaSlug);
|
||||
$domainLabel = (isset($persona['name']) && is_string($persona['name']) && trim($persona['name']) !== '' && ($persona['source'] ?? '') === 'chat_profile')
|
||||
? trim($persona['name'])
|
||||
: 'Norwegian family law, ECHR, and child-welfare proceedings';
|
||||
|
||||
$docTypeHint = $docType !== 'auto'
|
||||
? "The document is of type: {$docType}. Apply appropriate Norwegian family-law terminology for this context."
|
||||
? "The document is of type: {$docType}. Apply appropriate {$domainLabel} terminology for this context."
|
||||
: '';
|
||||
|
||||
$systemPrompt = <<<PROMPT
|
||||
You are a professional legal translator specialising in Norwegian family law, ECHR, and child-welfare proceedings.
|
||||
You are a professional legal translator specialising in {$domainLabel}.
|
||||
|
||||
Task: Translate the provided text from {$sourceName} into {$targetName}.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user