frontend changes

This commit is contained in:
Chandini 2025-09-19 16:51:21 +05:30
parent 983624b12d
commit f87b6a864f

View File

@ -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',