auto-save 2026-05-13 12:40 (~4)
This commit is contained in:
22
api/main.py
22
api/main.py
@@ -1087,6 +1087,28 @@ def get_cleaned_frame(job_id: str, idx: int):
|
||||
return FileResponse(p, media_type="image/jpeg")
|
||||
|
||||
|
||||
@app.delete("/jobs/{job_id}/frames/{idx}/cleanup", response_model=Job)
|
||||
def discard_cleaned(job_id: str, idx: int) -> Job:
|
||||
"""丢弃待应用的清洗版(不影响已应用的)"""
|
||||
job = JOBS.get(job_id)
|
||||
if not job:
|
||||
raise HTTPException(404, "job not found")
|
||||
frame = next((f for f in job.frames if f.index == idx), None)
|
||||
if not frame:
|
||||
raise HTTPException(404, "frame not found")
|
||||
p = job_dir(job_id) / "cleaned" / f"{idx:03d}.jpg"
|
||||
if p.exists():
|
||||
try: p.unlink()
|
||||
except OSError: pass
|
||||
new_frames = []
|
||||
for f in job.frames:
|
||||
if f.index == idx:
|
||||
f.cleaned_url = None
|
||||
new_frames.append(f)
|
||||
update(job, frames=new_frames, message=f"丢弃清洗版 · 分镜 {idx + 1}")
|
||||
return job
|
||||
|
||||
|
||||
@app.post("/jobs/{job_id}/frames/{idx}/cleanup/apply", response_model=Job)
|
||||
def apply_cleaned(job_id: str, idx: int) -> Job:
|
||||
"""用清洗版替换原关键帧:物理覆盖 frames/{idx}.jpg ← cleaned/{idx}.jpg。
|
||||
|
||||
Reference in New Issue
Block a user