main.py aktualisiert
This commit is contained in:
@@ -1,53 +1,48 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from agent import Agent
|
from agent import Agent
|
||||||
from llm.bedrock_client import BedrockClient
|
from util.logger import get_logger
|
||||||
from client import MCPClient
|
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|
||||||
|
log = get_logger("NORA")
|
||||||
|
|
||||||
print("\n==============================")
|
print("\n==============================")
|
||||||
print(" JARVIS START")
|
print(" N.O.R.A START")
|
||||||
print("==============================\n")
|
print("==============================\n")
|
||||||
|
|
||||||
# 🧠 LLM (AWS Bedrock Nova)
|
agent = Agent()
|
||||||
llm = BedrockClient()
|
|
||||||
|
|
||||||
# 🤖 Agent
|
log.info("Connecting MCP...")
|
||||||
agent = Agent(llm)
|
|
||||||
|
|
||||||
# 🔌 MCP CONNECT (OpenHAB Remote)
|
|
||||||
await agent.mcp.connect()
|
await agent.mcp.connect()
|
||||||
|
|
||||||
# 🧠 Tools laden
|
log.info("Loading tools...")
|
||||||
await agent.load_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:
|
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
|
break
|
||||||
|
|
||||||
if not user_input:
|
if not user:
|
||||||
continue
|
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:
|
except KeyboardInterrupt:
|
||||||
break
|
break
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"\n[ERROR] {e}\n")
|
log.error(str(e))
|
||||||
|
|
||||||
# 🧹 Cleanup
|
await agent.mcp.close()
|
||||||
try:
|
|
||||||
await agent.mcp.close()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
print("\n[JARVIS] Shutdown abgeschlossen.")
|
log.info("Shutdown complete")
|
||||||
Reference in New Issue
Block a user