main.py aktualisiert
This commit is contained in:
@@ -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")
|
||||
|
||||
# 🧹 Cleanup
|
||||
try:
|
||||
await agent.mcp.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
await agent.mcp.close()
|
||||
print("\n[JARVIS] Shutdown abgeschlossen.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user