diff --git a/mcp-server/src/legal_mcp/services/argument_aggregator.py b/mcp-server/src/legal_mcp/services/argument_aggregator.py index 3a39fc8..7f5838d 100644 --- a/mcp-server/src/legal_mcp/services/argument_aggregator.py +++ b/mcp-server/src/legal_mcp/services/argument_aggregator.py @@ -335,18 +335,30 @@ async def get_legal_arguments( case_id, ) - # Pull supporting claim ids for each argument in one round-trip. + # Pull supporting claims (id + full text) for each argument in one + # round-trip. ``supporting_claims`` stays id-only for backwards compat + # (counts, MCP consumers); ``supporting_propositions`` carries the text + # so the UI can show the raw propositions without an extra fetch. arg_ids = [r["id"] for r in rows] supporting: dict[UUID, list[str]] = {} + propositions: dict[UUID, list[dict]] = {} if arg_ids: joins = await conn.fetch( - """SELECT argument_id, claim_id - FROM legal_argument_propositions - WHERE argument_id = ANY($1::uuid[])""", + """SELECT lap.argument_id, lap.claim_id, + c.claim_text, c.source_document, c.claim_index + FROM legal_argument_propositions lap + JOIN claims c ON c.id = lap.claim_id + WHERE lap.argument_id = ANY($1::uuid[]) + ORDER BY c.claim_index""", arg_ids, ) for j in joins: supporting.setdefault(j["argument_id"], []).append(str(j["claim_id"])) + propositions.setdefault(j["argument_id"], []).append({ + "id": str(j["claim_id"]), + "text": j["claim_text"], + "source_document": j["source_document"], + }) out: list[dict] = [] for r in rows: @@ -354,5 +366,6 @@ async def get_legal_arguments( d["id"] = str(d["id"]) d["case_id"] = str(d["case_id"]) d["supporting_claims"] = supporting.get(r["id"], []) + d["supporting_propositions"] = propositions.get(r["id"], []) out.append(d) return out diff --git a/web-ui/src/components/cases/legal-arguments-panel.tsx b/web-ui/src/components/cases/legal-arguments-panel.tsx index 5783d76..e2ee746 100644 --- a/web-ui/src/components/cases/legal-arguments-panel.tsx +++ b/web-ui/src/components/cases/legal-arguments-panel.tsx @@ -10,6 +10,11 @@ import { import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; import { Skeleton } from "@/components/ui/skeleton"; import { PARTY_LABELS_HE, @@ -22,7 +27,7 @@ import { type LegalArgumentPriority, } from "@/lib/api/legal-arguments"; import { toast } from "sonner"; -import { Loader2, RefreshCw, Sparkles } from "lucide-react"; +import { ListTree, Loader2, RefreshCw, Sparkles } from "lucide-react"; const PRIORITY_BADGE_TONE: Record = { threshold: "bg-danger-bg/60 text-danger-strong border-danger/40", @@ -102,12 +107,55 @@ function PartySection({ party, args }: PartySectionProps) {

{arg.argument_body}

- {arg.supporting_claims.length > 0 && ( -

- מסתמך על {arg.supporting_claims.length} פרופוזיציות - גולמיות. -

- )} + {arg.supporting_claims.length > 0 && + (arg.supporting_propositions && + arg.supporting_propositions.length > 0 ? ( + + + + + +

+ הטענות הגולמיות שמהן אוגד הטיעון: +

+
    + {arg.supporting_propositions.map((p, i) => ( +
  1. + + {i + 1}. + {" "} + + {p.text} + + {p.source_document && ( + + מקור: {p.source_document} + + )} +
  2. + ))} +
+
+
+ ) : ( +

+ מסתמך על {arg.supporting_claims.length} פרופוזיציות + גולמיות. +

+ ))} diff --git a/web-ui/src/lib/api/legal-arguments.ts b/web-ui/src/lib/api/legal-arguments.ts index 5e43c86..50f3813 100644 --- a/web-ui/src/lib/api/legal-arguments.ts +++ b/web-ui/src/lib/api/legal-arguments.ts @@ -22,6 +22,12 @@ export type LegalArgumentPriority = | "procedural" | "relief"; +export type SupportingProposition = { + id: string; + text: string; + source_document: string | null; +}; + export type LegalArgument = { id: string; case_id: string; @@ -35,6 +41,8 @@ export type LegalArgument = { created_at?: string; updated_at?: string; supporting_claims: string[]; + /** Raw extracted propositions (id + full text) backing this argument. */ + supporting_propositions?: SupportingProposition[]; }; export type LegalArgumentsResponse = {