From e96eb8d4b1c6b4feb4df41c38b673e9cb032dc09 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Oct 2025 12:31:53 +0000 Subject: [PATCH 1/2] Initial plan From 1dadcf719da8eabfcf49ad868c647a8dff8027c8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Oct 2025 12:39:39 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20Enhance=20copilot-instructions.?= =?UTF-8?q?md=20with=20build,=20test,=20and=20lint=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: wasalstor-web <230709381+wasalstor-web@users.noreply.github.com> --- .github/copilot-instructions.md | 195 +++++++++++++++++++++++++++++++- 1 file changed, 191 insertions(+), 4 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 4cd6acc..7629e81 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -3,19 +3,136 @@ ## Project Overview This is an AI Agent Platform project designed to provide infrastructure and tools for building, deploying, and managing AI agents. The platform aims to facilitate the development of intelligent agents with focus on scalability, maintainability, and best practices. +### Key Features +- **DL+ Arabic Intelligence System**: A unified system for Arabic-first AI with advanced language processing +- **Multi-Model Support**: Integration with LLaMA 3, Qwen Arabic, AraBERT, Mistral, DeepSeek, and Phi-3 +- **OpenWebUI Integration**: Web interface for interactive AI model interaction +- **FastAPI Backend**: RESTful API for agent communication and command execution +- **Automated Deployment**: Scripts for VPS deployment, GitHub Pages hosting, and Hostinger integration +- **Bilingual Support**: Full Arabic and English interface and documentation + +### Project Structure +``` +AI-Agent-Platform/ +├── dlplus/ # DL+ system core +│ ├── core/ # Intelligence core, Arabic processor, context analyzer +│ ├── agents/ # AI agents (base, code generator, web retrieval) +│ ├── api/ # FastAPI connectors and internal APIs +│ ├── config/ # Settings, model configs, agent configs +│ ├── utils/ # Helper functions and logging +│ └── main.py # FastAPI application entry point +├── tests/ # pytest test suite +│ ├── test_core.py +│ ├── test_agents.py +│ └── test_arabic_processor.py +├── api/ # API documentation and examples +├── examples/ # Usage examples and demos +├── .github/ # GitHub configuration and workflows +├── requirements.txt # Python dependencies +└── *.sh # Deployment and management scripts +``` + ## Tech Stack - **Architecture**: Platform-based architecture for AI agents +- **Languages**: Python (primary), Shell scripting, HTML/JavaScript +- **Web Framework**: FastAPI for REST APIs +- **AI/ML**: Support for various models (LLaMA 3, Qwen Arabic, AraBERT, etc.) +- **Testing**: pytest, pytest-asyncio, pytest-cov +- **Code Quality**: black (formatter), flake8 (linter), mypy (type checker) +- **Deployment**: Docker, Nginx, OpenWebUI integration - **Version Control**: Git with GitHub -- **Languages**: Follow the conventions of the specific language being used + +## Installation and Setup + +### Python Dependencies +```bash +# Install Python dependencies +pip install -r requirements.txt + +# For development, install with all dev dependencies +pip install -r requirements.txt +``` + +### DL+ System Setup +```bash +# Start the DL+ system (FastAPI server on port 8000) +./start-dlplus.sh + +# Alternative: Run directly with uvicorn +cd dlplus +python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000 +``` + +### OpenWebUI Setup +```bash +# Install and configure OpenWebUI +./setup-openwebui.sh + +# Deploy OpenWebUI integration +./deploy-openwebui-integration.sh +``` + +## Build Commands + +This project primarily uses Python and doesn't require compilation. However, for deployment: + +```bash +# Verify Python environment +python3 --version + +# Install/update dependencies +pip install -r requirements.txt + +# Validate DL+ system configuration +./validate-dlplus.sh +``` + +## Test Commands + +```bash +# Run all tests with pytest +pytest + +# Run tests with coverage report +pytest --cov=dlplus --cov-report=html --cov-report=term + +# Run specific test file +pytest tests/test_core.py + +# Run tests with verbose output +pytest -v + +# Run async tests specifically +pytest -v tests/ -k "async" +``` + +## Lint Commands + +```bash +# Format code with black (auto-fix) +black . +black dlplus/ tests/ + +# Check code style with flake8 +flake8 dlplus/ tests/ + +# Type checking with mypy +mypy dlplus/ + +# Run all quality checks at once +black --check . && flake8 dlplus/ tests/ && mypy dlplus/ +``` ## Code Style Guidelines - Use clear and descriptive variable names that reflect their purpose -- Follow consistent indentation based on language conventions (e.g., 4 spaces for Python, 2 spaces for JavaScript/TypeScript) +- Follow PEP 8 style guide for Python code +- Use 4 spaces for indentation in Python - Keep functions small and focused on a single responsibility - Write self-documenting code with minimal but meaningful comments -- Use camelCase for variables and functions, PascalCase for classes -- Maximum line length: 120 characters +- Use snake_case for variables and functions, PascalCase for classes in Python +- Maximum line length: 120 characters (configured in black and flake8) - Add blank lines to separate logical blocks of code +- Use type hints in Python for better code clarity and IDE support ## Security Best Practices - Never commit sensitive data (API keys, credentials, tokens) to the repository @@ -94,6 +211,50 @@ This is an AI Agent Platform project designed to provide infrastructure and tool - Maintain a clean commit history - Use pull requests for code review +## Deployment and Environment Configuration + +### Environment Variables +The project uses `.env` files for configuration. Never commit `.env` files with actual credentials. + +```bash +# Available example configurations +.env.example # Basic configuration template +.env.dlplus.example # DL+ system configuration +.env.instant-deploy.example # Instant deployment configuration +.env.openwebui # OpenWebUI configuration + +# Copy and configure for your environment +cp .env.example .env +# Edit .env with your settings +``` + +### Key Environment Variables +- `VPS_HOST` - VPS hostname or IP address +- `VPS_USER` - SSH username +- `VPS_PORT` - SSH port +- `OPENWEBUI_PORT` - OpenWebUI port (default: 3000) +- `OLLAMA_API_BASE_URL` - Ollama API URL +- `WEBUI_SECRET_KEY` - Secret key for OpenWebUI (generate with `openssl rand -hex 32`) +- API keys for various AI models (never commit these) + +### Deployment Scripts +```bash +# Deploy to GitHub Pages +git push origin main # Automatic deployment via GitHub Actions + +# Deploy DL+ system +./start-dlplus.sh + +# Check VPS deployment status +./deploy.sh --host your-vps.com + +# Smart deployment with menu +./smart-deploy.sh + +# Complete deployment +./complete-deployment.sh +``` + ## AI Agent Specific Guidelines - Design agents with clear, single responsibilities - Implement proper agent lifecycle management @@ -103,3 +264,29 @@ This is an AI Agent Platform project designed to provide infrastructure and tool - Include proper agent state management - Implement graceful agent shutdown procedures - Consider agent resource consumption and optimization + +### Working with DL+ System +- All DL+ core components are in the `dlplus/` directory +- Use FastAPI dependency injection for services +- Implement async/await for all I/O operations +- Arabic text processing should use the `arabic_processor.py` module +- All agents must inherit from `BaseAgent` class +- Configuration should be loaded from `dlplus/config/` modules +- Use structured logging from `dlplus/utils/logger.py` + +### FastAPI Development Guidelines +- Define routes in appropriate API modules +- Use Pydantic models for request/response validation +- Implement proper error handling with HTTPException +- Use dependency injection for database and service access +- Document all endpoints with proper OpenAPI descriptions +- Implement rate limiting and authentication where needed +- Test API endpoints with pytest-asyncio + +### Arabic Language Processing +- Use the `arabic_processor.py` for all Arabic text operations +- Support both Modern Standard Arabic (MSA) and dialectal variants +- Implement proper Arabic text normalization +- Handle right-to-left (RTL) text correctly +- Consider Arabic-specific NLP models (AraBERT, CAMeLBERT) +- Test with both Arabic and English inputs