Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/ui/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, message_timeout=5, exit_callback=None):
def setup_ui(self):
"""Set up the user interface."""
# Main window configuration
self.setWindowTitle("Jasper Assistant")
self.setWindowTitle(f"{config.ASSISTANT_NAME} Assistant")
self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setGeometry(
Expand Down Expand Up @@ -210,14 +210,15 @@ def process_messages(self):

elif msg_type == "response":
text = args[0]
self.add_log_message(f"Jasper: {text}", "#00FF00") # Green
self.add_log_message(f"{config.ASSISTANT_NAME}: {text}", "#00FF00")
# Green

except Exception as e:
logger.error(f"Error processing message: {e}")

def start(self):
"""Start the overlay."""
self.update_status("Jasper Active", "lightgreen")
self.update_status(f"{config.ASSISTANT_NAME} Active", "lightgreen")

def shutdown(self):
"""Shut down the overlay."""
Expand All @@ -241,7 +242,7 @@ def main():

# Demo updating
QTimer.singleShot(1000, lambda: overlay.update_status("Listening", "lightblue"))
QTimer.singleShot(2000, lambda: overlay.add_log_message("Jasper, what's the weather today?"))
lambda: overlay.add_log_message(f"{config.ASSISTANT_NAME}, what's the weather today?")
QTimer.singleShot(3000, lambda: overlay.update_status("Processing", "yellow"))
QTimer.singleShot(4000, lambda: overlay.update_status("Responding", "lightgreen"))
QTimer.singleShot(
Expand Down
14 changes: 9 additions & 5 deletions src/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from colorama import Fore, Style, init as colorama_init

from src.config import config
from src.config import BASE_DIR, config

colorama_init(autoreset=True)

Expand Down Expand Up @@ -54,11 +54,12 @@ def get_logger(level=config.LOG_LEVEL):
if level is None:
level = "INFO"

# Create log file path
log_file = f"logs/{module_name}.log"
# Create log file path relative to the project root
logs_dir = os.path.join(BASE_DIR, "logs")
log_file = os.path.join(logs_dir, f"{module_name}.log")

# Ensure logs directory exists
os.makedirs("logs", exist_ok=True)
os.makedirs(logs_dir, exist_ok=True)

formatter = ColoredFormatter(
"[%(asctime)s] %(levelname)s [%(filename)s]: %(message)s",
Expand All @@ -70,7 +71,10 @@ def get_logger(level=config.LOG_LEVEL):
handler.setFormatter(formatter)

# Global log file handler
global_handler = logging.FileHandler("logs/global.log", encoding="utf-8")
global_handler = logging.FileHandler(
os.path.join(logs_dir, "global.log"),
encoding="utf-8",
)
global_handler.setFormatter(formatter)

# Console handler
Expand Down
Loading