Image capturing Flow updates

This commit is contained in:
sriram
2026-09-24 17:18:38 +05:30
parent f933ea10a1
commit fe208f4715
14 changed files with 1877 additions and 6 deletions

View File

@@ -313,11 +313,48 @@ class IdentifyOut(ImageSearchOut):
"image_vector" with no `fallback_reason`; otherwise `fallback_reason`
says why the best effort shown is unconfirmed (see product_identify.py).
"""
matched_by: str = "none" # "image_vector" | "text" | "none"
matched_by: str = "none" # "image_vector" | "text" | "label_exact"
# | "discovery_pending" | "none"
ocr_text: Optional[str] = None # the label text the ladder used
ocr_source: Optional[str] = None # "client" | "server"
image_top_score: Optional[float] = None
fallback_reason: Optional[str] = None
# Capture-to-catalog (ENABLE_CAPTURE_DISCOVERY). All None when the answer
# was confirmed or the feature is off. See app/services/capture_discovery.py.
discovery_status: Optional[str] = None # "pending" | "exists" | "needs_input" | "busy"
discovery_job_id: Optional[str] = None # poll GET /api/search/identify/jobs/{id}
discovery_message: Optional[str] = None # one line to show the colleague
provisional: Optional["ProvisionalProductOut"] = None
class ProvisionalProductOut(BaseModel):
"""What the label says, before the pipeline has run. Not a catalog row."""
brand: str
product_name: str
size: Optional[str] = None
category: Optional[str] = None
hsn_code: Optional[str] = None
gst_percent: Optional[float] = None
hsn_gst_needs_review: Optional[bool] = None
visible_in_search: bool = True # False: brand is not in ACTIVE_BRANDS
source: str = "label"
class CaptureJobOut(BaseModel):
"""GET /search/identify/jobs/{job_id}: one capture-to-catalog job."""
job_id: str
status: str # queued | running | done | rejected | failed | interrupted
created_at: float
updated_at: float
provisional: ProvisionalProductOut
product: Optional[ProductOut] = None # the stored row, once done
image_id: Optional[str] = None
disposition: Optional[str] = None # inserted | backfilled | unchanged
validation_status: Optional[str] = None
retail_presence: Optional[dict] = None
photo_used_as_image: bool = False
detail: Optional[str] = None
warnings: List[str] = Field(default_factory=list)
# ---------------------------------------------------------------------------