Add download button for analysis-and-research.md
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m22s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m22s
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) <noreply@anthropic.com>
This commit is contained in:
@@ -78,9 +78,24 @@ export default function ComposePage({
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<Button asChild variant="outline">
|
||||
<Link href={`/cases/${caseNumber}`}>חזרה לתיק</Link>
|
||||
</Button>
|
||||
<div className="flex items-center gap-2">
|
||||
{analysis.data && (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
const a = document.createElement("a");
|
||||
a.href = `/api/cases/${caseNumber}/research/analysis/download`;
|
||||
a.download = `analysis-${caseNumber}.md`;
|
||||
a.click();
|
||||
}}
|
||||
>
|
||||
הורד ניתוח
|
||||
</Button>
|
||||
)}
|
||||
<Button asChild variant="outline">
|
||||
<Link href={`/cases/${caseNumber}`}>חזרה לתיק</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-[2px] bg-gradient-to-l from-transparent via-gold to-transparent" />
|
||||
|
||||
13
web/app.py
13
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 = ""
|
||||
|
||||
Reference in New Issue
Block a user