From 4ac24385b6528aaae9991f052dec4fec6f89406d Mon Sep 17 00:00:00 2001 From: Andriamanampisoa Date: Sun, 7 Dec 2025 16:04:49 +0900 Subject: [PATCH 1/3] chore: setup ba service folders and components --- .../behavior-analyzer/engine/baServices.py | 21 +++++++++ .../behavior-analyzer/engine/enumMcs.py | 43 +++++++++++++++++++ .../behavior-analyzer/engine/notifications.py | 35 +++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 ai/microservices/behavior-analyzer/engine/baServices.py create mode 100644 ai/microservices/behavior-analyzer/engine/enumMcs.py create mode 100644 ai/microservices/behavior-analyzer/engine/notifications.py diff --git a/ai/microservices/behavior-analyzer/engine/baServices.py b/ai/microservices/behavior-analyzer/engine/baServices.py new file mode 100644 index 00000000..c06791bd --- /dev/null +++ b/ai/microservices/behavior-analyzer/engine/baServices.py @@ -0,0 +1,21 @@ +## +## Talkup Project, 2025 +## TalkUp.AI +## File description: +## This module handles the behavior-analyzer microservice. +## + +import queue +import sys +import json +import sounddevice as sd +import engine.enumMcs as enumMcs + +from .notifications import Notifications + +class BA(): + def __init__(self): + """ + Class constructor + """ + pass diff --git a/ai/microservices/behavior-analyzer/engine/enumMcs.py b/ai/microservices/behavior-analyzer/engine/enumMcs.py new file mode 100644 index 00000000..6003379c --- /dev/null +++ b/ai/microservices/behavior-analyzer/engine/enumMcs.py @@ -0,0 +1,43 @@ +## +## Talkup Project, 2025 +## TalkUp.AI +## File description: +## This file defines the enumerations for microservices. +## + +from enum import Enum + +class MicroservicesNames(Enum): + BA = 0 + EA = 1 + STT = 2 + TTS = 3 + VA = 4 + +class NotificationTypes(): + def __init__(self): + self.types = { + 0: { + "type": "INFO", + "emoji": "💡" + }, + 1: { + "type": "WARNING", + "emoji": "⚠️" + }, + 2: { + "type": "ERROR", + "emoji": "❗" + } + } + def get_type(self, type_id: int) -> str: + """ + Get the type of notification by its ID. + """ + return self.types.get(type_id, {}).get("type", "UNKNOWN") + + def get_emoji(self, type_id: int) -> str: + """ + Get the emoji for the notification type by its ID. + """ + return self.types.get(type_id, {}).get("emoji", "❓") diff --git a/ai/microservices/behavior-analyzer/engine/notifications.py b/ai/microservices/behavior-analyzer/engine/notifications.py new file mode 100644 index 00000000..fac964b2 --- /dev/null +++ b/ai/microservices/behavior-analyzer/engine/notifications.py @@ -0,0 +1,35 @@ +## +## Talkup Project, 2025 +## TalkUp.AI +## File description: +## Handles notifications for the TalkUp AI microservices. +## + +import engine.enumMcs as enumMcs + +class Notifications(): + def __init__(self): + """ + Class constructor + """ + pass + + def send_notification(self, service: enumMcs.MicroservicesNames, type_id: int, + msg: str) -> None: + """ + Send a notification to the console + """ + type = enumMcs.NotificationTypes() + + print(f"[{type.get_type(type_id)}|{service.name}] {type.get_emoji(type_id)} {msg}", end='\n') + + def send_start_notification(self, service: enumMcs.MicroservicesNames, successful: bool)-> None: + """ + Send a start notification to the console with the status of the service. + """ + type = enumMcs.NotificationTypes() + + if (successful): + print (f"[SERVICES] {type.get_emoji(0)} {service.name} started successfully!") + else: + print (f"[SERVICES] {type.get_emoji(2)} Failed to start {service.name}") From 73d249edc400411dee0ee372406b0a15b877d727 Mon Sep 17 00:00:00 2001 From: Andriamanampisoa Date: Sun, 7 Dec 2025 16:09:41 +0900 Subject: [PATCH 2/3] build: add new dependencies to the requirement.txt of the ba service --- ai/microservices/behavior-analyzer/requirements.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ai/microservices/behavior-analyzer/requirements.txt b/ai/microservices/behavior-analyzer/requirements.txt index b90088ba..2761fc35 100644 --- a/ai/microservices/behavior-analyzer/requirements.txt +++ b/ai/microservices/behavior-analyzer/requirements.txt @@ -7,3 +7,7 @@ MarkupSafe==3.0.2 Werkzeug==3.1.3 pydantic==2.5.1 fastapi==0.101.1 +opencv-python==4.7.0.72 +mediapipe==0.10.21 +numpy==1.23.5 +protobuf==4.25.3 From 07932864d210f81e4e4cf6a316955758bc6dbe41 Mon Sep 17 00:00:00 2001 From: Andriamanampisoa Date: Sun, 7 Dec 2025 18:22:57 +0900 Subject: [PATCH 3/3] build: add new dependencies to the requirement.txt of the ba service --- .../behavior-analyzer/requirements.txt | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ai/microservices/behavior-analyzer/requirements.txt b/ai/microservices/behavior-analyzer/requirements.txt index 2761fc35..670d22c5 100644 --- a/ai/microservices/behavior-analyzer/requirements.txt +++ b/ai/microservices/behavior-analyzer/requirements.txt @@ -1,13 +1,15 @@ -blinker==1.9.0 -click==8.2.1 Flask==3.1.1 itsdangerous==2.2.0 -Jinja2==3.1.6 -MarkupSafe==3.0.2 -Werkzeug==3.1.3 pydantic==2.5.1 fastapi==0.101.1 -opencv-python==4.7.0.72 -mediapipe==0.10.21 -numpy==1.23.5 -protobuf==4.25.3 +numpy==1.24.4 +torch==2.1.2 +torchvision==0.16.2 +torchaudio==2.1.2 +opencv-python>=4.8.0 +openmim +mmengine>=0.10.0 +mmcv==2.1.0 +mmdet==3.3.0 +mmpose==1.3.2 +transformers==4.40.1