pi_admin/main.py aktualisiert

This commit is contained in:
2026-03-03 16:45:52 +00:00
parent 10211adf5b
commit 0d03712473

View File

@@ -85,6 +85,22 @@ async def chat_endpoint(websocket: WebSocket):
else:
await websocket.send_text(f"🤖 Ich habe empfangen: '{user_msg}'. Wie kann ich helfen?")
if "installiere ollama" in user_msg:
# Einfache Logik zur Erkennung des Ziel-Pis
target_ip = None
for ip, info in nodes.items():
if info['name'].lower() in user_msg or ip in user_msg:
target_ip = ip
break
if target_ip:
await websocket.send_text(f"🤖 Starte Ollama-Installation auf {nodes[target_ip]['name']} ({target_ip})...")
# Hier rufen wir die Installationsfunktion auf (Passwort-Handling beachten!)
result = install_ollama(target_ip, "pi", "DEIN_PASSWORT")
await websocket.send_text(f"✅ Ollama erfolgreich installiert auf {target_ip}.")
else:
await websocket.send_text("🤖 Auf welchem Pi soll ich Ollama installieren? (Nenne Name oder IP)")
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)