paraAI_rag / monitor_setup.sh
caarleexx's picture
Upload 6 files
d9446cd verified
#!/bin/bash
# monitor_setup.sh - Monitora progresso do setup em tempo real
SPACE_URL="$1"
if [ -z "$SPACE_URL" ]; then
echo "Uso: $0 <SPACE_URL>"
echo "Exemplo: $0 https://seu-usuario-para-ai-rag-0301.hf.space"
exit 1
fi
echo "Monitorando setup de: $SPACE_URL"
echo ""
while true; do
# Limpar tela
clear
echo "╔══════════════════════════════════════════════════════════════════════╗"
echo "║ PARA.AI RAG - MONITOR DE SETUP ║"
echo "╚══════════════════════════════════════════════════════════════════════╝"
echo ""
# Fazer request
RESPONSE=$(curl -s "$SPACE_URL/setup/status")
# Extrair campos
STATUS=$(echo $RESPONSE | jq -r '.status')
MESSAGE=$(echo $RESPONSE | jq -r '.message')
PROGRESS=$(echo $RESPONSE | jq -r '.progress')
TIMESTAMP=$(echo $RESPONSE | jq -r '.timestamp')
# Mostrar info
echo "Status: $STATUS"
echo "Progresso: $PROGRESS%"
echo "Mensagem: $MESSAGE"
echo "Timestamp: $TIMESTAMP"
echo ""
# Barra de progresso
BAR_WIDTH=50
FILLED=$((PROGRESS * BAR_WIDTH / 100))
EMPTY=$((BAR_WIDTH - FILLED))
printf "["
printf "%${FILLED}s" | tr ' ' '█'
printf "%${EMPTY}s" | tr ' ' '░'
printf "] %d%%
" $PROGRESS
echo ""
# Se completo, parar
if [ "$STATUS" = "ready" ]; then
echo "✅ SETUP COMPLETO!"
echo ""
echo "Testando cluster info..."
curl -s "$SPACE_URL/cluster/info" | jq
break
fi
if [ "$STATUS" = "error" ]; then
echo "❌ ERRO NO SETUP!"
break
fi
echo "Atualizando em 10 segundos..."
sleep 10
done