main.py aktualisiert
This commit is contained in:
@@ -1,42 +1,53 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from agent import Agent
|
from agent import Agent
|
||||||
|
from llm.bedrock_client import BedrockClient
|
||||||
|
from mcp.client import MCPClient
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
print("\n==============================")
|
print("\n==============================")
|
||||||
print(" JARVIS MCP TERMINAL")
|
print(" JARVIS START")
|
||||||
print("==============================\n")
|
print("==============================\n")
|
||||||
|
|
||||||
agent = Agent()
|
# 🧠 LLM (AWS Bedrock Nova)
|
||||||
|
llm = BedrockClient()
|
||||||
|
|
||||||
# 🔌 MCP verbinden
|
# 🤖 Agent
|
||||||
|
agent = Agent(llm)
|
||||||
|
|
||||||
|
# 🔌 MCP CONNECT (OpenHAB Remote)
|
||||||
await agent.mcp.connect()
|
await agent.mcp.connect()
|
||||||
|
|
||||||
# 🧠 Tools laden (OpenHAB MCP)
|
# 🧠 Tools laden
|
||||||
await agent.load_tools()
|
await agent.load_tools()
|
||||||
|
|
||||||
print("\n[JARVIS] System bereit. Tippe 'exit' zum Beenden.\n")
|
print("\n[JARVIS] System bereit. Tippe 'exit' zum Beenden.\n")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
user_input = input("Du: ")
|
user_input = input("Du: ").strip()
|
||||||
|
|
||||||
if user_input.lower() in ["exit", "quit"]:
|
if user_input.lower() in ["exit", "quit"]:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if not user_input:
|
||||||
|
continue
|
||||||
|
|
||||||
response = await agent.run(user_input)
|
response = await agent.run(user_input)
|
||||||
|
|
||||||
print(f"JARVIS: {response}\n")
|
print(f"\nJARVIS: {response}\n")
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
break
|
break
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[ERROR] {e}")
|
print(f"\n[ERROR] {e}\n")
|
||||||
|
|
||||||
await agent.mcp.close()
|
# 🧹 Cleanup
|
||||||
print("\n[JARVIS] Shutdown abgeschlossen.")
|
try:
|
||||||
|
await agent.mcp.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
print("\n[JARVIS] Shutdown abgeschlossen.")
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(main())
|
|
||||||
Reference in New Issue
Block a user