main.py aktualisiert
This commit is contained in:
@@ -1,65 +1,18 @@
|
|||||||
#!/usr/bin/env python3
|
from agent import run_agent
|
||||||
|
|
||||||
from llm import LLM
|
|
||||||
|
|
||||||
|
|
||||||
class Jarvis:
|
|
||||||
def __init__(self):
|
|
||||||
print("\n🤖 Starte Jarvis...\n")
|
|
||||||
|
|
||||||
self.llm = LLM()
|
|
||||||
|
|
||||||
print("✔ Jarvis ist bereit.\n")
|
|
||||||
|
|
||||||
def process(self, text: str):
|
|
||||||
|
|
||||||
text = text.strip()
|
|
||||||
|
|
||||||
if not text:
|
|
||||||
print("⚠ Keine Eingabe erkannt.")
|
|
||||||
return
|
|
||||||
|
|
||||||
if text.lower() in ["exit", "quit", "stop"]:
|
|
||||||
print("\nJarvis: Auf Wiedersehen.")
|
|
||||||
raise SystemExit
|
|
||||||
|
|
||||||
print("\n🧠 Denke...\n")
|
|
||||||
|
|
||||||
try:
|
|
||||||
answer = self.llm.ask(text)
|
|
||||||
|
|
||||||
if not answer:
|
|
||||||
print("⚠ Keine Antwort vom Modell erhalten.")
|
|
||||||
return
|
|
||||||
|
|
||||||
print("🤖 Jarvis:")
|
|
||||||
print(answer)
|
|
||||||
print()
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print("\n❌ Fehler im LLM:")
|
|
||||||
print(str(e))
|
|
||||||
print()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
print("JARVIS gestartet (OpenRouter + MCP)")
|
||||||
jarvis = Jarvis()
|
print("Tippe 'exit' zum Beenden\n")
|
||||||
|
|
||||||
print("=" * 50)
|
|
||||||
print("Jarvis Beta v0 – Chat Mode")
|
|
||||||
print("Tippe 'exit' zum Beenden")
|
|
||||||
print("=" * 50)
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
user = input("Du: ")
|
||||||
user_input = input("\nDu: ")
|
|
||||||
jarvis.process(user_input)
|
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
if user.lower() in ["exit", "quit"]:
|
||||||
print("\n\nJarvis gestoppt.")
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
response = run_agent(user)
|
||||||
|
|
||||||
|
print("JARVIS:", response)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
Reference in New Issue
Block a user