feat(style-acq T6+T13): פנקס-התאמה + מדד מרחק-סגנון ב-UI

ה"איך מנהלים/רואים את הלמידה": טאב "למידה" ב-/training.

- app.py: GET /api/learning/pairs (פנקס-ההתאמה — כל ההחלטות + סטטוס draft↔final,
  INV-LRN4) + GET /api/learning/style-distance/{case} (מדד T7).
- web-ui: learning.ts hooks + LearningPanel (טבלת פנקס; לחיצה על תיק →
  מדד מרחק-הסגנון: שינוי draft→final, סטיית יחסי-זהב, אנטי-דפוסים) + טאב ב-/training.

מכסה גם את T6 (רשימת כל ההחלטות הנסגרות מול הסופי). ללא endpoint-schema חדש
לטיפוסים מחוללים (טיפוסים ידניים). G9, INV-LRN4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 19:13:10 +00:00
parent e4fbda6c1f
commit ee76455a9a
4 changed files with 221 additions and 0 deletions

View File

@@ -4116,6 +4116,41 @@ async def api_reset_methodology(category: str, key: str):
return {"key": key, "value": _METHODOLOGY_DEFAULTS[category][key], "is_override": False}
# ── Style-acquisition learning surface (T6/T13) ────────────────────
@app.get("/api/learning/pairs")
async def api_learning_pairs(status: str = "", limit: int = 200):
"""פנקס-ההתאמה (INV-LRN4) — כל ההחלטות וסטטוס ההשוואה מול הסופי.
status אופציונלי: final_received / analyzed / lessons_folded."""
rows = await db.list_draft_final_pairs(status=status or None, limit=limit)
items = []
for r in rows:
ds = r.get("diff_stats")
if isinstance(ds, str):
try:
ds = json.loads(ds)
except (json.JSONDecodeError, TypeError):
ds = None
items.append({
"id": str(r["id"]),
"case_id": str(r["case_id"]) if r.get("case_id") else None,
"case_number": r.get("case_number") or "",
"title": r.get("title") or "",
"status": r.get("status") or "",
"change_percent": (ds or {}).get("change_percent") if ds else None,
"created_at": r["created_at"].isoformat() if r.get("created_at") else None,
"updated_at": r["updated_at"].isoformat() if r.get("updated_at") else None,
})
return {"items": items, "count": len(items)}
@app.get("/api/learning/style-distance/{case_number}")
async def api_learning_style_distance(case_number: str):
"""מדד מרחק-סגנון (T7) לתיק — האם הטיוטה מתכנסת לדפנה."""
from legal_mcp.services import style_distance as _sd
return await _sd.style_distance(case_number)
# ── Skill Management API ───────────────────────────────────────────