|
|
import os |
|
|
import json |
|
|
import logging |
|
|
from pathlib import Path |
|
|
|
|
|
class Bootstrap: |
|
|
def __init__(self, config_path): |
|
|
self.config_path = Path(config_path) |
|
|
self.config = self.load_config() |
|
|
|
|
|
def load_config(self): |
|
|
if self.config_path.exists(): |
|
|
return json.loads(self.config_path.read_text()) |
|
|
return {} |
|
|
|
|
|
def run(self): |
|
|
|
|
|
hive_home = Path(self.config.get("hive_home", "/data/hive_data")) |
|
|
for subdir in ["system", "users", "voice", "admin", "curves", "knowledge"]: |
|
|
(hive_home / subdir).mkdir(parents=True, exist_ok=True) |
|
|
|
|
|
|
|
|
from ..security.auth import Auth |
|
|
from ..voice.voiceprint import VoicePrint |
|
|
from ..voice.asr import ASR |
|
|
from ..convo.dialogue_manager import DialogueManager |
|
|
from ..persistence.persistence_engine import PersistenceEngine |
|
|
|
|
|
|
|
|
auth = Auth(hive_home) |
|
|
voiceprint = VoicePrint(hive_home) |
|
|
asr = ASR(hive_home) |
|
|
persistence = PersistenceEngine(hive_home) |
|
|
|
|
|
|
|
|
dialogue = DialogueManager(self.config, persistence, auth, voiceprint, asr) |
|
|
|
|
|
|
|
|
from .hive_core import HiveCore |
|
|
return HiveCore( |
|
|
dialogue=dialogue, |
|
|
persistence=persistence, |
|
|
security=type('Security', (), {'auth': auth})(), |
|
|
voice=type('Voice', (), {'voiceprint': voiceprint, 'asr': asr})(), |
|
|
convo=type('Convo', (), {'dialogue_manager': dialogue})() |
|
|
) |