#!/bin/bash
set -e

echo "🚀 Starting AI stack containers..."

start_container() {
  local name=$1
  local cmd=$2

  if docker ps --format '{{.Names}}' | grep -q "^$name$"; then
    echo "✅ $name already running."
  elif docker container ls -a --format '{{.Names}}' | grep -q "^$name$"; then
    echo "🔁 Starting $name..."
    docker start "$name"
  else
    echo "❌ $name not found — skipping."
  fi
}

# Core tools (prebuilt)
start_container open-webui
start_container jupyterlab
start_container comfyui
start_container whisper
start_container stable-diffusion
start_container localai

# Custom-built (may need rebuilding if deleted)
start_container whispercpp-gpu
start_container a1111-webui
start_container tg-webui

echo "✅ All available containers started."