V3 step 1 update models.py and step 2 implement service/worker, and raw API response persistence

This commit is contained in:
Jim Lancaster
2026-08-08 18:08:04 -05:00
parent 5a741de0a9
commit 4dac9349c1
22 changed files with 373 additions and 51 deletions
+4 -1
View File
@@ -95,16 +95,18 @@ async def seed_job(app_client: tuple[FastAPI, TestClient]) -> Callable[..., Awai
retry_count=0,
provider="openrouter",
model="google/gemini-2.5-flash",
prompt_name="transcribe_document.md",
)
session.add(job)
await session.flush()
source = Source(
document_id=document.id,
page_number=1,
upload_name=filename,
filename=filename,
file_path=str(stored_path),
file_hash="b" * 64,
file_size_bytes=len(stored_path.read_bytes()),
)
session.add(source)
await session.flush()
@@ -119,6 +121,7 @@ async def seed_job(app_client: tuple[FastAPI, TestClient]) -> Callable[..., Awai
if transcription_text is not None
else JobSourceStatus.FAILED
),
prompt_name="transcribe_document.md",
raw_transcription=transcription_text,
error_detail=error_detail,
)
+2
View File
@@ -146,6 +146,8 @@ class TestDocumentsPageRendering:
upload_name="page_1.png",
filename="page_1.png",
file_path="/tmp/page_1.png",
file_hash="0" * 64,
file_size_bytes=1,
)
session.add(source)
await session.commit()
+10
View File
@@ -23,6 +23,8 @@ class TestSourceModelProperties:
upload_name="page_one.png",
filename="stored_page_one.png",
file_path="/tmp/stored_page_one.png",
file_hash="b" * 64,
file_size_bytes=1,
)
assert source.latest_job_source is None
@@ -86,6 +88,8 @@ class TestSourcesPageRendering:
upload_name="page_one.png",
filename="stored_page_one.png",
file_path="/tmp/stored_page_one.png",
file_hash="c" * 64,
file_size_bytes=1,
)
)
await session.commit()
@@ -114,6 +118,8 @@ class TestSourcesPageRendering:
upload_name="target_page.png",
filename="target_stored.png",
file_path="/tmp/target_stored.png",
file_hash="d" * 64,
file_size_bytes=1,
),
Source(
document_id=other.id,
@@ -121,6 +127,8 @@ class TestSourcesPageRendering:
upload_name="other_page.png",
filename="other_stored.png",
file_path="/tmp/other_stored.png",
file_hash="e" * 64,
file_size_bytes=1,
),
]
)
@@ -240,6 +248,8 @@ class TestSourcesPageRendering:
upload_name="orphan-source.png",
filename="orphan-source.png",
file_path="/tmp/orphan-source.png",
file_hash="f" * 64,
file_size_bytes=1,
)
session.add(source)
await session.commit()