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.
Notably, 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.
-
Multi-Model AI Communication
Facilitates user interaction with different AI models concurrently, sending messages and receiving comprehensive responses. -
Audio Transcription
Utilizes Whisper AI to convert spoken input into text, preparing it for further processing by the integrated AI models. -
Intelligent Memory System
Manages conversation history and identifies pinned topics, ensuring that the AI receives relevant context for ongoing dialogues.
This 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.
This 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.
This 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.
client_max_body_size 50M
: Configures the maximum permissible size for client request bodies, accommodating larger data transfers.- Dedicated server blocks are implemented for enhanced security, utilizing distinct domains for public and private folders.
- Public folder: Where users interact with the AI application
- Private folder: Used for managing AI APIs and models
CLI and FPM (php.ini
)
upload_max_filesize = 50M
: Sets the maximum allowed size for file uploads.post_max_size = 50M
: Defines the maximum size for POST data, crucial for handling larger requests.
⚠️ Ensure thatphp-curl
is properly installed for robust communication capabilities.
-
Database:
intelligence_db
Designated as the default database for the project, centralizing data storage. -
Installation of phpMyAdmin is highly recommended for efficient and user-friendly database management.
To set up Whisper AI for audio transcription, follow these steps:
sudo apt update && sudo apt install ffmpeg python3-pip python3-venv -y
cd /var/www/
python3 -m venv whisper-env
source whisper-env/bin/activate
pip install --upgrade pip
pip install torch torchvision torchaudio
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install git+https://github.com/openai/whisper.git
sudo chown -R www-data:www-data whisper-env
sudo chmod -R 755 whisper-env
sudo chown -R www-data:www-data /var/www/aleas-intelligence
sudo chmod -R 755 aleas-intelligence
Upon 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.
There are five models that can be installed: tiny, base, small, medium and large
whisper your-audio.mp3 --model base --language Indonesian --task transcribe --output_format txt
To set up and run Alea's Intelligence, follow these steps:
Clone or copy this repository into your web server's root directory, commonly:
/var/www/aleas-intelligence/
Make sure the directory structure remains intact, especially the separation between public and private folders.
After placing the repository in your web server directory, configure the connect.php file with your database credentials to enable data connectivity.
Ensure that the server has the appropriate read/write permissions:
sudo chown -R www-data:www-data /var/www/aleas-intelligence
sudo chmod -R 755 /var/www/aleas-intelligence
Using phpMyAdmin or the MySQL CLI, import the provided SQL file (intelligence_db.sql
) into your MySQL server:
mysql -u root -p intelligence_db < /path/to/intelligence_db.sql
Make sure the database intelligence_db
is created before running the import.
Open 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).
From there:
- Navigate to the API Management section
- Add one or more APIs with the following required fields:
model_name
(e.g.,gpt-4
,llama3-70b
)api_key
(get this from OpenRouter or Groq)url
(base URL for the API provider)
Example for OpenRouter:
model_name
:mistralai/mixtral-8x7b
api_key
:sk-...
url
:https://openrouter.ai/api/v1/chat/completions
Example for Groq:
model_name
:llama3-70b-8192
api_key
:gsk_...
url
:https://api.groq.com/openai/v1/chat/completions
The system uses
curl
to communicate with the external APIs, so ensure all credentials are correct.
Make sure your php.ini
includes:
upload_max_filesize = 50M
post_max_size = 50M
Also make sure php-curl
is installed:
sudo apt install php-curl
Once Whisper AI is installed, configure the voice_recognizer.php file by adjusting it to match the installation path and the model used.
Navigate to your public folder (e.g., http://yourdomain.com/
) to interact with the AI system. You can:
- Send messages to different AI models
- Upload audio to be transcribed
- View context-aware replies thanks to the integrated memory system
Make sure your web server (e.g., Nginx) is properly serving both the public and private directories with appropriate security settings.
⚠️ For security, do not expose your private admin panel (/private/
) to the public internet without restricting access.
You’re now ready to use Alea's Intelligence to interact with multiple AI models in a streamlined and dynamic environment!
This 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!
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.
This 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.
I genuinely hope you enjoy using it. If you do, feel free to reach out to me via Instagram DM. 😊