From 7b7323661e111bf3344bf6fe6d64596519ffff83 Mon Sep 17 00:00:00 2001 From: marian Date: Wed, 13 May 2026 14:49:04 +0000 Subject: [PATCH] feat(preview): print link alongside qr code Previously the preview URL was only printed when QR rendering failed. Print it unconditionally above the QR so users can copy-paste the link without scanning. Co-Authored-By: RapidPoseidon --- src/rapidata/rapidata_client/config/_qr_preview.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/rapidata/rapidata_client/config/_qr_preview.py b/src/rapidata/rapidata_client/config/_qr_preview.py index ac4c321fd..3abbc25fd 100644 --- a/src/rapidata/rapidata_client/config/_qr_preview.py +++ b/src/rapidata/rapidata_client/config/_qr_preview.py @@ -31,11 +31,11 @@ def build_campaign_preview_url(environment: str, campaign_id: str) -> str: def print_campaign_preview_qr(environment: str, campaign_id: str) -> None: - """Print a terminal QR code that links to the campaign preview page. + """Print the preview URL and a terminal QR code linking to it. - Respects ``rapidata_config.logging.silent_mode``. If QR rendering fails for - any reason we still surface the preview URL via ``managed_print`` so the - user can open it manually. + Respects ``rapidata_config.logging.silent_mode``. The URL is always + printed so the user can copy-paste it; the QR code below is a convenience + for opening on a phone. If QR rendering fails the URL stays visible. Args: environment: The Rapidata environment (e.g. ``rapidata.ai``). @@ -47,6 +47,7 @@ def print_campaign_preview_qr(environment: str, campaign_id: str) -> None: return url = build_campaign_preview_url(environment, campaign_id) + managed_print(f"Preview at: {url}") try: import qrcode @@ -60,7 +61,6 @@ def print_campaign_preview_qr(environment: str, campaign_id: str) -> None: qr.add_data(url) qr.make(fit=True) - managed_print(f"Preview:") qr.print_ascii(invert=True) except Exception: logger.warning( @@ -68,7 +68,6 @@ def print_campaign_preview_qr(environment: str, campaign_id: str) -> None: url, exc_info=True, ) - managed_print(f"Preview at: {url}") def _resolve_campaign_id_from_pipeline(