From 538a32505e0b73ddf894f2b4fc18791775bc979b Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Mon, 16 Mar 2026 12:22:31 +0000 Subject: [PATCH] Fix LlamaParse 401 + update logo to v5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add LLAMA_CLOUD_BASE_URL config option so the LlamaCloud regional endpoint can be set without code changes (fixes 401/region errors on production); pass it through to AsyncLlamaCloud client init - Document LLAMA_CLOUD_BASE_URL in .env.deploy.example with EU endpoint - Copy BAR-ModComms-logo-v5.png to frontend/public - Sidebar: update logo reference v4 → v5 - PDF header: update logo v4 → v5, wrap in black (#000) band for legibility, remove duplicate "Oliver" wordmark Co-Authored-By: Claude Sonnet 4.6 --- .env.deploy.example | 4 ++++ backend/app/config.py | 2 ++ backend/app/main.py | 2 +- backend/app/services/llamaparse_service.py | 8 ++++++-- frontend/components/PDFReport.tsx | 7 ++++--- frontend/components/Sidebar.tsx | 2 +- frontend/public/BAR-ModComms-logo-v5.png | Bin 0 -> 54332 bytes 7 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 frontend/public/BAR-ModComms-logo-v5.png diff --git a/.env.deploy.example b/.env.deploy.example index 8cc7b4b..7724489 100644 --- a/.env.deploy.example +++ b/.env.deploy.example @@ -67,6 +67,10 @@ DISABLE_AUTH=false GEMINI_API_KEY=your_gemini_api_key LLAMA_CLOUD_API_KEY=your_llama_cloud_api_key +# Optional: set regional base URL to fix 401 errors (US is default). +# EU region: https://api.eu.cloud.llamaindex.ai +# Leave blank to use the default US endpoint. +LLAMA_CLOUD_BASE_URL= # ----------------------------------------------------------------------- # Email (Mailgun) diff --git a/backend/app/config.py b/backend/app/config.py index 75ca00d..b4b5a2d 100755 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -37,6 +37,8 @@ class Settings: # LlamaParse API key (optional - KB processing pipeline disabled if not set) LLAMA_CLOUD_API_KEY: str = os.getenv("LLAMA_CLOUD_API_KEY", "") + # LlamaParse region base URL (optional - defaults to US; set for EU: https://api.cloud.llamaindex.ai) + LLAMA_CLOUD_BASE_URL: str = os.getenv("LLAMA_CLOUD_BASE_URL", "") # Mailgun Configuration for support emails MAILGUN_API_URL: str = os.getenv("MAILGUN_API_URL", "") diff --git a/backend/app/main.py b/backend/app/main.py index cd3ca04..d1485fe 100755 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -98,7 +98,7 @@ async def lifespan(app: FastAPI): if settings.LLAMA_CLOUD_API_KEY: from app.services.llamaparse_service import LlamaParseService print("Initializing LlamaParse service...") - llamaparse_service = LlamaParseService(settings.LLAMA_CLOUD_API_KEY) + llamaparse_service = LlamaParseService(settings.LLAMA_CLOUD_API_KEY, settings.LLAMA_CLOUD_BASE_URL) knowledge_base_service = KnowledgeBaseService(llamaparse_service, gemini_service, reference_docs) print("Knowledge Base pipeline ready!") else: diff --git a/backend/app/services/llamaparse_service.py b/backend/app/services/llamaparse_service.py index a378667..978021e 100644 --- a/backend/app/services/llamaparse_service.py +++ b/backend/app/services/llamaparse_service.py @@ -17,8 +17,9 @@ class ParseResult: class LlamaParseService: """Service for parsing documents using LlamaParse with the llama-cloud SDK.""" - def __init__(self, api_key: str): + def __init__(self, api_key: str, base_url: str = ""): self.api_key = api_key + self.base_url = base_url async def parse_document(self, file_data: bytes, filename: str) -> ParseResult: """ @@ -38,7 +39,10 @@ class LlamaParseService: logger.info(f"[LLAMAPARSE] Starting agentic_plus parse for '{filename}' ({len(file_data)} bytes)") - client = AsyncLlamaCloud(api_key=self.api_key) + client = AsyncLlamaCloud( + api_key=self.api_key, + **({"base_url": self.base_url} if self.base_url else {}) + ) # Write bytes to a temp file for upload suffix = Path(filename).suffix or ".pdf" diff --git a/frontend/components/PDFReport.tsx b/frontend/components/PDFReport.tsx index 9f78d8a..534446a 100755 --- a/frontend/components/PDFReport.tsx +++ b/frontend/components/PDFReport.tsx @@ -123,9 +123,10 @@ export const PDFReport: React.FC = ({ campaignName, proofs, base
{/* --- Cover Page --- */}
-
- Mod Comms AI — In partnership with Barclays -
Oliver
+
+
+ Mod Comms AI — In partnership with Barclays +

AI Compliance & Brand Report

diff --git a/frontend/components/Sidebar.tsx b/frontend/components/Sidebar.tsx index 004f310..dc0190a 100755 --- a/frontend/components/Sidebar.tsx +++ b/frontend/components/Sidebar.tsx @@ -38,7 +38,7 @@ export const Sidebar: React.FC = ({ activeItem, onNavigate, userNa