File size: 1,862 Bytes
d9446cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/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