Add _get_project_files classmethod that queries ProjectFileModel for
file_type=="upload" records, and wire it into _to_dict replacing the
hardcoded empty list.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ProjectManager._to_dict now scans simulation state files to find
last_simulation_id and last_report_id for each project
- HistoryDatabase: report button enabled when last_report_id or
last_simulation_id available; goToReport looks up report by
simulation ID if no direct report_id; report status icon reflects
availability
- Add getReportBySimulation() to frontend report API
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unused `import io`
- Avoid double-encoding in save_extracted_text by caching encoded bytes
- Delegate _to_dict queries to get_ontology/get_latest_graph_external_id
- Add comment to save_ontology noting full versioning is planned for F2-3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add `from ..config import Config` import
- Convert `_to_dict` from @staticmethod to @classmethod; it now opens a
fresh session to populate `ontology` and `graph_id` from OntologyModel
and GraphModel respectively
- Use `db.expunge(proj)` before closing sessions in create_project,
get_project and list_projects so `_to_dict` can open its own session
without nesting conflicts (SQLite StaticPool safe)
- Add five new classmethods: save_ontology, get_ontology,
save_graph_record, get_latest_graph_external_id, complete_graph_record
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace file-based JSON persistence with SQLAlchemy DB (ProjectModel/ProjectFileModel)
and StorageService for file content; remove Project dataclass; add 7 passing tests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Translate all Chinese comments, docstrings, log messages, error messages,
and LLM prompt text to English across the entire backend codebase.
Locale translation files (locales/*.json) are unchanged.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>