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