Project architecture
Last updated
Last updated
The architecture of Hermes has been designed with a microservices approach in mind. This means that the system is composed of small, independently deployable services, each responsible for a specific within the overall workflow.
Overall, the architecture of Hermes can be represented in this way (with some simplifications):
This is the mobile application built using Flutter. It communicates exclusively with the Back-end API to send and receive data.
This component is developed using the Spring framework. It serves as a bridge between the mobile app and other back-end services. It handles requests from the mobile app and interacts with a MariaDB database to store and retrieve data.
This back-end is built with FastAPI and is responsible for direct communication with Telegram.
Also developed using FastAPI, this backend interacts directly with Docker. Specifically it handles everything related to hermes-reader
containers.
This process involves a series of Python scripts designed to manage and classify messages. In order for each script to be an independent micro-service, Redis is used so that the script takes the messages arriving from the previous step, processes them and sends them to the next step. Overall, the process is divided into these steps:
Fetches messages from selected Telegram groups and places them into Redis for further processing.
Takes the messages and cleans them up by removing emojis, unnecessary spaces, and other irrelevant content.
Converts messages from any language into English, as the AI models are designed to work with English text.
Processes the cleaned and translated messages by feeding them into three different AI models and collects the results.
Specifically the models, which were selected and used thanks to Hugging Face, are:
custom user model (fine-tuned from distilbert/distilbert-base-uncased + user feedback)
Interprets the results from the Classifier
to determine whether a message is interesting or not. The final result is calculated with these parameters:
Topic of the post
User preference for that topic
Result of the custom model
Based on these parameters, the message will then be marked as very interesting, interesting or will be deleted.
Sends messages deemed interesting to the mobile app to alert users of relevant content via Firebase Cloud Messaging (FCM).
Collects all the feedback generated by the user and uses it to retrain the user's custom model, improving its accuracy and performance over time.
A cron job is currently scheduled to run at midnight daily, executing the script and training the templates for all users in the system.