From fdbf22c699d4de258ec145e438e29f7d038f03b8 Mon Sep 17 00:00:00 2001
From: Chaim
Date: Mon, 13 Apr 2026 19:08:07 +0000
Subject: [PATCH] Add download button for analysis-and-research.md
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
New GET /api/cases/{n}/research/analysis/download endpoint returns the
raw markdown file. UI adds a "הורד ניתוח" button next to "חזרה לתיק"
on the compose page, visible only when analysis data is loaded.
Co-Authored-By: Claude Opus 4.6 (1M context)
---
.../app/cases/[caseNumber]/compose/page.tsx | 21 ++++++++++++++++---
web/app.py | 13 ++++++++++++
2 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/web-ui/src/app/cases/[caseNumber]/compose/page.tsx b/web-ui/src/app/cases/[caseNumber]/compose/page.tsx
index aa62477..aed02e5 100644
--- a/web-ui/src/app/cases/[caseNumber]/compose/page.tsx
+++ b/web-ui/src/app/cases/[caseNumber]/compose/page.tsx
@@ -78,9 +78,24 @@ export default function ComposePage({
)}
-
+
+ {analysis.data && (
+
+ )}
+
+
diff --git a/web/app.py b/web/app.py
index 5a93fb2..fd2bfd1 100644
--- a/web/app.py
+++ b/web/app.py
@@ -1620,6 +1620,19 @@ async def api_research_analysis(case_number: str):
raise HTTPException(500, f"שגיאה בעיבוד הקובץ: {e}")
+@app.get("/api/cases/{case_number}/research/analysis/download")
+async def api_research_analysis_download(case_number: str):
+ """Download the raw analysis-and-research.md file."""
+ path = _research_file_path(case_number)
+ if not path.exists():
+ raise HTTPException(404, "טרם בוצע ניתוח משפטי לתיק זה")
+ return FileResponse(
+ path,
+ media_type="text/markdown; charset=utf-8",
+ filename=f"analysis-{case_number}.md",
+ )
+
+
class ChairPositionRequest(BaseModel):
section_id: str
position: str = ""