main.py aktualisiert
This commit is contained in:
@@ -1,18 +1,42 @@
|
|||||||
from agent import run_agent
|
import asyncio
|
||||||
|
from agent import Agent
|
||||||
|
|
||||||
def main():
|
|
||||||
print("JARVIS gestartet (OpenRouter + MCP)")
|
async def main():
|
||||||
print("Tippe 'exit' zum Beenden\n")
|
print("\n==============================")
|
||||||
|
print(" JARVIS MCP TERMINAL")
|
||||||
|
print("==============================\n")
|
||||||
|
|
||||||
|
agent = Agent()
|
||||||
|
|
||||||
|
# 🔌 MCP verbinden
|
||||||
|
await agent.mcp.connect()
|
||||||
|
|
||||||
|
# 🧠 Tools laden (OpenHAB MCP)
|
||||||
|
await agent.load_tools()
|
||||||
|
|
||||||
|
print("\n[JARVIS] System bereit. Tippe 'exit' zum Beenden.\n")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user = input("Du: ")
|
try:
|
||||||
|
user_input = input("Du: ")
|
||||||
|
|
||||||
if user.lower() in ["exit", "quit"]:
|
if user_input.lower() in ["exit", "quit"]:
|
||||||
break
|
break
|
||||||
|
|
||||||
response = run_agent(user)
|
response = await agent.run(user_input)
|
||||||
|
|
||||||
|
print(f"JARVIS: {response}\n")
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
break
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[ERROR] {e}")
|
||||||
|
|
||||||
|
await agent.mcp.close()
|
||||||
|
print("\n[JARVIS] Shutdown abgeschlossen.")
|
||||||
|
|
||||||
print("JARVIS:", response)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
asyncio.run(main())
|
||||||
Reference in New Issue
Block a user