feat: Add environment configuration, ESLint setup, GitHub Actions deployment workflow, comprehensive API documentation, Jest testing configuration, and optimized Vite setup; implement AI model lazy loading and SEO components for improved performance and user experience
This commit is contained in:
76
docs/API.md
Normal file
76
docs/API.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# API Documentation
|
||||
|
||||
## Student Assistance AI API
|
||||
|
||||
### Core Endpoints
|
||||
|
||||
#### `POST /api/student-requests`
|
||||
Process new student assistance requests through AI matching engine.
|
||||
|
||||
**Request Body:**
|
||||
```typescript
|
||||
{
|
||||
studentId: string
|
||||
description: string
|
||||
category: 'clothing' | 'supplies' | 'food' | 'transportation' | 'emergency'
|
||||
urgency: 'low' | 'medium' | 'high' | 'critical'
|
||||
constraints: {
|
||||
maxBudget?: number
|
||||
timeframe: string
|
||||
geographic?: {
|
||||
maxDistance: number
|
||||
preferredAreas?: string[]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```typescript
|
||||
{
|
||||
requestId: string
|
||||
status: 'pending' | 'processing' | 'matched' | 'completed'
|
||||
matches: MatchResult[]
|
||||
estimatedCompletion: string
|
||||
aiConfidence: number
|
||||
}
|
||||
```
|
||||
|
||||
#### `GET /api/requests/{requestId}/status`
|
||||
Get real-time status of a student request.
|
||||
|
||||
#### `POST /api/ai/feedback`
|
||||
Submit feedback for AI model improvement.
|
||||
|
||||
**Request Body:**
|
||||
```typescript
|
||||
{
|
||||
requestId: string
|
||||
matchId: string
|
||||
outcome: 'successful' | 'partial' | 'failed'
|
||||
feedback: {
|
||||
satisfactionScore: number (1-5)
|
||||
issues?: string[]
|
||||
improvements?: string[]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
||||
All API endpoints return errors in the following format:
|
||||
```typescript
|
||||
{
|
||||
error: {
|
||||
code: string
|
||||
message: string
|
||||
details?: any
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Common error codes:
|
||||
- `INVALID_REQUEST`: Request format is incorrect
|
||||
- `AI_MODEL_UNAVAILABLE`: AI service is temporarily unavailable
|
||||
- `INSUFFICIENT_RESOURCES`: No matching resources found
|
||||
- `RATE_LIMIT_EXCEEDED`: Too many requests from client
|
||||
Reference in New Issue
Block a user