pi_admin/main.py aktualisiert
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user