From 5eb7c696009b2988d229dd055817d31e07195840 Mon Sep 17 00:00:00 2001 From: Till Immer Date: Sun, 5 Jul 2026 09:18:06 +0000 Subject: [PATCH] main.py aktualisiert --- main.py | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 2aca508..c59898d 100644 --- a/main.py +++ b/main.py @@ -1,42 +1,53 @@ import asyncio + from agent import Agent +from llm.bedrock_client import BedrockClient +from mcp.client import MCPClient async def main(): print("\n==============================") - print(" JARVIS MCP TERMINAL") + print(" JARVIS START") print("==============================\n") - agent = Agent() + # ๐Ÿง  LLM (AWS Bedrock Nova) + llm = BedrockClient() - # ๐Ÿ”Œ MCP verbinden + # ๐Ÿค– Agent + agent = Agent(llm) + + # ๐Ÿ”Œ MCP CONNECT (OpenHAB Remote) await agent.mcp.connect() - # ๐Ÿง  Tools laden (OpenHAB MCP) + # ๐Ÿง  Tools laden await agent.load_tools() print("\n[JARVIS] System bereit. Tippe 'exit' zum Beenden.\n") while True: try: - user_input = input("Du: ") + user_input = input("Du: ").strip() if user_input.lower() in ["exit", "quit"]: break + if not user_input: + continue + response = await agent.run(user_input) - print(f"JARVIS: {response}\n") + print(f"\nJARVIS: {response}\n") except KeyboardInterrupt: break except Exception as e: - print(f"[ERROR] {e}") + print(f"\n[ERROR] {e}\n") - await agent.mcp.close() - print("\n[JARVIS] Shutdown abgeschlossen.") + # ๐Ÿงน Cleanup + try: + await agent.mcp.close() + except: + pass - -if __name__ == "__main__": - asyncio.run(main()) \ No newline at end of file + print("\n[JARVIS] Shutdown abgeschlossen.") \ No newline at end of file