A modern web interface to interact with the NEAE Virtual Assistant (Special Educational Support Needs) for Andalucía, designed to provide specialized support for educators and families.
The NEAE Assistant is an AI-powered virtual assistant that provides specialized support for educational professionals working with students who have Special Educational Support Needs (NEAE) in Andalucía, Spain. It offers guidance on curricular adaptations, specialized resources, inclusive strategies, and educational regulations.
- Real-Time Chat - Instant communication with the NEAE assistant
- Responsive Design - Works perfectly on both mobile and desktop devices
- Modern Interface - Clean and professional design suitable for educational environments
- Loading Indicators - Visual feedback for user interactions
- Automatic Links - Automatic URL detection in responses
- Markdown Support - Rich text formatting in messages
- Connection Status - Real-time server connectivity indicators
- Secure Authentication - Access control based on API keys
- Session Management - Maintains conversational context
- Error Handling - Comprehensive error management
- AI Integration - Powered by Google Gemini AI
- Specialized Knowledge - Expert guidance on NEAE topics
Make sure you have Python 3.7+ installed and the following dependencies:
pip install fastapi uvicorn[standard] google-generativeai python-dotenvuvicorn main:app --reloadOpen your browser and go to: http://127.0.0.1:8000
The interface will automatically redirect you to the chat application.
asistente-neae/
├── main.py # FastAPI server with chat endpoints
├── user_keys.json # User keys and usage limits
├── user_keys.example.json # Example key configuration
├── prompt.txt # System instructions for the assistant
├── .env # Environment variables
├── credenciales_google.json # Google credentials
├── frontend/ # Web interface files (SPA)
│ └── static/ # Static assets
│ ├── index.html # SPA application shell
│ ├── css/
│ │ └── app.css # CSS styles
│ ├── js/
│ │ ├── router.js # SPA router
│ │ ├── session.js # Session management
│ │ ├── errorHandler.js # Error handling
│ │ └── config.js # Frontend configuration
│ └── views/ # SPA views
│ ├── chat/ # Chat view
│ └── login/ # Login view
├── test_setup.py # Configuration verification script
├── README.md # This documentation
└── LICENSE # Project license
The system uses a user_keys.json file to manage user keys and their usage limits:
-
Create the configuration file:
cp user_keys.example.json user_keys.json
-
Edit the user keys:
{ "your_custom_key": { "count": 0, "max_uses": 100, "user_id": "user1", "description": "User description" }, "another_key": { "count": 0, "max_uses": 50, "user_id": "user2", "description": "Secondary user" } } -
Configuration fields:
count: Current usage count (increments automatically)max_uses: Maximum allowed uses per keyuser_id: Unique user identifierdescription: Optional user description
-
Reload configuration:
- Keys are loaded automatically when the server starts
- To reload without restarting:
POST /admin/reload-keys - View current status:
GET /admin/keys-status
Ensure your .env file includes the required Google credentials path:
GOOGLE_APPLICATION_CREDENTIALS_PATH=./credenciales.json
- Start the server with
uvicorn main:app --reload - Open http://127.0.0.1:8000 in your browser
- Type your NEAE-related query
- Press Enter or click "Send"
- "I need adaptations for a student with ADHD in 3rd grade"
- "What resources are available for students with dyslexia?"
- "How to adapt a math activity for autism"
- "Andalusian regulations on NEAE"
All API requests require an API key in the header:
X-API-Key: your_api_key_here
Starts a new chat session.
Headers:
X-API-Key: [your_api_key]
Response:
{
"session_id": "uuid-string",
"message": "Welcome message"
}Sends a message to the assistant.
Headers:
X-API-Key: [your_api_key]
Body:
{
"session_id": "uuid-string",
"question": "Your question here"
}Response:
{
"session_id": "uuid-string",
"answer": "Assistant's response",
"error": null
}The assistant automatically formats responses with:
- Section headers with clear titles
- Clickable links for external resources
- Bullet lists for structured information
- Bold text using markdown syntax
- Code blocks for technical examples
- Character limit of 1000 per message
- Session validation to maintain conversation context
- Real-time error handling with user-friendly messages
- Connection monitoring with automatic retry logic
Server does not start:
pip install fastapi uvicorn[standard] google-generativeai python-dotenvPort already in use:
# End process using port 8000
netstat -ano | findstr :8000
# Then use the PID with: taskkill /F /PID [PID_NUMBER]Connection errors:
- Ensure the server is running on port 8000
- Check that the API key is correctly set in
static/config.js - Open browser developer tools (F12) to check for JavaScript errors
CORS Issues:
The server is preconfigured to allow all origins in development. If you encounter CORS errors, check the server configuration in main.py.
Static files not loading:
- Ensure all paths in
index.htmluse the/static/prefix - Verify FastAPI static file mounting is correctly configured
Authentication errors:
- Check that your
.envfile points to the correct credentials file - Ensure
credenciales.jsonexists and contains valid Google API credentials - Verify that the Google Generative AI service is enabled for your project
uvicorn main:app --reload --host 0.0.0.0 --port 8000Use the included test script:
python test_setup.pyThis will verify:
- API keys are available
- Server configuration is correct
- Google credentials are valid
- Web interface files are present
The --reload flag enables automatic server restarts when files change, making development more efficient.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the terms specified in the LICENSE file.
Your web interface is ready to use! Simply run:
uvicorn main:app --reloadThen open http://127.0.0.1:8000 in your browser to start chatting with the NEAE assistant.