Add monetization spine + Build Your Own Case (Min Sak)
- Stripe: StripeClient.php, checkout/portal/webhook endpoints, idempotent event handling - FreeTier: tier-aware credits (free/light/pro/pro_plus), bonus_balance, hourly caps per tier - pricing.php + billing.php: 4-tier cards, 3 topups, Customer Portal, balance breakdown - Min Sak: CaseStore.php, AzureDocIntelligence.php, AzureSearchAdmin.php — per-user hybrid RAG - api/case/: upload, list, delete, ingest-callback (HMAC-auth'd from n8n) - award-survey-credits: inter-site HMAC endpoint for dobetternorge.no survey bonus - dashboard.php: tier badge, balance breakdown card, Min Sak CTA, survey CTA - KorrespondAgent + all 3 other agents: use_my_case toggle wired to dbnToolsCaseContext() - bootstrap.php: dbnToolsCaseContext(), dbnToolsIntersiteSecret(), dbnToolsCurrentTier() Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -921,14 +921,18 @@ PROMPT;
|
||||
$opts = ['json' => true, 'temperature' => $temperature, 'max_tokens' => 4500, 'timeout' => 240];
|
||||
|
||||
$deployLabel = match ($engine) {
|
||||
'gpu' => 'GPU (cuttlefish)',
|
||||
'azure_full' => 'gpt-4o',
|
||||
default => $this->azure->chatDeployment(),
|
||||
'gpu' => 'GPU (cuttlefish)',
|
||||
'dbn_legal_v3' => 'dbn-legal-agent-v3',
|
||||
'azure_full' => 'gpt-4o',
|
||||
default => $this->azure->chatDeployment(),
|
||||
};
|
||||
|
||||
$raw = '';
|
||||
try {
|
||||
if ($engine === 'gpu') {
|
||||
if ($engine === 'dbn_legal_v3') {
|
||||
$response = dbnToolsCallGpuLlm($messages, array_merge($opts, ['model' => 'dbn-legal-agent-v3', 'timeout' => 180]));
|
||||
$raw = (string)($response['choices'][0]['message']['content'] ?? '');
|
||||
} elseif ($engine === 'gpu') {
|
||||
$response = dbnToolsCallGpuLlm($messages, $opts);
|
||||
$raw = (string)($response['choices'][0]['message']['content'] ?? '');
|
||||
} elseif ($engine === 'azure_full') {
|
||||
@@ -953,10 +957,9 @@ PROMPT;
|
||||
];
|
||||
}
|
||||
|
||||
// Step 6b: dbn-legal-agent targeted legal Q&A check (azure engines only; silent on failure)
|
||||
// Asks one focused question about the document's statutory basis to surface domain knowledge
|
||||
// that Azure reliably misses (klar nødvendighet threshold, Strand Lobben, fvl §17/§41).
|
||||
if (in_array($engine, ['azure_mini', 'azure_full'], true)) {
|
||||
// Step 6b: dbn-legal-agent targeted legal Q&A check (azure + gpu engines only;
|
||||
// skipped when dbn_legal_v3 is the synthesis engine — it already IS the legal model).
|
||||
if (in_array($engine, ['azure_mini', 'azure_full', 'gpu'], true)) {
|
||||
$checkFindings = dbnToolsRunLegalCheck(
|
||||
(string)($json['advocacy_brief'] ?? ''),
|
||||
$docType
|
||||
@@ -968,7 +971,7 @@ PROMPT;
|
||||
foreach ($checkFindings as $cf) {
|
||||
$json['procedural_red_flags'][] = $cf;
|
||||
}
|
||||
$json['check_model'] = 'dbn-legal-agent-v2';
|
||||
$json['check_model'] = 'dbn-legal-agent-v3';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user