math-solver / app /ocr_text_merge.py
Cuong2004
Deploy API from GitHub Actions
395651c
raw
history blame contribute delete
451 Bytes
"""Helpers for OCR preview combined draft (no Pydantic email deps)."""
from __future__ import annotations
from typing import Optional
def build_combined_ocr_preview_draft(user_message: Optional[str], ocr_text: str) -> str:
"""Merge user caption and OCR text for confirm step (user message first, then OCR)."""
u = (user_message or "").strip()
o = (ocr_text or "").strip()
if u and o:
return f"{u}\n\n{o}"
return u or o