feat: align surgery API with schemas and extend client tooling

- Refactor app API and schemas; adjust surgery pipeline, repository, and session manager.

- Improve consumption TSV logging and consumable vision integration; trim voice resolution.

- Add Baidu Face 1:N search script, .env.example entries, and client API integration doc.

- Update demo client, staging checklist, surgery interface doc, and related tests; add sample face image.

Made-with: Cursor
This commit is contained in:
Kevin
2026-04-23 16:09:20 +08:00
parent 0c05463617
commit 69980d8073
20 changed files with 994 additions and 610 deletions

View File

@@ -11,7 +11,7 @@ from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
from app.config import Settings
from app.repositories.surgery_results import SurgeryResultRepository
from app.schemas import SurgeryConsumptionDetail
from app.schemas import SurgeryConsumptionStored
from app.services.surgery_pipeline import SurgeryPipeline
from app.services.video.session_manager import (
ArchivedSurgery,
@@ -53,10 +53,10 @@ async def test_stop_surgery_persists_final_result(
ts = datetime(2026, 4, 21, 12, 0, tzinfo=timezone.utc)
st = SurgerySessionState(candidate_consumables=["纱布"])
st.details.append(
SurgeryConsumptionDetail(
SurgeryConsumptionStored(
item_id="纱布",
item_name="纱布",
quantity=1,
qty=1,
doctor_id="vision",
timestamp=ts,
source="vision",
@@ -107,10 +107,10 @@ async def test_stop_surgery_failed_persist_goes_to_archive_then_retry_persists(
ts = datetime(2026, 4, 21, 12, 0, tzinfo=timezone.utc)
st = SurgerySessionState(candidate_consumables=[])
st.details.append(
SurgeryConsumptionDetail(
SurgeryConsumptionStored(
item_id="缝线",
item_name="缝线",
quantity=1,
qty=1,
doctor_id="vision",
timestamp=ts,
source="vision",
@@ -161,10 +161,10 @@ async def test_pipeline_prefers_live_then_db_then_archive(
ts = datetime(2026, 4, 21, 12, 0, tzinfo=timezone.utc)
st = SurgerySessionState(candidate_consumables=["纱布"])
st.details.append(
SurgeryConsumptionDetail(
SurgeryConsumptionStored(
item_id="纱布",
item_name="纱布",
quantity=1,
qty=1,
doctor_id="vision",
timestamp=ts,
source="vision",
@@ -188,10 +188,10 @@ async def test_pipeline_prefers_live_then_db_then_archive(
mgr._archive["333333"] = ArchivedSurgery(
details=[
SurgeryConsumptionDetail(
SurgeryConsumptionStored(
item_id="归档项",
item_name="归档项",
quantity=1,
qty=1,
doctor_id="vision",
timestamp=ts,
source="vision",