No description
Find a file
Vadym Samoilenko 2fe3eb75c7 Implement 6-format banner spec, fix CTA colours, add custom sizes
- BannerPreview: 6 real formats (SM2/MD1/MD2/MD3/LG1/LG2) all 312px wide;
  white-pill CTA with theme-colour text (was inverted); navy bg #000063 per
  Barclays spec; link-style CTA for SM2/MD2/MD3; centred icon for LG1;
  photo layouts: photo-left (SM2/MD2), photo-right (MD3), photo-top (LG2)
- Custom size: POST /api/banner-sets/:id/custom-size creates Custom variants
  from each pair's LG copy at user-specified px dimensions; BannerEditor has
  +Custom size form with W×H inputs
- Format limits updated in copy_generation.py (SM2 no body, MD 32/64, LG 64/128)
- tasks.py _persist_banner_set generates all 6 standard formats per copy set
- Migration 0006 adds custom_width/custom_height columns to banner_variants
- VariantsGrid/ChatBrief canProceed uses SMALL/LARGE format sets (not "Medium"/"Large")
- tsc --noEmit clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 22:28:56 +01:00
.claude Implement 6-format banner spec, fix CTA colours, add custom sizes 2026-04-28 22:28:56 +01:00
apache Add full Sprint 0+1 implementation: Docker, FastAPI, React, RAG, deploy 2026-04-17 12:01:42 +01:00
assets/illustrations AC3 in-situ banner visualisation — Medium/Large model, icons, themes, BannerPreview 2026-04-28 20:30:43 +01:00
backend Implement 6-format banner spec, fix CTA colours, add custom sizes 2026-04-28 22:28:56 +01:00
deploy Fix Apache config: use <Location> for ProxyPass, FallbackResource for SPA 2026-04-17 12:53:11 +01:00
Design Assets/Illustrations Implement 6-format banner spec, fix CTA colours, add custom sizes 2026-04-28 22:28:56 +01:00
Display Banner - Prompts and RAG Implement 6-format banner spec, fix CTA colours, add custom sizes 2026-04-28 22:28:56 +01:00
frontend Implement 6-format banner spec, fix CTA colours, add custom sizes 2026-04-28 22:28:56 +01:00
rag-corpus Add full Sprint 0+1 implementation: Docker, FastAPI, React, RAG, deploy 2026-04-17 12:01:42 +01:00
.env.example Add full Sprint 0+1 implementation: Docker, FastAPI, React, RAG, deploy 2026-04-17 12:01:42 +01:00
.gitignore Add full Sprint 0+1 implementation: Docker, FastAPI, React, RAG, deploy 2026-04-17 12:01:42 +01:00
CLAUDE.md Add full Sprint 0+1 implementation: Docker, FastAPI, React, RAG, deploy 2026-04-17 12:01:42 +01:00
CopyGen BMB App Banner Visualiser Requirements.docx Implement 6-format banner spec, fix CTA colours, add custom sizes 2026-04-28 22:28:56 +01:00
deploy.sh Fix deploy.sh: target sites-enabled, not sites-available 2026-04-17 12:57:52 +01:00
docker-compose.prod.yml Mount rag-corpus/ into api and worker containers 2026-04-17 12:22:03 +01:00
docker-compose.yml Mount rag-corpus/ into api and worker containers 2026-04-17 12:22:03 +01:00
README.md Add README with setup, deploy, and project structure 2026-04-17 12:03:04 +01:00

Barclays BMB Banner Visualiser

AI-powered banner creation tool for Barclays Mobile Banking campaign managers.

Brief → compliant copy variants → DAM image + icon → in-situ preview → PDF contact sheet + Workfront CSV

Live: https://optical-dev.oliver.solutions/barclays-banner-builder/


Stack

Layer Tech
Frontend React 18 + Vite + TypeScript + TailwindCSS + shadcn/ui
Backend FastAPI (Python 3.12) + SQLAlchemy 2.0 async
Queue RQ + Redis (HTTP polling — no WebSocket)
DB PostgreSQL 16 + pgvector
AI OpenAI gpt-5.4-mini + text-embedding-3-small (RAG)
PDF WeasyPrint
Deploy Docker Compose + Apache reverse proxy

Quick start (dev)

cp .env.example .env
# Set OPENAI_API_KEY in .env

docker compose up -d --build
docker compose exec api alembic upgrade head
docker compose exec api python scripts/seed_admin.py
docker compose exec api python scripts/ingest_rag.py
docker compose exec api python scripts/index_icons.py

Deploy (Ubuntu + Apache)

# Clone once:
git clone <repo> /opt/barclays-banner-builder

# Every deploy (idempotent):
bash /opt/barclays-banner-builder/deploy.sh

# Options:
bash deploy.sh --reindex        # force re-embed RAG + icons
bash deploy.sh --skip-frontend  # backend-only update

The script handles: Docker build (with cache), DB migrations, first-run seeding, npm build, Apache config patching.


Key rules

  • No WebSocket — all async work uses POST → 202 + job_id → GET /api/jobs/{id} polling
  • OpenAI only — model gpt-5.4-mini, key in .env only (never committed)
  • System prompt editable from /admin — full version history kept for FCA audit
  • Character limits enforced server-side — short_title ≤ 32, long_body ≤ 128, cta ≤ 50
  • DAM mock mode — if ADOBE_DAM_API_BASE_URL is empty, mock client is used automatically

Project structure

backend/app/
  api/         — FastAPI routers
  models/      — SQLAlchemy models
  services/    — copy_generation, exporter, adobe_dam_client
  llm/         — OpenAI client wrapper
  rag/         — pgvector cosine retrieval
  workers/     — RQ tasks (generate_copy, render_pdf)
  prompts/     — system_prompt.md (initial seed)

frontend/src/
  pages/       — BriefEditor, VariantsGrid, BannerEditor, ExportPage, AdminPage, LoginPage
  lib/         — jobPolling.ts
  store/       — Zustand auth store

rag-corpus/    — Consumer Duty, Consumer Understanding, Regulators .docx
assets/        — illustrations/ (PNG icons) + templates/
deploy/        — apache-barclays.conf (Apache Include fragment)
scripts/       — index_icons.py, ingest_rag.py, seed_admin.py