Phase 5: Full AI engine + caselaw seed data (23 FL cases)

fl_ai_engine.py: Complete Ollama integration with 7-step pipeline:
rule-based issue tagging, caselaw matching (3rd DCA-prioritized),
case context serialization, prompt construction, Ollama HTTP call
(llama3.1 at 192.168.2.10:11434), JSON parsing with fence-strip,
and fl.analysis persistence with attorney referral chatter alert.

fl_caselaw_data.xml: 23 seeded Florida cases covering modification
threshold (Daly, Regan, Pimm, El Kohen, Rolfe), income imputation
(Barner, Sitterson), self-employment (Smith, Young), timesharing
(Freid, Kennedy, Boykin), domestic violence (Conlin, Kahle),
default judgment (Lindsey, North), residency (Fults), parenting
class (Maddox), fee waiver (Abdool, Kielbania), disclosure,
withholding, above-schedule, and discovery sanctions.

fl_case.py: trigger_ai_analysis() wired to engine.analyze_case();
returns form popup of fl.analysis result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-04 23:39:41 -04:00
parent 7a7463a2d1
commit 7ce691a394
4 changed files with 899 additions and 29 deletions

View File

@@ -888,13 +888,24 @@ class FlCase(models.Model):
def trigger_ai_analysis(self):
"""
Trigger AI case analysis via Ollama.
Stub for Phase 1 — full implementation in Phase 5.
Trigger AI case analysis via Ollama (fl.ai.engine).
Phase 5 — full implementation.
"""
self.ensure_one()
engine = self.env['fl.ai.engine']
self.message_post(
body='🤖 AI analysis queued. Full AI analysis will be available in Phase 5.',
body='🤖 AI analysis started. This may take up to 3 minutes...',
subtype_xmlid='mail.mt_note',
)
analysis = engine.analyze_case(self.id)
return {
'type': 'ir.actions.act_window',
'name': 'AI Analysis Result',
'res_model': 'fl.analysis',
'res_id': analysis.id,
'view_mode': 'form',
'target': 'new',
}
# ══════════════════════════════════════════════════════════════════════
# ACTIONS