diff --git a/hendrik.py b/hendrik.py index 4d004bd..65683f3 100644 --- a/hendrik.py +++ b/hendrik.py @@ -1,14 +1,17 @@ -import os, sys, threading, time -import signal +import os, sys, threading, time, signal import config -from services.xmpp_client import XMPPClient - -from scripts.llm_client import LLMClient from tools import coder, rag, carrack -from scripts import gadget -from scripts.personality import build_system_prompt + +from services.xmpp_client import XMPPClient +from services.telegram_client import TelegramClient + +from services.llm_client import LLMClient +from scripts.personality import build_system_prompt +from scripts import gadget + +from tui import HendrikTUI tools_definition = [ @@ -46,7 +49,6 @@ def main(): i += 2 else: i += 1 - if workspace: resolved = os.path.abspath(workspace) if not os.path.isdir(resolved): @@ -74,8 +76,6 @@ def main(): services.append(client) if config.TELEGRAM_ENABLED: - from services.telegram_client import TelegramClient - allowed_ids = [] if config.TELEGRAM_ALLOWED_GROUP_IDS.strip(): allowed_ids = [r.strip() for r in config.TELEGRAM_ALLOWED_GROUP_IDS.split(',') if r.strip()] @@ -108,8 +108,8 @@ def main(): svc.stop() _shutdown = True - signal.signal(signal.SIGTERM, _handle_sig) - signal.signal(signal.SIGINT, _handle_sig) + signal.signal(signal.SIGTERM, _handle_sig) # Handling interupt + signal.signal(signal.SIGINT, _handle_sig) # Handling terminate try: while not _shutdown: @@ -117,8 +117,8 @@ def main(): except KeyboardInterrupt: _shutdown = True print("Exiting.", flush=True) + else: - from tui import HendrikTUI HendrikTUI( llm_client = llm_client, tools_definition = tools_definition,