From 1934b424384aefdf4abed36d7ee7926abd9b3785 Mon Sep 17 00:00:00 2001 From: DaKheera47 Date: Tue, 20 Jan 2026 13:44:42 +0000 Subject: [PATCH] keep fallback to `base.json`, but tell user to use API key first --- .../components/ReactiveResumeSection.tsx | 2 +- .../src/server/pipeline/orchestrator.ts | 16 ++++++++---- .../src/server/services/resumeProjects.ts | 25 ++++++++----------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/orchestrator/src/client/pages/settings/components/ReactiveResumeSection.tsx b/orchestrator/src/client/pages/settings/components/ReactiveResumeSection.tsx index b7567e0..30ea1b9 100644 --- a/orchestrator/src/client/pages/settings/components/ReactiveResumeSection.tsx +++ b/orchestrator/src/client/pages/settings/components/ReactiveResumeSection.tsx @@ -96,7 +96,7 @@ export const ReactiveResumeSection: React.FC = ({ - None (Fallback to local base.json) + None (No profile data will be loaded) {resumes.map((resume) => ( {resume.name} diff --git a/orchestrator/src/server/pipeline/orchestrator.ts b/orchestrator/src/server/pipeline/orchestrator.ts index 60884be..3a61930 100644 --- a/orchestrator/src/server/pipeline/orchestrator.ts +++ b/orchestrator/src/server/pipeline/orchestrator.ts @@ -553,17 +553,23 @@ export function getPipelineStatus(): { isRunning: boolean } { * Load the user profile from JSON file. */ async function loadProfile(profilePath: string): Promise> { - try { - const rxResumeBaseResumeId = await settingsRepo.getSetting('rxResumeBaseResumeId'); - if (rxResumeBaseResumeId) { + const rxResumeBaseResumeId = await settingsRepo.getSetting('rxResumeBaseResumeId'); + if (rxResumeBaseResumeId) { + try { const resume = await getResume(rxResumeBaseResumeId); return resume.data as Record; + } catch (error) { + console.error(`❌ Failed to load resume from Reactive Resume (${rxResumeBaseResumeId}):`, error); + throw new Error(`Failed to load profile from Reactive Resume (ID: ${rxResumeBaseResumeId}). Please check your API key and connection.`); } + } + try { const content = await readFile(profilePath, 'utf-8'); return JSON.parse(content); } catch (error) { - console.warn(`Failed to load profile from ${profilePath}, using empty object`, error); - return {}; + const message = `No local profile found at ${profilePath} and no Reactive Resume base ID is configured. Reactive Resume integration is required for tailoring.`; + console.error(`❌ ${message}`); + throw new Error(message); } } diff --git a/orchestrator/src/server/services/resumeProjects.ts b/orchestrator/src/server/services/resumeProjects.ts index a609ae1..b701432 100644 --- a/orchestrator/src/server/services/resumeProjects.ts +++ b/orchestrator/src/server/services/resumeProjects.ts @@ -13,28 +13,25 @@ export const DEFAULT_RESUME_PROFILE_PATH = type ResumeProjectSelectionItem = ResumeProjectCatalogItem & { summaryText: string }; export async function loadResumeProfile(profilePath: string = DEFAULT_RESUME_PROFILE_PATH): Promise { - try { - const rxResumeBaseResumeId = await getSetting('rxResumeBaseResumeId'); - if (rxResumeBaseResumeId) { + const rxResumeBaseResumeId = await getSetting('rxResumeBaseResumeId'); + + if (rxResumeBaseResumeId) { + try { const resume = await getResume(rxResumeBaseResumeId); return resume.data; + } catch (error) { + console.error(`❌ Failed to load resume from Reactive Resume (${rxResumeBaseResumeId}):`, error); + throw new Error(`Failed to load profile from Reactive Resume (ID: ${rxResumeBaseResumeId}). Please check your API key and connection.`); } + } + // Fallback to local file + try { const { readFile } = await import('fs/promises'); const content = await readFile(profilePath, 'utf-8'); return JSON.parse(content); } catch (error) { - console.warn(`Failed to load profile, using fallback if possible`, error); - // If Reactive Resume failed but we have a path, try reading file - if (profilePath) { - try { - const { readFile } = await import('fs/promises'); - const content = await readFile(profilePath, 'utf-8'); - return JSON.parse(content); - } catch (innerError) { - // ignore - } - } + console.warn(`⚠️ No local profile found at ${profilePath} and no Reactive Resume base ID is configured. Reactive Resume integration is required for tailoring.`); return {}; } }