From f87b6a864fd2d678f3aabd737628640c5d26eb0d Mon Sep 17 00:00:00 2001 From: Chandini Date: Fri, 19 Sep 2025 16:51:21 +0530 Subject: [PATCH] frontend changes --- src/services/aiAnalysis.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/aiAnalysis.ts b/src/services/aiAnalysis.ts index 5326d5d..c4965df 100644 --- a/src/services/aiAnalysis.ts +++ b/src/services/aiAnalysis.ts @@ -17,9 +17,11 @@ export async function analyzeFeatureWithAI( try { // Prefer dedicated analysis endpoint if available in requirements service const primaryUrl = `${BACKEND_URL}/api/requirements/analyze-feature` + const accessToken = (typeof window !== 'undefined') ? localStorage.getItem('accessToken') : null + const authHeaders = accessToken ? { Authorization: `Bearer ${accessToken}` } : {} let res = await fetch(primaryUrl, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: { 'Content-Type': 'application/json', ...authHeaders }, body: JSON.stringify({ featureName, description, requirements, projectType, complexity: userSelectedComplexity }), }) @@ -28,7 +30,7 @@ export async function analyzeFeatureWithAI( const fallbackUrl = `${BACKEND_URL}/api/mockup/generate-wireframe` res = await fetch(fallbackUrl, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: { 'Content-Type': 'application/json', ...authHeaders }, body: JSON.stringify({ prompt: `${featureName}: ${description}. Requirements: ${requirements.join('; ')}`, device: 'desktop',