feat(libs): integrate Ollama and Whisper clients with config models

- Add `AppConfig` and `PresetConfig` models using Pydantic for config validation
- Refactor `read_configurations` to return an `AppConfig` instance
- Implement `OllamaClient` for chat-based server interaction
- Implement `WhisperClient` for transcription via Whisper CLI
- Migrate notification utilities to `libs` directory
- Update tray application to use new clients and config structure
- Simplify Whisper and Ollama integration logic in `WhisperWorker`

Signed-off-by: Max P. <Mail@MPassarello.de>
This commit is contained in:
2025-05-05 12:00:33 +02:00
parent 5688769437
commit 58b9cb586c
6 changed files with 182 additions and 88 deletions

View File

@@ -2,9 +2,11 @@ import json
import os
from pathlib import Path
from pyvtt.models.config import AppConfig
DEFAULT_CONFIG_PATH = Path.home() / ".pyvtt.json"
def read_configurations():
def read_configurations() -> AppConfig:
"""
Reads the configuration settings from a JSON file named 'pyvtt.settings.json'
located in the same directory as the script.
@@ -18,7 +20,8 @@ def read_configurations():
"""
try:
with open(DEFAULT_CONFIG_PATH) as f:
return json.load(f)
raw_config = json.load(f)
return AppConfig(**raw_config)
except Exception as e:
print(f"Error reading configurations: {e}")
raise Exception(f"Error reading configurations: {e}")