auto-save 2026-05-26 00:07 (+1, ~3)

This commit is contained in:
2026-05-26 00:07:48 +08:00
parent 830afac720
commit 089a30d970
4 changed files with 795 additions and 25 deletions

View File

@@ -28,6 +28,8 @@ from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse, JSONResponse, RedirectResponse
from pydantic import BaseModel, ConfigDict, Field
import db
load_dotenv()
JOBS_DIR = Path(os.getenv("JOBS_DIR", "./jobs")).resolve()
@@ -1285,7 +1287,9 @@ def job_with_artifacts(job: Job) -> Job:
def save_state(job: Job) -> None:
(job_dir(job.id) / "state.json").write_text(job.model_dump_json(indent=2))
state_path = job_dir(job.id) / "state.json"
state_path.write_text(job.model_dump_json(indent=2))
db.index_job(job.model_dump(), str(state_path))
def update(job: Job, **kw) -> None: