pi_admin/main.py aktualisiert

This commit is contained in:
2026-03-03 16:42:02 +00:00
parent d1d12e6e23
commit 10211adf5b

View File

@@ -48,6 +48,24 @@ def run_ssh_cmd(ip, user, password, cmd):
except Exception as e:
return str(e)
# --- Ollama installation Logic ---
def install_ollama(ip, user, password, is_local=False):
install_cmd = "curl -fsSL https://ollama.com/install.sh | sh"
if is_local:
# Installation auf dem Master-Pi
import subprocess
try:
process = subprocess.Popen(install_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
return f"Lokal: {stdout.decode()}"
except Exception as e:
return f"Lokal Fehler: {str(e)}"
else:
# Installation auf einem Worker-Node via SSH
return run_ssh_cmd(ip, user, password, install_cmd)
# --- Chat & AI Logic ---
@app.websocket("/ws/chat")