Commit graph

61 commits

Author SHA1 Message Date
michael
f3d7f9b6d3 Fix retry reprocessing all proofs instead of just the failed one
DB-loaded proofs don't have a tempId, so the retry handler's
proof.tempId === tempId check matched all DB proofs (both undefined).
Now the handler uses a matchProof helper that checks both tempId and
_id, and call sites pass proof.tempId || proof._id as the identifier.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:15:09 -06:00
michael
a15bce8796 Add clickable error modal for failed proof analyses
When a proof analysis fails, "Analysis failed." is now a clickable
underlined link that opens a modal showing:
- The lead agent summary explaining why the analysis failed
- Details for each agent that returned an Error status

Applied to both Campaigns and Projects views.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:09:15 -06:00
michael
de62fa1f87 Show partial parse status in UI when some pages fail
- LlamaParse service now returns a ParseResult dataclass with markdown,
  total page count, and a list of failed pages (page number + error)
- Knowledge base service sets status to "partial" (instead of "parsed")
  when some pages failed, with a descriptive error listing which pages
  failed and why
- Frontend StatusBadge shows "partial parse" in orange for partial status
- Error details are shown inline below the document row for both partial
  and error statuses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 17:51:52 -06:00
michael
919e8185fa Add confirmation dialog before deleting source documents
Prevents accidental deletion of knowledge base source documents by
prompting the user to confirm before proceeding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 16:28:25 -06:00
michael
3aa99144d4 Stop job polling on error (404) to prevent infinite poll loop
When the poll request fails (e.g. job not found 404), clear the activeJob
state and stop the interval instead of endlessly retrying. Also refresh
the KB detail to get the current state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 16:08:21 -06:00
michael
42bf5ad003 Fix stuck processing state: auto-fail stale jobs, improve active job detection
- Frontend: only treat parsing_documents/distilling as actively running;
  pending jobs older than 2 minutes are ignored as stale
- Backend: add fail_stale_jobs() that marks pending/active jobs older than
  5 minutes as failed before checking for active jobs in trigger_processing
- Prevents UI from getting stuck on old jobs that never completed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 16:03:25 -06:00
michael
9e2473c3e9 Add Knowledge Base management system for AI agent specs
Full-stack implementation enabling UI-driven management of the 5 AI agent knowledge bases
(Legal, Brand Barclays, Brand Barclaycard, Channel Best Practices, Channel Tech Specs).

Backend:
- 4 new DB models: KnowledgeBase, SourceDocument, SpecVersion, ProcessingJob
- Migration 006: creates tables, seeds 5 KB rows, imports existing prompts/*.md as v1 specs
- KnowledgeBaseRepository with full CRUD for all 4 tables
- LlamaParseService for document parsing, KnowledgeBaseService for pipeline orchestration
- ReferenceDocsService updated with DB-backed spec loading + cache invalidation
- 11 REST endpoints under /api/knowledge-base (list, detail, upload, delete, process, job status, versions, diff, activate)
- StorageService extended with KB document storage

Frontend:
- TypeScript types for all KB entities (KnowledgeBaseListItem, SourceDocument, ProcessingJob, SpecVersion, DiffResult)
- ApiService methods for all KB endpoints including multipart file upload
- KnowledgeBase component with 3-level UI: agent grid, detail view (documents + versions tabs), diff viewer
- Drag-and-drop file upload, processing progress bar with 3s polling, version comparison
- KnowledgeBaseIcon + Sidebar nav item with adminOnly filtering

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-12 15:00:36 -06:00
michael
2b2d82ecec Fix Resolutions tab Proof Name to use blue link styling
Change from plain black text (font-medium text-black-title) to blue
link styling (font-semibold text-active-blue), matching the Flags and
Errors tabs for visual consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 14:09:19 -06:00
michael
220a97ab57 Wire up Errors tab in Auditing: auto-create ErrorItem on Analysis Error
- Create ErrorItem record when proof analysis results in "Analysis Error" status
- Add submitter_name/submitter_agency fields to ErrorItemResponse schema
- Eager-load proof creator and agency in error items query to avoid N+1
- Populate submitter fields from proof creator in the API route
- Update frontend ErrorItemResponse type and conversion to map submitter fields
- Fix ErrorsTable proof name styling to blue link (text-active-blue) matching Flags tab

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 13:55:16 -06:00
michael
9ec892b46b Fix flagging feature: blue link in Auditing, remove alert popup, show solid red flag icon
- Style Proof Name column in Auditing Flags tab as blue clickable link
- Replace browser alert() with in-app success message in flag modal that auto-closes after 2s
- Add filled prop to FlagIcon for solid red variant when flagged
- Thread flaggedItems from App → Campaigns → ProofDetailView → FeedbackReport
- Show solid red flag icon on SubReviewCard and LeadAgentSummary when agent has been flagged

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 13:46:15 -06:00
michael
33c2ce5cf4 Remove unused [Beta] tab from Settings page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 12:07:12 -06:00
michael
cf29d70908 Hide Users tab in Settings since it's not connected to the app
The Settings > Users tab is a disconnected prototype that stores data
only in localStorage and is not used by any other part of the application.
Backend user management is handled separately via Azure AD auto-provisioning.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 11:40:41 -06:00
michael
a67236af73 Remove 'View Documentation' button from Hero section
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 11:33:15 -06:00
michael
adc7a2cc71 Update CampaignDetailView table text color from black to primary blue
Change all proof table body cells in the CampaignDetailView (analyzing,
error, and completed states) from text-black-title to text-primary-blue
to match the campaign list table styling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 16:59:22 -06:00
michael
325221610f UI overhaul: white backgrounds, flat design, teal hero, sidebar flush-left nav
- Add teal-brand (#01A1A2) color to Tailwind config
- Hero: white bg, teal text, remove gradient circles/noise overlay, font-semibold
- Sidebar: stacked logo, lime COMPLIANCE AI, flush-left active items, remove blue dots
- ChecksOverview: remove gradient background and decorative blurs
- Campaigns: white bg, primary-blue table text, font-semibold headings
- Analytics: white bg, borderless shadow cards, sentence case headings
- Auditing: white bg, font-semibold heading
- Settings: white bg, remove tab container styling, flat cards, sentence case Proof types
- Profile: white bg, flat layout, active-blue question button, design system colors
- All page titles changed from font-bold to font-semibold

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 16:53:03 -06:00
michael
ebf92a91c7 Replace 'asset' with 'proof' in user-facing UI text
Update all user-visible strings across the frontend to use "proof/proofs"
terminology instead of "asset/assets". This includes button labels, headers,
tooltips, confirmation messages, and mock feedback text. Internal code
(variable names, types, HTML IDs) remains unchanged.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:45:48 -06:00
michael
35918dd310 Replace low-quality icons on Analytics page with Heroicons
- TrendingUpIcon: Changed to chart-bar icon for Pass Rate
- BugIcon: Changed to x-circle icon for Failed Reviews
- LightbulbIcon: Changed to proper light-bulb icon for Key Insight

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:30:18 -06:00
michael
b83a2a219f Adjust status pill padding: 0 top, 13px bottom
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:21:24 -06:00
michael
98633534ef Remove debug border and set bottom padding to 20px
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:18:47 -06:00
michael
24150ab221 Adjust padding to 2px top / 6px bottom to raise text
More bottom padding pushes text upward in the badge.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:16:49 -06:00
michael
ed040efac0 Add blue border to status badge to verify deployment
Testing if changes are being picked up correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:15:25 -06:00
michael
8ba0f01e20 Use table/table-cell display for reliable vertical centering
Wrap text in nested spans using display: inline-table on outer
and display: table-cell with vertical-align: middle on inner.
This is a classic centering technique that html2canvas should handle.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:09:14 -06:00
michael
bfee60399c Try fixed height with matching line-height for vertical centering
Use height: 24px with line-height: 24px and no vertical padding.
This forces text to center vertically within the fixed height container.
Added box-sizing: border-box and vertical-align: middle for reliability.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:07:25 -06:00
michael
e071576765 Adjust padding to raise text in status pills (3px top / 5px bottom)
Text was sitting too low, reducing top padding and increasing bottom
to push text upward for visual centering.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:05:27 -06:00
michael
e68aab0d03 Correct padding direction - more top padding to push text down
Text was sitting too high, so need 5px top / 4px bottom to push
the text downward for visual centering.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:03:31 -06:00
michael
8dc3ef34b0 Fix PDF status pill vertical centering with asymmetric padding
Use 4px top / 5px bottom padding to compensate for Arial font metrics
where the visual center differs from mathematical center. The extra
bottom padding pushes the text up to appear visually centered.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 15:03:15 -06:00
michael
1799902448 Fix PDF status pill text centering for html2canvas
Replace flexbox-based centering (inline-flex, alignItems, justifyContent)
with explicit height + line-height matching (22px) for reliable rendering
in html2canvas. Flexbox properties don't render consistently when
converting HTML to canvas.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 14:54:48 -06:00
michael
c7228c95a2 Apply UI audit fixes for Barclays design guidelines compliance
- Update font config to prioritize Barclays Effra with Inter fallback
- Add "powered by OLIVER" text to sidebar branding
- Fix sidebar user profile button border radius to consistent 10px
- Update Hero "View Documentation" button to Active Blue outline style
- Remove legacy color definitions from Tailwind config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 14:27:51 -06:00
michael
7698bbbd5a Apply Barclays brand colors to Projects.tsx and fix Sidebar corner radius
Updates Projects.tsx to use Barclays design system colors throughout:
- StatusBadge: bg-warning/bg-success/bg-warning-light/bg-grey-100
- OverallStatusBadge: bg-success/bg-error/bg-grey-300
- Tables: bg-lime headers, bg-grey-300 borders, even:bg-grey-100 rows
- Buttons: rounded-full pill shape, border-2 outlines
- Forms: rounded-[10px], text-black-title labels
- Hover states: hover:bg-info-light for row selection
- Delete modal: rounded-[10px], bg-error delete button

Updates Sidebar.tsx nav buttons from rounded-xl to rounded-[10px] per spec.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 14:19:15 -06:00
michael
0fdaedc7ff Complete UI design system migration to Barclays brand colors
Updates all remaining frontend components to use the new Barclays
design system color tokens:
- brand-dark-blue → primary-blue (#1A2142)
- brand-accent → active-blue (#006DE3)
- brand-light-blue → cyan-brand (#00AEEF)
- brand-gray → grey-100 (#F6F6F6)

Components updated:
- CampaignDetail and ProofDetailView in Campaigns.tsx
- Projects.tsx (full component migration)
- StatusDashboard.tsx (status tiles and colors)
- CreateProjectModal.tsx (modal styling)
- FeedbackReport.tsx (remaining brand colors)
- Login.tsx and Profile.tsx
- WIPReviewer.tsx and CopyGenAI.tsx
- Header, LoadingVisual, ToggleSwitch
- AssetPreview, ProofPreview, AssetUpload
- ProofTypeManager

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 14:00:13 -06:00
michael
75b2c6e699 Update modals and remaining UI components in Campaigns
- Update UploadProofModal with new design system colors
- Update LoadingCell progress bar to active-blue
- Update DeleteConfirmationModal with pill buttons and rounded corners
- Update CampaignDeleteConfirmationModal styling
- Apply consistent border radius (10px) to all modals
- Update drag & drop zone colors to use success theme

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 13:52:57 -06:00
michael
532d7541d6 Implement Barclays design system UI update
- Update Tailwind config with new color tokens (primary-blue, active-blue,
  electric-violet, lime, grey-100/300/700/900, success, warning, error)
- Add Inter font from Google Fonts as Barclays Effra alternative
- Update Sidebar with primary-blue background and white active state
- Update Hero with electric-violet accent and pill-shaped buttons
- Update all tables with lime (#C3FB5A) header backgrounds
- Implement alternating row colors (white/grey-100) on tables
- Update status badges: In Progress (amber), Completed (green)
- Update tabs with active-blue underline styling
- Apply 10px border radius to cards and containers
- Update button styling to pill-shaped with active-blue
- Update input/dropdown borders to grey-700 with 2px
- Update selected state highlighting to info-light (#E7F0FB)
- Update FeedbackReport RAG status colors to new design system

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 13:50:46 -06:00
michael
e5a841716e Add categorized issue display for revision analysis
When analyzing proof revisions (version > 1), SubReviewCard now displays
issues in three distinct categories: Resolved Issues (green, collapsed by
default), Outstanding Issues (amber), and New Issues (red). Each section
is collapsible with count badges. Original mode (version 1) maintains
backward compatibility with the single "Actionable Issues" list.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 10:39:42 -06:00
michael
2f547dc494 Detect identical file uploads via MD5 hashing
- Add file_hash and is_identical_file columns to proof_versions table
- Compute MD5 hash on file upload and compare with previous version
- Display warning banner when uploading identical file as revision
- Return is_identical_file in WebSocket response and API endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 10:15:48 -06:00
michael
d97be02b0b Add PDF preview support with on-demand rasterization
- Backend: Generate PDF thumbnail from first rasterized page on upload
- Backend: Add /files/{storage_key}/pages endpoint for PDF rasterization
- Frontend: Add getPdfPages() method to apiService
- Frontend: Create usePdfPages hook for on-demand PDF page loading
- Frontend: Pass pdfPages prop to ProofPreview in Campaigns view

This fixes the issue where PDF uploads showed no visual preview in results.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:56:23 -06:00
michael
0bfe28af59 Add bullet style to actionable issues list in PDF export
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:31:24 -06:00
michael
bf22248025 Fix PDF export formatting by parsing HTML and bullet text
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:26:31 -06:00
michael
17495d4291 Fix feedback report formatting by parsing HTML and bullet text
Add formatFeedbackText() utility that converts raw HTML tags and
concatenated bullet points from Gemini API into properly formatted
React elements with proper line breaks and list styling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:19:28 -06:00
michael
687edb547c Add campaign delete functionality with single and bulk selection
- Add CampaignDeleteConfirmationModal for campaign deletion confirmation
- Add checkbox selection column to CampaignList with select all/indeterminate state
- Add actions column with trash icon for single campaign deletion
- Add bulk actions bar showing selected count with Clear/Delete buttons
- Add handleDeleteCampaign handler in App.tsx using apiService.deleteCampaign
- Pass onDeleteCampaign prop through Campaigns component chain

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 07:46:51 -06:00
michael
404ba6868b Restructure agent system: remove Tone, split Channel, implement Legal
- Remove Tone Agent (tone is now part of Brand specs)
- Split Channel Agent into Channel Best Practices Agent and Channel Tech Specs Agent
- Convert Legal Agent from stub to full Gemini-powered implementation
- Add new prompt files for channel_best_practices.md, channel_tech_specs.md, legal.md
- Update ReferenceDocsService with new methods for loading specs
- Update schemas and analysis service to use new agent structure
- Update all frontend components to use new agent names and properties
- Update mock data in Projects.tsx and Campaigns.tsx

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 11:58:17 -06:00
michael
b52162b111 Fix vertical text alignment in RAG status badges for PDF export
Add lineHeight: 1 to RagStatusBadge component styling to ensure text
is tightly contained within its bounding box, allowing flexbox centering
to work correctly in PDF rendering engines.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 09:52:11 -06:00
michael
c1030ee292 Add PDF rasterization support for reliable preview and analysis
PDFs are now converted to PNG images at 200 DPI before being sent to
Gemini for analysis. This fixes the unreliable iframe-based PDF preview
and ensures all pages are properly analyzed.

- Add PyMuPDF dependency for PDF rasterization
- Create pdf_service.py with rasterize() and get_page_count()
- Update agent interfaces to accept list of images for multi-page support
- Add analyze_with_images() to Gemini service for multi-image analysis
- Return rasterized PDF pages via WebSocket for frontend display
- Add page navigation UI for multi-page PDFs in preview components

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 09:36:56 -06:00
michael
caf4539e1d Fix analytics pass rate calculation and add Analysis Errors stat
- Exclude errors from pass rate denominator since they weren't successfully reviewed
- Add missing Analysis Errors stat card to display error count
- Update grid layout to accommodate 5 stat cards

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 09:19:44 -06:00
michael
a4d67fdf46 Format campaign last modified date for better readability
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 09:09:10 -06:00
michael
e2fd9549f7 Add support email functionality via Mailgun
Backend:
- Add email_service.py with Mailgun API integration
- Add SupportEmailRequest schema for email endpoint
- Add Mailgun config settings (API URL, key, from address, support email)
- Update .env.example with Mailgun configuration variables

Frontend:
- Update Login.tsx SupportModal to send emails via /api/support/email
- Update Profile.tsx question form to send emails via apiService
- Add loading states, success/error feedback, and auto-close on success

The support forms on both the login page and profile page now actually
send emails to the support team instead of just showing alerts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 07:03:11 -06:00
michael
b119951f93 Fix retry button for failed proofs and hook up download asset button
- Add GET /files/{storage_key:path} endpoint to serve stored files
- Add getFile() method to apiService to fetch files from backend
- Update convertProofToFrontend() to preserve fileStorageKey
- Update handleRetryAnalysis() to fetch file from backend when not in memory
- Update handleDownload() to download original file instead of thumbnail

After page refresh, the retry button now fetches the original file from
backend storage using the fileStorageKey, allowing failed proofs to be
reprocessed. The Download Asset button also now downloads the original
uploaded file rather than the preview thumbnail.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 07:01:58 -06:00
michael
874c1fceee Add debugging for proof types not showing in dropdown
Backend logging:
- Log channel, sub-channel, and proof type counts in get_all_hierarchical()
- Log Meta proof types specifically
- Log API response for Social.Meta

Frontend logging:
- Log raw API response in apiService
- Log dropdown options in App.tsx when loaded
- Log available proof types in UploadProofModal when channel/subchannel selected

This will help diagnose why Meta proof types are not appearing on staging.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 13:09:25 -06:00
michael
96d459c322 Center text in PDF report status badges
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 10:13:20 -06:00
michael
74930d623f Replace agent icons with clean Heroicons
Replaced custom AI-generated icons with standard Heroicons for a more
professional appearance on the home page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 10:02:28 -06:00
michael
8038e4014e Make Workfront Campaign ID optional and propagate to proofs
The Workfront Campaign ID field is now optional when creating campaigns.
When provided, it is used as the base for proof workfront IDs instead of
generating random ones.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 09:49:23 -06:00