#!/bin/bash
# Wait for generation completion then show timings
for i in $(seq 1 60); do
    sleep 5
    if tail -3 /home/fabian/comfyui8.log | grep -q "Prompt executed"; then
        echo "=== DONE ==="
        grep -E "VAE decode|Prompt executed|Requested|loaded completely|Loading VAE|cached" /home/fabian/comfyui8.log | tail -12
        exit 0
    fi
    PROG=$(grep -oP '\d+%\|.*' /home/fabian/comfyui8.log | tail -1)
    echo "[$i] $PROG"
done
echo "TIMEOUT"
