Mashaaer Enhanced is an advanced Arabic voice assistant with emotion detection, dialect support, and smart personal assistance capabilities. This project enhances the original Mashaaer application with additional features including subscription plans, integration with popular platforms, and a cosmic-themed UI.
This is the official production release (v1.0.0) of the Mashaaer Enhanced Project. After extensive testing and refinement through alpha and release candidate phases, we're proud to present a stable, feature-complete version with production-ready capabilities:
We welcome your feedback on this production release. For support or to provide feedback:
For enterprise support options, please visit our website at https://mashaaer.com/enterprise
Mashaaer stands out as the first Arabic-focused emotional intelligence assistant that combines:
/ask endpoint/api/tts)git clone https://github.com/your-username/mashaaer-enhanced.git
cd mashaaer-enhanced
.\setup.bat
OR
npm run setup
This setup script will:
.\start-full.bat
OR
npm start
OR
npm run dev
The start-full.bat script will:
For more details, see README.start-full.md.
For a complete list of available npm scripts and how to use them, see NPM_SCRIPTS.md.
npm install --legacy-peer-deps
If you encounter persistent installation problems:
node scripts/clean-reinstall.js
This script will:
The backend requires several Python packages including transformers and tokenizers. To install these dependencies:
cd backend
pip install -r requirements.txt
If you encounter issues installing the tokenizers package (especially on Python 3.13+ or systems without Rust compiler), use our fix script:
.\fix-tokenizers-install.bat
This script will handle the installation in a way that works around the Rust compiler requirement. For more details, see TOKENIZERS_INSTALL_FIX.md.
If you encounter issues with the frontend dependencies installation or if the application is not working, use our fix script:
.\fix-npm-install.bat
This script will:
After running this script, you should be able to start the application normally with .\start-mashaaer.ps1.
For detailed information about the npm installation fix and the setup process, see NPM_INSTALLATION_FIX.md.
If you see a blank page when accessing the application, it might be because the React frontend build files are not properly copied to the Flask backend's static directory. To fix this issue, use one of our fix scripts:
For Command Prompt:
.\fix-blank-page.bat
or
.\frontend-build.bat
For PowerShell:
.\fix-blank-page.ps1
or
.\frontend-build.ps1
These scripts will:
If you still see a blank page after running these scripts, you may need to fix the file paths in the launch.html template:
.\fix-frontend-paths.ps1
or
fix-frontend-paths.bat
After running one of these scripts, you should be able to access the application at http://127.0.0.1:5000.
For detailed information about this issue and the fix, see REACT_FLASK_BUILD_GUIDE.md, FRONTEND_BUILD_GUIDE.md, or BLANK_PAGE_FIX.md.
If you encounter MODULE_NOT_FOUND errors related to lodash (e.g., "Cannot find module './_baseIsNative'"), use our dedicated fix script:
.\fix-lodash-error.bat
This script will:
This error is common when using Node.js v22+ with older libraries like react-scripts or html-webpack-plugin that depend on lodash.
For detailed information about this issue and the fix, see LODASH_ERROR_FIX.md.
If you encounter an error related to missing react-dev-utils/getPublicUrlOrPath when starting the application, use our dedicated fix script:
.\fix-react-dev-utils.bat
Or if you prefer PowerShell:
.\fix-react-dev-utils.ps1
This script will:
After running this script, you should be able to start the application normally with npm start.
You can also run the fix directly with npm:
npm run fix:react-dev-utils
For detailed information about this issue and the fix, see REACT_DEV_UTILS_FIX.md.
Open the application in a web browser and interact with the assistant using voice or text input.
Scenario: A company uses Mashaaer to analyze customer support emails in Arabic.
Example Implementation:
// Analyze incoming customer support email
const emailContent = "أنا غاضب جدًا لأن المنتج الذي اشتريته لا يعمل بشكل صحيح";
const emotionAnalysis = detectEmotion(emailContent);
// Generate appropriate response based on detected emotion
if (emotionAnalysis.type === 'angry' && emotionAnalysis.confidence > 0.7) {
// Prioritize this customer's issue and route to senior support
customerTicket.priority = 'high';
customerTicket.assignTo = 'senior-support-team';
// Generate empathetic response
const response = `نأسف جدًا لتجربتك السلبية. نحن نتفهم إحباطك ونود حل المشكلة فورًا. سيتواصل معك أحد كبار المختصين خلال ساعة.`;
}
Scenario: A government portal serving citizens from different Arabic-speaking regions.
Example Implementation: The system automatically detects the user's dialect from their input and adjusts responses accordingly:
If you encounter any installation issues or need to start fresh:
Egyptian Dialect Input: "عايز أعرف إزاي أقدم على الخدمة دي"
System Response: "ممكن تقدم على الخدمة دي من خلال الموقع الإلكتروني أو التطبيق. محتاج مساعدة تانية؟"
Gulf Dialect Input: "أبغى أعرف كيف أقدم على هالخدمة"
System Response: "تقدر تقدم على الخدمة من خلال الموقع الإلكتروني أو التطبيق. تبغى مساعدة ثانية؟"
Scenario: A mental health application that tracks user emotional states over time.
Example Implementation:
// Track emotional states over time
const emotionTimeline = window.mashaaerComponents.emotionalMemory.getEmotionalTrend();
// Analyze trends
const dominantEmotion = emotionTimeline[0].emotion;
const emotionalTrend = emotionTimeline.map(entry => entry.trend);
// Generate insights
if (dominantEmotion === 'sad' && emotionalTrend.filter(e => e === 'sad').length > 3) {
// Suggest mood-improving activities
suggestActivity('تمارين التنفس العميق');
suggestActivity('المشي في الهواء الطلق');
// Offer professional resources if appropriate
if (user.preferences.healthSupport) {
offerProfessionalResources();
}
}
Scenario: An educational platform that adapts to student emotional states.
Example Implementation: When a student shows frustration with a difficult math problem, the system:
Scenario: A virtual meeting assistant that captures and analyzes emotions during business discussions.
Example Implementation: During a virtual business meeting:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ User Interface │ │ Core Services │ │ External Systems│
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Voice/Text Input│────▶│Emotion Detection│ │ Flask Backend │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
│ ▼ │
┌────────▼────────┐ ┌─────────────────┐ ┌────────▼────────┐
│ UI Components │◀────│ Memory System │ │ LLM Processing │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
│ ▼ │
┌────────▼────────┐ ┌─────────────────┐ ┌────────▼────────┐
│Response Display │◀────│Assistant Service│◀────│ API Integration │
└─────────────────┘ └─────────────────┘ └─────────────────┘
User Input ──▶ Text Analysis ──▶ Emotion Classification ──▶ Intensity Scoring
│
▼
Response Generation ◀── Persona Selection ◀── Memory Context ◀── Cultural Context
│
▼
Voice Modulation ──▶ UI Adaptation ──▶ Response Delivery
The project includes a comprehensive bootstrapping process that initializes all system components in the correct order. This process ensures proper dependency management and error handling.
To bootstrap the entire system:
# Run with administrator privileges
powershell -ExecutionPolicy Bypass -File bootstrap.ps1
The bootstrapping process:
For detailed information about the bootstrapping process, see the Bootstrapping Documentation.
/src - Source code
/api - API services including Flask backend integration/assistant - Smart personal assistant/config - Configuration system using cosmiconfig/context - React context providers for services/emotion - Emotion detection and timeline/integration - Third-party integrations/services - Service modules for business logic
/api - API service/assistant - Assistant service/config - Configuration service/emotion - Emotion service/memory - Memory service/theme - Theme service/voice - Voice service/static - Static assets including voice module/ui - User interface components/utils - Utility modules including system reporting/voice - Voice personality/public - Public assets
manifest.json - PWA manifest fileservice-worker.js - Service worker for offline functionality/docs - Documentation/tests - Test suite/backend - Flask backend with memory store
memory_indexer.py - Advanced memory indexing and retrievalsystem_metrics.py - System performance and health monitoring/packaging - Packaging scripts for distributionMashaaer is designed with performance in mind, particularly for Arabic language processing which can be resource-intensive. Key performance optimizations include:
Lazy Loading of Components
Memory Management
Processing Optimization
Response Time Targets
The system includes built-in performance monitoring through the SystemMetrics module:
// Access performance metrics
const metrics = await fetch('/api/metrics').then(res => res.json());
// Example metrics available
console.log(`Average response time: ${metrics.performance.avgResponseTime}ms`);
console.log(`Memory usage: ${metrics.performance.memoryUsage}MB`);
console.log(`Active users: ${metrics.usage.activeUsers}`);
Mashaaer is designed to scale from individual users to enterprise deployments:
Microservices Architecture
Stateless Design
Load Balancing
Resource Allocation
Model Complexity Tiers
For global deployments, Mashaaer supports multi-region configuration:
Region-Specific Models
Data Residency Compliance
Latency Optimization
For production deployment, use the provided PowerShell script:
# Run with administrator privileges
powershell -ExecutionPolicy Bypass -File e2e_deploy.ps1
The deployment script:
For specific hosting platforms (AWS, Heroku, etc.), uncomment and configure the relevant deployment commands in the script.
To package the entire application (React + Flask + Models) into a single executable:
# Navigate to the packaging directory
cd packaging
# Run the packaging script
.\package-app.ps1
The packaging script:
The packaged application will be available in packaging/dist/MashaaerEnhanced-1.0.0.zip.
Mashaaer provides comprehensive APIs for integration with other applications and services.
// Import the emotion detection module
import { detectEmotion } from '../emotion/enhanced-emotion-detection.js';
// Detect emotion in text
const emotion = detectEmotion("أنا سعيد جدًا بهذا الخبر");
console.log(emotion); // { type: 'happy', confidence: 0.85 }
// Use the emotion in your application
if (emotion.type === 'happy' && emotion.confidence > 0.7) {
// Respond to happy emotion
}
// Import the assistant module
import SmartPersonalAssistant from '../assistant/smart-personal-assistant.js';
// Create and initialize an assistant instance
const assistant = new SmartPersonalAssistant({
language: 'ar',
voiceEnabled: true,
emotionAware: true
});
assistant.initialize();
// Process a user message
const response = await assistant.handleUserMessage("كيف يمكنني تحسين مزاجي اليوم؟");
console.log(response);
// {
// text: "يمكنك تحسين مزاجك من خلال ممارسة الرياضة أو الاستماع إلى الموسيقى...",
// emotion: { type: 'neutral', confidence: 0.6 },
// tone: 'cheerful',
// pitch: 1.2,
// model: 'flask-backend'
// }
The Flask backend provides RESTful APIs for memory management and system metrics:
| Endpoint | Method | Description | Example Request |
|---|---|---|---|
/api/memory/episodic | POST | Store an episodic memory | { "input": "user message", "response": "system response", "emotion": "happy" } |
/api/memory/episodic | GET | Retrieve episodic memories | Query params: text, emotion, limit |
/api/memory/semantic/:category | POST | Store a semantic memory | { "key": "name", "value": "John" } |
/api/memory/semantic/:category | GET | Retrieve semantic memories | Query param: key (optional) |
/api/memory/user/summary | GET | Get user summary | N/A |
/api/memory/search | GET | Search memories | Query params: query, category, emotion, time_period |
| Endpoint | Method | Description | Example Response Fields |
|---|---|---|---|
/api/metrics | GET | Get system metrics | performance, usage, modules, errors, health |
/api/metrics/record | POST | Record system event | { "type": "request|module|error", "data": {} } |
For real-time updates, Mashaaer provides WebSocket events:
// Connect to WebSocket
const socket = new WebSocket('ws://localhost:5000/ws');
// Listen for emotion updates
socket.addEventListener('message', (event) => {
const data = JSON.parse(event.data);
if (data.type === 'emotionUpdate') {
console.log('New emotion detected:', data.emotion);
updateUI(data.emotion);
}
});
// Send user input via WebSocket
function sendMessage(text) {
socket.send(JSON.stringify({
type: 'userMessage',
text: text
}));
}
Mashaaer implements several layers of data protection:
Local Processing
Encryption
Data Minimization
User Authentication
Permission Levels
API Security
Centralized Logging
Session Analysis
Monitoring Dashboard
Input Validation
Dependency Management
For detailed security information, see the Security Documentation.
Mashaaer provides interactive documentation to help developers understand and use the system:
Swagger UI
/docs when running in development modeComponent Playground
/playground in development modeTutorial Mode
To access the interactive documentation, start the application in development mode and navigate to the /docs or /playground endpoints.
The application uses cosmiconfig for configuration management. You can configure the application in several ways:
mashaaer.config.js file in the project root:module.exports = {
theme: {
accentColor: 'warm',
starDensity: 'high',
},
assistant: {
defaultDialect: 'khaliji',
defaultTone: 'cheerful',
},
// See /src/config/README.md for full configuration options
};
.mashaaerrc file in JSON or YAML formatmashaaer property in your package.jsonFor detailed configuration options, see the configuration documentation.
The application includes a robust feature management system that allows for controlled rollout of new features and enterprise-specific customizations.
To configure features, add a features section to your configuration:
module.exports = {
// Other configuration...
// Feature management configuration
features: {
enabled: true,
featureFlags: [
{
id: 'advanced-emotion-detection',
name: 'Advanced Emotion Detection',
enabled: true,
description: 'Enhanced emotion detection with improved accuracy and dialect support',
requiredSubscription: 'premium'
},
{
id: 'memory-indexer',
name: 'Memory Indexer',
enabled: true,
description: 'Advanced memory indexing and retrieval capabilities',
requiredSubscription: 'basic'
},
{
id: 'voice-personality-v2',
name: 'Voice Personality V2',
enabled: true,
description: 'Next generation voice personality with improved emotion response',
requiredSubscription: 'premium'
}
],
telemetryEnabled: true
}
};
Features are managed by the FeatureService, which provides methods to check if features are enabled based on subscription level and configuration.
To check if a feature is enabled in your code:
// Using the featureService directly
if (featureService.isFeatureEnabled('advanced-emotion-detection')) {
// Use the advanced emotion detection feature
}
// Or using the services context in React components
const { featureService } = useServices();
if (featureService.isFeatureEnabled('memory-indexer')) {
// Use the memory indexer feature
}
The system status panel displays information about available features, including which ones are enabled for your subscription level. To view this information, click on the System Status panel to expand it.
The project includes comprehensive testing capabilities to ensure all components of the application are functioning correctly:
# Run all tests (app, emotion, UI, backend)
npm run test:all
# Run specific test suites
npm run test:app # Test all app functions
npm run test:emotion # Test emotion detection
npm run test:ui # Test UI components
npm run test:backend # Test backend functionality
For a quick test of all app functions, you can use the provided batch file:
# Simply double-click this file in the project root
run-app-test.bat
This will run a comprehensive test of all application components and provide a detailed report.
For detailed information about testing app functions, see TEST_APP_FUNCTIONS.md.
cd tests
node run-tests.js
This project is licensed under the MIT License - see the LICENSE file for details.
Mashaaer Enhanced is an advanced Arabic voice assistant with emotion detection, dialect support, and smart personal assistance capabilities. This project enhances the original Mashaaer application with additional features including subscription plans, integration with popular platforms, and a cosmic-themed UI.
This is the official production release (v1.0.0) of the Mashaaer Enhanced Project. After extensive testing and refinement through alpha and release candidate phases, we're proud to present a stable, feature-complete version with production-ready capabilities:
We welcome your feedback on this production release. For support or to provide feedback:
For enterprise support options, please visit our website at https://mashaaer.com/enterprise
Mashaaer stands out as the first Arabic-focused emotional intelligence assistant that combines:
/ask endpoint/api/tts)git clone https://github.com/your-username/mashaaer-enhanced.git
cd mashaaer-enhanced
.\setup.bat
OR
npm run setup
This setup script will:
.\start-full.bat
OR
npm start
OR
npm run dev
The start-full.bat script will:
For more details, see README.start-full.md.
For a complete list of available npm scripts and how to use them, see NPM_SCRIPTS.md.
npm install --legacy-peer-deps
If you encounter persistent installation problems:
node scripts/clean-reinstall.js
This script will:
The backend requires several Python packages including transformers and tokenizers. To install these dependencies:
cd backend
pip install -r requirements.txt
If you encounter issues installing the tokenizers package (especially on Python 3.13+ or systems without Rust compiler), use our fix script:
.\fix-tokenizers-install.bat
This script will handle the installation in a way that works around the Rust compiler requirement. For more details, see TOKENIZERS_INSTALL_FIX.md.
If you encounter issues with the frontend dependencies installation or if the application is not working, use our fix script:
.\fix-npm-install.bat
This script will:
After running this script, you should be able to start the application normally with .\start-mashaaer.ps1.
For detailed information about the npm installation fix and the setup process, see NPM_INSTALLATION_FIX.md.
If you see a blank page when accessing the application, it might be because the React frontend build files are not properly copied to the Flask backend's static directory. To fix this issue, use one of our fix scripts:
For Command Prompt:
.\fix-blank-page.bat
or
.\frontend-build.bat
For PowerShell:
.\fix-blank-page.ps1
or
.\frontend-build.ps1
These scripts will:
If you still see a blank page after running these scripts, you may need to fix the file paths in the launch.html template:
.\fix-frontend-paths.ps1
or
fix-frontend-paths.bat
After running one of these scripts, you should be able to access the application at http://127.0.0.1:5000.
For detailed information about this issue and the fix, see REACT_FLASK_BUILD_GUIDE.md, FRONTEND_BUILD_GUIDE.md, or BLANK_PAGE_FIX.md.
If you encounter MODULE_NOT_FOUND errors related to lodash (e.g., "Cannot find module './_baseIsNative'"), use our dedicated fix script:
.\fix-lodash-error.bat
This script will:
This error is common when using Node.js v22+ with older libraries like react-scripts or html-webpack-plugin that depend on lodash.
For detailed information about this issue and the fix, see LODASH_ERROR_FIX.md.
If you encounter an error related to missing react-dev-utils/getPublicUrlOrPath when starting the application, use our dedicated fix script:
.\fix-react-dev-utils.bat
Or if you prefer PowerShell:
.\fix-react-dev-utils.ps1
This script will:
After running this script, you should be able to start the application normally with npm start.
You can also run the fix directly with npm:
npm run fix:react-dev-utils
For detailed information about this issue and the fix, see REACT_DEV_UTILS_FIX.md.
Open the application in a web browser and interact with the assistant using voice or text input.
Scenario: A company uses Mashaaer to analyze customer support emails in Arabic.
Example Implementation:
// Analyze incoming customer support email
const emailContent = "أنا غاضب جدًا لأن المنتج الذي اشتريته لا يعمل بشكل صحيح";
const emotionAnalysis = detectEmotion(emailContent);
// Generate appropriate response based on detected emotion
if (emotionAnalysis.type === 'angry' && emotionAnalysis.confidence > 0.7) {
// Prioritize this customer's issue and route to senior support
customerTicket.priority = 'high';
customerTicket.assignTo = 'senior-support-team';
// Generate empathetic response
const response = `نأسف جدًا لتجربتك السلبية. نحن نتفهم إحباطك ونود حل المشكلة فورًا. سيتواصل معك أحد كبار المختصين خلال ساعة.`;
}
Scenario: A government portal serving citizens from different Arabic-speaking regions.
Example Implementation: The system automatically detects the user's dialect from their input and adjusts responses accordingly:
If you encounter any installation issues or need to start fresh:
Egyptian Dialect Input: "عايز أعرف إزاي أقدم على الخدمة دي"
System Response: "ممكن تقدم على الخدمة دي من خلال الموقع الإلكتروني أو التطبيق. محتاج مساعدة تانية؟"
Gulf Dialect Input: "أبغى أعرف كيف أقدم على هالخدمة"
System Response: "تقدر تقدم على الخدمة من خلال الموقع الإلكتروني أو التطبيق. تبغى مساعدة ثانية؟"
Scenario: A mental health application that tracks user emotional states over time.
Example Implementation:
// Track emotional states over time
const emotionTimeline = window.mashaaerComponents.emotionalMemory.getEmotionalTrend();
// Analyze trends
const dominantEmotion = emotionTimeline[0].emotion;
const emotionalTrend = emotionTimeline.map(entry => entry.trend);
// Generate insights
if (dominantEmotion === 'sad' && emotionalTrend.filter(e => e === 'sad').length > 3) {
// Suggest mood-improving activities
suggestActivity('تمارين التنفس العميق');
suggestActivity('المشي في الهواء الطلق');
// Offer professional resources if appropriate
if (user.preferences.healthSupport) {
offerProfessionalResources();
}
}
Scenario: An educational platform that adapts to student emotional states.
Example Implementation: When a student shows frustration with a difficult math problem, the system:
Scenario: A virtual meeting assistant that captures and analyzes emotions during business discussions.
Example Implementation: During a virtual business meeting:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ User Interface │ │ Core Services │ │ External Systems│
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Voice/Text Input│────▶│Emotion Detection│ │ Flask Backend │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
│ ▼ │
┌────────▼────────┐ ┌─────────────────┐ ┌────────▼────────┐
│ UI Components │◀────│ Memory System │ │ LLM Processing │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
│ ▼ │
┌────────▼────────┐ ┌─────────────────┐ ┌────────▼────────┐
│Response Display │◀────│Assistant Service│◀────│ API Integration │
└─────────────────┘ └─────────────────┘ └─────────────────┘
User Input ──▶ Text Analysis ──▶ Emotion Classification ──▶ Intensity Scoring
│
▼
Response Generation ◀── Persona Selection ◀── Memory Context ◀── Cultural Context
│
▼
Voice Modulation ──▶ UI Adaptation ──▶ Response Delivery
The project includes a comprehensive bootstrapping process that initializes all system components in the correct order. This process ensures proper dependency management and error handling.
To bootstrap the entire system:
# Run with administrator privileges
powershell -ExecutionPolicy Bypass -File bootstrap.ps1
The bootstrapping process:
For detailed information about the bootstrapping process, see the Bootstrapping Documentation.
/src - Source code
/api - API services including Flask backend integration/assistant - Smart personal assistant/config - Configuration system using cosmiconfig/context - React context providers for services/emotion - Emotion detection and timeline/integration - Third-party integrations/services - Service modules for business logic
/api - API service/assistant - Assistant service/config - Configuration service/emotion - Emotion service/memory - Memory service/theme - Theme service/voice - Voice service/static - Static assets including voice module/ui - User interface components/utils - Utility modules including system reporting/voice - Voice personality/public - Public assets
manifest.json - PWA manifest fileservice-worker.js - Service worker for offline functionality/docs - Documentation/tests - Test suite/backend - Flask backend with memory store
memory_indexer.py - Advanced memory indexing and retrievalsystem_metrics.py - System performance and health monitoring/packaging - Packaging scripts for distributionMashaaer is designed with performance in mind, particularly for Arabic language processing which can be resource-intensive. Key performance optimizations include:
Lazy Loading of Components
Memory Management
Processing Optimization
Response Time Targets
The system includes built-in performance monitoring through the SystemMetrics module:
// Access performance metrics
const metrics = await fetch('/api/metrics').then(res => res.json());
// Example metrics available
console.log(`Average response time: ${metrics.performance.avgResponseTime}ms`);
console.log(`Memory usage: ${metrics.performance.memoryUsage}MB`);
console.log(`Active users: ${metrics.usage.activeUsers}`);
Mashaaer is designed to scale from individual users to enterprise deployments:
Microservices Architecture
Stateless Design
Load Balancing
Resource Allocation
Model Complexity Tiers
For global deployments, Mashaaer supports multi-region configuration:
Region-Specific Models
Data Residency Compliance
Latency Optimization
For production deployment, use the provided PowerShell script:
# Run with administrator privileges
powershell -ExecutionPolicy Bypass -File e2e_deploy.ps1
The deployment script:
For specific hosting platforms (AWS, Heroku, etc.), uncomment and configure the relevant deployment commands in the script.
To package the entire application (React + Flask + Models) into a single executable:
# Navigate to the packaging directory
cd packaging
# Run the packaging script
.\package-app.ps1
The packaging script:
The packaged application will be available in packaging/dist/MashaaerEnhanced-1.0.0.zip.
Mashaaer provides comprehensive APIs for integration with other applications and services.
// Import the emotion detection module
import { detectEmotion } from '../emotion/enhanced-emotion-detection.js';
// Detect emotion in text
const emotion = detectEmotion("أنا سعيد جدًا بهذا الخبر");
console.log(emotion); // { type: 'happy', confidence: 0.85 }
// Use the emotion in your application
if (emotion.type === 'happy' && emotion.confidence > 0.7) {
// Respond to happy emotion
}
// Import the assistant module
import SmartPersonalAssistant from '../assistant/smart-personal-assistant.js';
// Create and initialize an assistant instance
const assistant = new SmartPersonalAssistant({
language: 'ar',
voiceEnabled: true,
emotionAware: true
});
assistant.initialize();
// Process a user message
const response = await assistant.handleUserMessage("كيف يمكنني تحسين مزاجي اليوم؟");
console.log(response);
// {
// text: "يمكنك تحسين مزاجك من خلال ممارسة الرياضة أو الاستماع إلى الموسيقى...",
// emotion: { type: 'neutral', confidence: 0.6 },
// tone: 'cheerful',
// pitch: 1.2,
// model: 'flask-backend'
// }
The Flask backend provides RESTful APIs for memory management and system metrics:
| Endpoint | Method | Description | Example Request |
|---|---|---|---|
/api/memory/episodic | POST | Store an episodic memory | { "input": "user message", "response": "system response", "emotion": "happy" } |
/api/memory/episodic | GET | Retrieve episodic memories | Query params: text, emotion, limit |
/api/memory/semantic/:category | POST | Store a semantic memory | { "key": "name", "value": "John" } |
/api/memory/semantic/:category | GET | Retrieve semantic memories | Query param: key (optional) |
/api/memory/user/summary | GET | Get user summary | N/A |
/api/memory/search | GET | Search memories | Query params: query, category, emotion, time_period |
| Endpoint | Method | Description | Example Response Fields |
|---|---|---|---|
/api/metrics | GET | Get system metrics | performance, usage, modules, errors, health |
/api/metrics/record | POST | Record system event | { "type": "request|module|error", "data": {} } |
For real-time updates, Mashaaer provides WebSocket events:
// Connect to WebSocket
const socket = new WebSocket('ws://localhost:5000/ws');
// Listen for emotion updates
socket.addEventListener('message', (event) => {
const data = JSON.parse(event.data);
if (data.type === 'emotionUpdate') {
console.log('New emotion detected:', data.emotion);
updateUI(data.emotion);
}
});
// Send user input via WebSocket
function sendMessage(text) {
socket.send(JSON.stringify({
type: 'userMessage',
text: text
}));
}
Mashaaer implements several layers of data protection:
Local Processing
Encryption
Data Minimization
User Authentication
Permission Levels
API Security
Centralized Logging
Session Analysis
Monitoring Dashboard
Input Validation
Dependency Management
For detailed security information, see the Security Documentation.
Mashaaer provides interactive documentation to help developers understand and use the system:
Swagger UI
/docs when running in development modeComponent Playground
/playground in development modeTutorial Mode
To access the interactive documentation, start the application in development mode and navigate to the /docs or /playground endpoints.
The application uses cosmiconfig for configuration management. You can configure the application in several ways:
mashaaer.config.js file in the project root:module.exports = {
theme: {
accentColor: 'warm',
starDensity: 'high',
},
assistant: {
defaultDialect: 'khaliji',
defaultTone: 'cheerful',
},
// See /src/config/README.md for full configuration options
};
.mashaaerrc file in JSON or YAML formatmashaaer property in your package.jsonFor detailed configuration options, see the configuration documentation.
The application includes a robust feature management system that allows for controlled rollout of new features and enterprise-specific customizations.
To configure features, add a features section to your configuration:
module.exports = {
// Other configuration...
// Feature management configuration
features: {
enabled: true,
featureFlags: [
{
id: 'advanced-emotion-detection',
name: 'Advanced Emotion Detection',
enabled: true,
description: 'Enhanced emotion detection with improved accuracy and dialect support',
requiredSubscription: 'premium'
},
{
id: 'memory-indexer',
name: 'Memory Indexer',
enabled: true,
description: 'Advanced memory indexing and retrieval capabilities',
requiredSubscription: 'basic'
},
{
id: 'voice-personality-v2',
name: 'Voice Personality V2',
enabled: true,
description: 'Next generation voice personality with improved emotion response',
requiredSubscription: 'premium'
}
],
telemetryEnabled: true
}
};
Features are managed by the FeatureService, which provides methods to check if features are enabled based on subscription level and configuration.
To check if a feature is enabled in your code:
// Using the featureService directly
if (featureService.isFeatureEnabled('advanced-emotion-detection')) {
// Use the advanced emotion detection feature
}
// Or using the services context in React components
const { featureService } = useServices();
if (featureService.isFeatureEnabled('memory-indexer')) {
// Use the memory indexer feature
}
The system status panel displays information about available features, including which ones are enabled for your subscription level. To view this information, click on the System Status panel to expand it.
The project includes comprehensive testing capabilities to ensure all components of the application are functioning correctly:
# Run all tests (app, emotion, UI, backend)
npm run test:all
# Run specific test suites
npm run test:app # Test all app functions
npm run test:emotion # Test emotion detection
npm run test:ui # Test UI components
npm run test:backend # Test backend functionality
For a quick test of all app functions, you can use the provided batch file:
# Simply double-click this file in the project root
run-app-test.bat
This will run a comprehensive test of all application components and provide a detailed report.
For detailed information about testing app functions, see TEST_APP_FUNCTIONS.md.
cd tests
node run-tests.js
This project is licensed under the MIT License - see the LICENSE file for details.