From ac96a7d5726c0052e8890748c55ea39707f4503a Mon Sep 17 00:00:00 2001 From: Till Immer Date: Sat, 4 Jul 2026 21:38:12 +0000 Subject: [PATCH] main.py aktualisiert --- main.py | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index f52fdf7..2aca508 100644 --- a/main.py +++ b/main.py @@ -1,18 +1,42 @@ -from agent import run_agent +import asyncio +from agent import Agent -def main(): - print("JARVIS gestartet (OpenRouter + MCP)") - print("Tippe 'exit' zum Beenden\n") + +async def main(): + print("\n==============================") + print(" JARVIS MCP TERMINAL") + print("==============================\n") + + agent = Agent() + + # 🔌 MCP verbinden + await agent.mcp.connect() + + # 🧠 Tools laden (OpenHAB MCP) + await agent.load_tools() + + print("\n[JARVIS] System bereit. Tippe 'exit' zum Beenden.\n") while True: - user = input("Du: ") + try: + user_input = input("Du: ") - if user.lower() in ["exit", "quit"]: + if user_input.lower() in ["exit", "quit"]: + break + + response = await agent.run(user_input) + + print(f"JARVIS: {response}\n") + + except KeyboardInterrupt: break - response = run_agent(user) + except Exception as e: + print(f"[ERROR] {e}") + + await agent.mcp.close() + print("\n[JARVIS] Shutdown abgeschlossen.") - print("JARVIS:", response) if __name__ == "__main__": - main() \ No newline at end of file + asyncio.run(main()) \ No newline at end of file