No description
Find a file
Vadym Samoilenko 7e82a535a9 Add conversational brief interface (AC1 chat-style)
Replaces the one-shot form with a Copygen-style chat at
/conversations/:id. Each turn is classified as generate / refine /
clarify by a lightweight LLM intent router; generate and refine intents
enqueue an RQ job that produces a new BannerSet, while clarify returns
an inline reply without touching banners.

New backend:
- Conversation + ConversationMessage models + migration 0005
- intent_router service (chat_structured, 3-intent schema)
- chat_turn RQ task with _persist_banner_set helper extracted from
  _generate_copy_async for reuse
- /api/conversations CRUD + POST /messages endpoint
- JobType.CHAT_TURN added

New frontend:
- ChatBrief page: message bubbles, inline BannerPreview cards with
  checkbox selection and "Open banner editor" CTA (same Medium+Large
  validation rule as VariantsGrid)
- ConversationLanding: /conversations/new creates and redirects
- conversationId added to journey store
- "New Brief" nav now points to /conversations/new
- Default route redirects to /conversations/new

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 21:53:17 +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 Add conversational brief interface (AC1 chat-style) 2026-04-28 21:53:17 +01:00
deploy Fix Apache config: use <Location> for ProxyPass, FallbackResource for SPA 2026-04-17 12:53:11 +01:00
frontend Add conversational brief interface (AC1 chat-style) 2026-04-28 21:53:17 +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
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