daveadmin
662fbf7d6d
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 >
2026-06-01 20:49:58 +02:00
daveadmin
b21bfb2f1d
Add NOK pricing catalog, credit ledger, success-based charging, and tier-gated model routing
...
- PricingCatalog.php: single source of truth for plans (free/plus/pro), top-ups,
Stripe price env keys, tool costs (0–6 credits), STT variable billing, feature limits
- FreeTier.php: monthly-first credit deduction, ledger (user_tool_credit_ledger),
STT reservation/settle/release, monthly reset, trial logic
- StripeClient.php: canonical SKUs (plus/pro/topup_100/300/1000), legacy aliases kept
- stripe-checkout.php: subscription vs payment mode, trial gating, catalog metadata
- stripe-webhook.php: idempotent via stripe_events, handles subscription lifecycle +
invoice.paid renewal + one-time topup credit grants
- All API tools: success-based credit deduction (check before, charge after)
- transcribe.php: file-size heuristic reservation, settle from actual provider duration
- ask.php + LegalTools.php: ToolModels engine resolution — Pro gets gpt-4o
- KorrespondAgent.php + korrespond.php: tier-gated draft deployment —
Free/Plus gets gpt-4o-mini, Pro gets gpt-4o
- pricing.php: NOK-only, plan cards, top-up packs, Organisation contact card,
tool cost table, separate monthly/prepaid balance display
- 003_pricing_credit_catalog.sql: ledger and STT reservation tables
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-24 13:42:27 +02:00
daveadmin
effd3289b4
feat: add Legal Translation tool (translate.php)
...
New dedicated tool for translating Norwegian legal documents (Barnevernet
letters, court decisions, correspondence) into the user's chosen language
with legal-terminology annotations.
- translate.php: new tool page with source/target language selectors,
4-way UI lang switcher, file upload, doc picker, streaming results
- api/translate.php: NDJSON streaming endpoint; Azure GPT-4o-mini with
legal-aware prompt that preserves Norwegian statute refs verbatim and
annotates terms with no target-language equivalent; 2-credit cost
- assets/js/translate.js: form handler, NDJSON stream reader, copy button
- assets/css/tools.css: .lt-* styles for translation result + annotations
- includes/i18n.php: 22 lt_* keys × 4 languages; translate entry in nav
- includes/FreeTier.php: translate → 2 credits
- includes/CaseResults.php + case-result.php: translate in eligible tools,
toolLabel, toolIcon, deriveTitle, rendering block, rerun map
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-24 09:59:06 +02:00