نظام متكامل لإدارة وسائل التواصل الاجتماعي باستخدام الذكاء الاصطناعي، مبني على FastAPI و OpenAI GPT مع دعم كامل للواجهة العربية.
- 🤖 AI-Powered Chatbot - Intelligent conversational AI using OpenAI GPT-4
- 💬 Real-time WebSocket Communication - Instant messaging with WebSocket
- 🌐 Arabic RTL Support - Full Arabic interface with RTL layout
- 🌓 Dark/Light Mode - Beautiful dark and light themes
- 📱 Responsive Design - Works on all devices (desktop, tablet, mobile)
- ⚡ High Performance - Built with FastAPI for optimal speed
- 🔄 Social Media Automation - Twitter, Instagram, YouTube, TikTok integration
- 🌐 Browser Automation - Playwright for web scraping and automation
- 🎥 Media Processing - Video, audio, and image processing with OpenCV
- 🔐 Secure Authentication - JWT-based authentication system
- 📊 Data Analytics - Advanced analytics and reporting
- ⚙️ Task Queue - Celery for background job processing
- 🤖 شات بوت ذكي - ذكاء اصطناعي محادث باستخدام OpenAI GPT-4
- 💬 اتصال WebSocket مباشر - رسائل فورية مع WebSocket
- 🌐 دعم العربية RTL - واجهة عربية كاملة مع تخطيط من اليمين لليسار
- 🌓 الوضع الليلي/النهاري - ثيمات جميلة للوضع الليلي والنهاري
- 📱 تصميم متجاوب - يعمل على جميع الأجهزة
- ⚡ أداء عالي - مبني على FastAPI للأداء الأمثل
- 🔄 أتمتة وسائل التواصل - تكامل مع Twitter, Instagram, YouTube, TikTok
- 🌐 أتمتة المتصفح - Playwright للكشط والأتمتة
- 🎥 معالجة الوسائط - معالجة الفيديو والصوت والصور مع OpenCV
- 🔐 المصادقة الآمنة - نظام مصادقة يعتمد على JWT
- 📊 تحليل البيانات - تحليلات وتقارير متقدمة
- ⚙️ قائمة المهام - Celery لمعالجة المهام في الخلفية
- Python 3.11 or higher
- OpenAI API Key (Get one at platform.openai.com)
- PostgreSQL (optional, for database features)
- MongoDB (optional, for NoSQL storage)
- Redis (optional, for caching and task queue)
- Python 3.11 أو أحدث
- مفتاح OpenAI API (احصل عليه من platform.openai.com)
- PostgreSQL (اختياري، للميزات القاعدة البيانات)
- MongoDB (اختياري، للتخزين NoSQL)
- Redis (اختياري، للتخزين المؤقت وقائمة المهام)
- Clone the repository / استنساخ المستودع:
git clone https://github.com/Mrsos07/Moj-Agentic-AI.git
cd Moj-Agentic-AI- Create virtual environment / إنشاء بيئة افتراضية:
# Windows
python -m venv venv
venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activate- Install dependencies / تثبيت المتطلبات:
pip install --upgrade pip
pip install -r requirements.txt- Install Playwright browsers (Required) / تثبيت متصفحات Playwright (مطلوب):
playwright install- Setup environment variables / إعداد متغيرات البيئة:
Create a .env file in the root directory:
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-4
OPENAI_MAX_TOKENS=2000
OPENAI_TEMPERATURE=0.7
# Server Configuration
HOST=0.0.0.0
PORT=8000
DEBUG=True
# Database (Optional)
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=your_user
POSTGRES_PASSWORD=your_password
POSTGRES_DB=moj_ai_db
# MongoDB (Optional)
MONGODB_URI=mongodb://localhost:27017
MONGODB_DB=moj_ai_db
# Redis (Optional)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0أنشئ ملف .env في المجلد الرئيسي:
- Run the application / تشغيل التطبيق:
python run.pyOr using uvicorn directly:
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload- Open in browser / فتح في المتصفح:
Backend API: http://localhost:8000
Frontend (React): http://localhost:3000 (see Frontend Setup section)
واجهة الخادم (API): http://localhost:8000
الواجهة الأمامية (React): http://localhost:3000 (راجع قسم إعداد الواجهة الأمامية)
Moj-Agentic-AI/
├── app/ # Backend Application (FastAPI)
│ ├── __init__.py
│ ├── main.py # FastAPI application & WebSocket handler
│ ├── core/
│ │ ├── __init__.py
│ │ └── config.py # Configuration settings
│ └── services/
│ ├── __init__.py
│ └── ai_service.py # OpenAI integration service
├── frontend/ # React Frontend Application
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── ChatInterface.jsx
│ │ │ ├── Sidebar.jsx
│ │ │ ├── MessageList.jsx
│ │ │ ├── Message.jsx
│ │ │ ├── MessageInput.jsx
│ │ │ └── TypingIndicator.jsx
│ │ ├── App.jsx # Main React component
│ │ ├── main.jsx # Entry point
│ │ └── index.css # Tailwind styles
│ ├── index.html
│ ├── package.json # Node.js dependencies
│ ├── vite.config.js # Vite configuration
│ ├── tailwind.config.js # Tailwind configuration
│ ├── postcss.config.js # PostCSS configuration
│ └── README.md # Frontend documentation
├── templates/
│ └── chat.html # Legacy HTML interface
├── static/ # Static files (CSS, JS, images)
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
├── run.py # Backend quick start script
├── SETUP.md # Detailed setup guide
├── USAGE_GUIDE.md # Usage guide
└── README.md # This file
- React 18.2.0 - Modern UI library
- Vite 5.0.8 - Fast build tool and dev server
- TailwindCSS 3.4.1 - Utility-first CSS framework
- Axios 1.6.5 - HTTP client for API calls
- React Icons 5.0.1 - Icon library (FiSend, FiPlus, MdDashboard, etc.)
- ✨ Modern React Components - Modular and reusable components
- 🎨 TailwindCSS Styling - Beautiful and responsive design
- 🌓 Dark/Light Mode - Toggle between themes
- 📱 Fully Responsive - Works on all screen sizes
- ⚡ Fast Development - Vite HMR for instant updates
- 🔌 WebSocket Integration - Real-time chat with backend
- 🎯 Arabic RTL Support - Full right-to-left layout
- Navigate to frontend directory:
cd frontend- Install Node.js dependencies:
npm install- Run development server:
npm run devFrontend will be available at: http://localhost:3000
- Build for production:
npm run buildnpm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Lint code- React 18.2.0 - مكتبة واجهة مستخدم حديثة
- Vite 5.0.8 - أداة بناء وخادم تطوير سريع
- TailwindCSS 3.4.1 - إطار عمل CSS
- Axios 1.6.5 - عميل HTTP للاتصال بالـ API
- React Icons 5.0.1 - مكتبة الأيقونات
- ✨ مكونات React حديثة - مكونات معيارية وقابلة لإعادة الاستخدام
- 🎨 تصميم TailwindCSS - تصميم جميل ومتجاوب
- 🌓 الوضع الليلي/النهاري - التبديل بين الثيمات
- 📱 متجاوب بالكامل - يعمل على جميع أحجام الشاشات
- ⚡ تطوير سريع - Vite HMR للتحديثات الفورية
- 🔌 تكامل WebSocket - دردشة فورية مع الخادم
- 🎯 دعم العربية RTL - تخطيط كامل من اليمين لليسار
- الانتقال إلى مجلد frontend:
cd frontend- تثبيت مكتبات Node.js:
npm install- تشغيل خادم التطوير:
npm run devالواجهة الأمامية ستكون متاحة على: http://localhost:3000
- البناء للإنتاج:
npm run buildnpm run dev # تشغيل خادم التطوير
npm run build # البناء للإنتاج
npm run preview # معاينة بناء الإنتاج
npm run lint # فحص الكودws://localhost:8000/ws/chat- WebSocket connection for real-time chat
GET /- Chat interface (HTML)GET /health- Health check endpointGET /static/{file_path}- Static files (CSS, JS, images)
Note: Backend runs on port 8000, Frontend runs on port 3000
{
"status": "healthy",
"timestamp": "2026-01-08T20:27:14.254772"
}| Variable | Description | Default | Required |
|---|---|---|---|
OPENAI_API_KEY |
OpenAI API key | - | Yes |
OPENAI_MODEL |
GPT model to use | gpt-4 |
No |
OPENAI_MAX_TOKENS |
Maximum tokens | 2000 |
No |
OPENAI_TEMPERATURE |
Model temperature | 0.7 |
No |
HOST |
Server host | 0.0.0.0 |
No |
PORT |
Server port | 8000 |
No |
DEBUG |
Debug mode | True |
No |
| المتغير | الوصف | القيمة الافتراضية | مطلوب |
|---|---|---|---|
OPENAI_API_KEY |
مفتاح OpenAI API | - | نعم |
OPENAI_MODEL |
نموذج GPT المستخدم | gpt-4 |
لا |
OPENAI_MAX_TOKENS |
الحد الأقصى للتوكنز | 2000 |
لا |
OPENAI_TEMPERATURE |
درجة الإبداع | 0.7 |
لا |
HOST |
عنوان الخادم | 0.0.0.0 |
لا |
PORT |
منفذ الخادم | 8000 |
لا |
DEBUG |
وضع التطوير | True |
لا |
# With auto-reload
python run.py
# Or with uvicorn
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000- Add a new service: Create a file in
app/services/ - Add a new endpoint: Modify
app/main.py - Modify the UI: Edit
templates/chat.html - Update configuration: Modify
app/core/config.py
- إضافة خدمة جديدة: أنشئ ملف في
app/services/ - إضافة endpoint جديد: عدّل
app/main.py - تعديل الواجهة: عدّل
templates/chat.html - تحديث التكوين: عدّل
app/core/config.py
- FastAPI - Modern web framework
- Uvicorn - ASGI server
- OpenAI - AI integration
- Pydantic - Data validation
- WebSocket - Real-time communication
- Social Media APIs (Tweepy, yt-dlp, Instaloader)
- Browser Automation (Playwright, Selenium)
- Media Processing (OpenCV, MoviePy, Pillow)
- AI/ML Libraries (PyTorch, Transformers, LangChain)
- Database Support (PostgreSQL, MongoDB, Redis)
- Task Queue (Celery, Flower)
- FastAPI - إطار عمل ويب حديث
- Uvicorn - خادم ASGI
- OpenAI - تكامل الذكاء الاصطناعي
- Pydantic - التحقق من البيانات
- WebSocket - الاتصال المباشر
-
UnicodeEncodeError on Windows
- The
run.pyscript handles encoding automatically - Make sure you're using Python 3.11+
- The
-
ModuleNotFoundError
- Activate the virtual environment first
- Install dependencies:
pip install -r requirements.txt
-
OpenAI API Error
- Check your API key in
.envfile - Ensure you have credits in your OpenAI account
- Check your API key in
-
Port already in use
- Change the PORT in
.envfile - Or kill the process using the port
- Change the PORT in
-
خطأ UnicodeEncodeError على Windows
- سكربت
run.pyيتعامل مع الترميز تلقائياً - تأكد من استخدام Python 3.11+
- سكربت
-
خطأ ModuleNotFoundError
- فعّل البيئة الافتراضية أولاً
- ثبّت المتطلبات:
pip install -r requirements.txt
-
خطأ OpenAI API
- تحقق من مفتاح API في ملف
.env - تأكد من وجود رصيد في حساب OpenAI
- تحقق من مفتاح API في ملف
-
المنفذ مستخدم بالفعل
- غيّر PORT في ملف
.env - أو أوقف العملية التي تستخدم المنفذ
- غيّر PORT في ملف
This project is licensed under the MIT License - see the LICENSE file for details.
هذا المشروع مرخص تحت رخصة MIT - راجع ملف LICENSE للتفاصيل.
Contributions are welcome! Please feel free to submit a Pull Request.
المساهمات مرحب بها! لا تتردد في إرسال Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Mrsos07
- GitHub: @Mrsos07
- Repository: https://github.com/Mrsos07/Moj-Agentic-AI
- OpenAI API: https://platform.openai.com
- FastAPI Docs: https://fastapi.tiangolo.com
- ✅ Complete rewrite with FastAPI
- ✅ React Frontend with Vite + TailwindCSS
- ✅ Arabic RTL interface
- ✅ WebSocket real-time communication
- ✅ OpenAI GPT-4 integration
- ✅ Modern component-based architecture
- ✅ Axios for API calls
- ✅ React Icons integration
- ✅ Comprehensive requirements.txt
- ✅ Windows encoding fixes
- ✅ إعادة كتابة كاملة مع FastAPI
- ✅ واجهة أمامية React مع Vite + TailwindCSS
- ✅ واجهة عربية RTL
- ✅ اتصال WebSocket مباشر
- ✅ تكامل OpenAI GPT-4
- ✅ بنية معمارية حديثة قائمة على المكونات
- ✅ Axios للاتصال بالـ API
- ✅ تكامل React Icons
- ✅ requirements.txt شامل
- ✅ إصلاحات ترميز Windows
صنع بـ ❤️ باستخدام Python و FastAPI
Made with ❤️ using Python and FastAPI