quantum-ai/data_analyzer/urls.py
Claude 8189cca054 Fix data analyzer JSON response errors
## Issue Fixed
- Data analyzer was returning HTML instead of JSON for AJAX requests
- JavaScript was receiving "<\!DOCTYPE..." instead of valid JSON
- SyntaxError: Unexpected token '<' in JSON parsing

## Solution
- Modified data_analyzer_detail view to handle AJAX POST requests
- Added proper X-Requested-With header detection
- Integrated form processing directly in detail view
- Added data_analyzer_status view for polling mechanism
- Updated URL configuration with status endpoint

## Technical Changes
- Handle multipart form data for file uploads in detail view
- Return proper JsonResponse for AJAX requests
- Maintain wallet balance checking and deduction logic
- Use 'analysisType' field name to match frontend form
- Add status polling URL pattern for consistent API

## Result
- Data analyzer now properly returns JSON responses
- Form submission works without page reload
- Consistent with other working agents (weather, job posting, social ads)
- Proper error handling and user feedback

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-13 19:34:22 +05:30

11 lines
400 B
Python

from django.urls import path
from . import views
app_name = 'data_analyzer'
urlpatterns = [
path('', views.data_analyzer_detail, name='detail'),
path('process/', views.DataAnalysisAgentProcessView.as_view(), name='process'),
path('status/<uuid:request_id>/', views.data_analyzer_status, name='status'),
path('result/<uuid:request_id>/', views.data_analyzer_result, name='result'),
]