{"repo": "aleafarrel-id/aleas-intelligence", "files": {"README.md": {"16d8bcf38c6a95807e6e4ca790ffd6b130929441": {"t": 1785674375.3277287, "n": 9280, "h": "1bb9454a87a17d9f", "c": "# Alea's Intelligence\n\n## Project Description\n\n**Alea's Intelligence** is a dedicated application crafted to streamline communication with Artificial Intelligence. It's specifically designed to leverage APIs from various platforms, enabling seamless interaction with multiple AI models simultaneously. Currently, it integrates with **OpenRouter AI** and **Groq**, providing a versatile interface for diverse AI capabilities.\n\nNotably, this application is built entirely from the ground up using **native code**, without the assistance of any external frameworks. This approach allows for a lean and focused implementation.\n\n## Key Features\n\n- **Multi-Model AI Communication** \n Facilitates user interaction with different AI models concurrently, sending messages and receiving comprehensive responses.\n\n- **Audio Transcription** \n Utilizes Whisper AI to convert spoken input into text, preparing it for further processing by the integrated AI models.\n\n- **Intelligent Memory System** \n Manages conversation history and identifies pinned topics, ensuring that the AI receives relevant context for ongoing dialogues.\n\n## System Flow Diagrams\n\n
\n \"Simple\n
\n\n### AI Communication Flow\n\n![AI Communication Flow](pictures/ai_communication_flow.jpg)\n\nThis diagram illustrates how user messages are processed, dispatched to the AI, responses are received, and subsequently returned to the user interface. The flow incorporates robust input validation and mechanisms for handling request cancellations.\n\n### Audio Transcript Flow\n\n![Audio Transcript Flow](pictures/audio_transcript_flow.jpg)\n\nThis diagram outlines the comprehensive audio transcription process. It begins with audio input from the user, proceeds with transcription using Whisper AI, and then transmits the transcribed text to the AI model for further action.\n\n### Memory System Flow\n\n![Memory System Flow](pictures/memory_system_flow.jpg)\n\nThis diagram details how the memory system efficiently manages chat history. It intelligently checks for existing conversational context, integrates the three most recent chat histories along with any pinned topics into the current message, and forwards this enriched data to the AI proxy.\n\n---\n\n## System Requirements\n\n![Static Badge](https://img.shields.io/badge/LEMPP-Linux%20Nginx%20MySQL%20PHP%20PhpMyAdmin-orange)\n![Static Badge](https://img.shields.io/badge/Whisper%20AI-Voice%20Recognizer-blue)\n\n---\n\n### Web Server Configuration (Nginx)\n\n- `client_max_body_size 50M`: Configures the maximum permissible size for client request bodies, accommodating larger data transfers.\n- Dedicated server blocks are implemented for enhanced security, utilizing distinct domains for public and private folders. \n - **Public folder**: Where users interact with the AI application \n - **Private folder**: Used for managing AI APIs and models\n\n### PHP Configuration\n\n**CLI and FPM (`php.ini`)**\n\n- `upload_max_filesize = 50M`: Sets the maximum allowed size for file uploads.\n- `post_max_size = 50M`: Defines the maximum size for POST data, crucial for handling larger requests.\n\n> ⚠️ Ensure that `php-curl` is properly installed for robust communication capabilities.\n\n### MySQL Configuration\n\n- **Database**: `intelligence_db` \n Designated as the default database for the project, centralizing data storage.\n\n- Installation of **phpMyAdmin** is highly recommended for efficient and user-friendly database management.\n\n---\n\n## Whisper AI Installation\n\nTo set up Whisper AI for audio transcription, follow these steps:\n\n### 1. Install System Dependencies:\n\n```bash\nsudo apt update && sudo apt install ffmpeg python3-pip python3-venv -y\n```\n\n### 2. Create a New Virtual Environment:\n\n```bash\ncd /var/www/\npython3 -m venv whisper-env\nsource whisper-env/bin/activate\n```\n\n### 3. Upgrade Pip:\n\n```bash\npip install --upgrade pip\n```\n\n### 4. Install Torch:\n\n#### With CUDA (for GPU acceleration):\n\n```bash\npip install torch torchvision torchaudio\n```\n\n#### Without CUDA (CPU-only):\n\n```bash\npip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu\n```\n\n### 5. Install Whisper AI from GitHub:\n\n```bash\npip install git+https://github.com/openai/whisper.git\n```\n\n### 6. Grant Access Permissions for Whisper AI:\n\n```bash\nsudo chown -R www-data:www-data whisper-env\nsudo chmod -R 755 whisper-env\n```\n\n### 7. Grant Permissions for the Application:\n\n```bash\nsudo chown -R www-data:www-data /var/www/aleas-intelligence\nsudo chmod -R 755 aleas-intelligence\n```\n\n### 8. Test Installation\n\nUpon completing the installation, install the base Whisper AI model and verify its functionality by transcribing an audio file into text before integrating it into the main application.\n\nThere are five models that can be installed: tiny, base, small, medium and large\n\n```bash\nwhisper your-audio.mp3 --model base --language Indonesian --task transcribe --output_format txt\n```\n\n---\n\n## Usage\n\nTo set up and run **Alea's Intelligence**, follow these steps:\n\n### 1. Place the Repository in Your Web Server Directory\n\nClone or copy this repository into your web server's root directory, commonly:\n\n```bash\n/var/www/aleas-intelligence/\n```\n\nMake sure the directory structure remains intact, especially the separation between public and private folders.\n\n**After placing the repository in your web server directory, configure the connect.php file with your database credentials to enable data connectivity.**\n\n### 2. Set Proper Permissions\n\nEnsure that the server has the appropriate read/write permissions:\n\n```bash\nsudo chown -R www-data:www-data /var/www/aleas-intelligence\nsudo chmod -R 755 /var/www/aleas-intelligence\n```\n\n### 3. Import the Database\n\nUsing **phpMyAdmin** or the MySQL CLI, import the provided SQL file (`intelligence_db.sql`) into your MySQL server:\n\n```bash\nmysql -u root -p intelligence_db < /path/to/intelligence_db.sql\n```\n\nMake sure the database `intelligence_db` is created before running the import.\n\n### 4. Add API Credentials and AI Models via Admin Panel\n\nOpen the **admin/private panel** in your browser (e.g., `http://yourdomain.com/private/`) and log in (no authentication is required by default — you can implement it if needed).\n\nFrom there:\n\n- Navigate to the **API Management** section\n- Add one or more APIs with the following **required fields**:\n - `model_name` (e.g., `gpt-4`, `llama3-70b`)\n - `api_key` (get this from [OpenRouter](https://openrouter.ai) or [Groq](https://console.groq.com))\n - `url` (base URL for the API provider)\n\nExample for OpenRouter:\n- `model_name`: `mistralai/mixtral-8x7b`\n- `api_key`: `sk-...`\n- `url`: `https://openrouter.ai/api/v1/chat/completions`\n\nExample for Groq:\n- `model_name`: `llama3-70b-8192`\n- `api_key`: `gsk_...`\n- `url`: `https://api.groq.com/openai/v1/chat/completions`\n\n> The system uses `curl` to communicate with the external APIs, so ensure all credentials are correct.\n\n### 5. Configure PHP (If Not Yet Done)\n\nMake sure your `php.ini` includes:\n\n```ini\nupload_max_filesize = 50M\npost_max_size = 50M\n```\n\nAlso make sure `php-curl` is installed:\n\n```bash\nsudo apt install php-curl\n```\n### 6. Configure Whisper AI\n\nOnce Whisper AI is installed, configure the **voice_recognizer.php** file by adjusting it to match the **installation path** and the **model** used.\n\n### 7. Start Using the Application\n\nNavigate to your **public folder** (e.g., `http://yourdomain.com/`) to interact with the AI system. You can:\n\n- Send messages to different AI models\n- Upload audio to be transcribed\n- View context-aware replies thanks to the integrated memory system\n\nMake sure your web server (e.g., **Nginx**) is properly serving both the public and private directories with appropriate security settings.\n\n> ⚠️ For security, do not expose your private admin panel (`/private/`) to the public internet without restricting access.\n\n---\n\nYou’re now ready to use **Alea's Intelligence** to interact with multiple AI models in a streamlined and dynamic environment!\n\n## Preview\n\n### Light Mode\n![UI/UX Preview](pictures/frontend_1.png)\n\n![UI/UX Preview](pictures/frontend_2.png)\n\n![UI/UX Preview](pictures/frontend_3.png)\n\n![UI/UX Preview](pictures/frontend_4.png)\n\n### Dark Mode\n![UI/UX Preview](pictures/frontend_dark1.png)\n\n![UI/UX Preview](pictures/frontend_dark2.png)\n\n![UI/UX Preview](pictures/frontend_dark3.png)\n\n![UI/UX Preview](pictures/frontend_dark4.png)\n\n---\n\n## Contributing\n\nThis project is a labor of passion, shared with the community out of pure hobby interest. As such, there is currently no dedicated login portal implemented. If you are interested in contributing to this aspect or any other part of the project, your contributions are highly welcome!\n\n> Please note: I am sharing this project purely out of personal interest, and I am **not a professional programmer**—in fact, I don't even code. This project is a testament to what can be achieved through exploration and enthusiasm.\n\n## License\n\nThis project was created entirely out of personal passion. I am not a programmer, and truthfully, I might not even know how to code. You're completely free to use, modify, or distribute this project as you wish.\n\nI genuinely hope you enjoy using it. If you do, feel free to reach out to me via Instagram DM. 😊\n"}}}}