Vanderson da Silva Quintino commited on
Commit
161bcba
·
1 Parent(s): 2d3aa2b

feat: progress steps

Browse files
src/ClipForge.Api/wwwroot/index.html CHANGED
@@ -216,7 +216,26 @@
216
 
217
  btn.disabled = true;
218
  status.className = 'status loading';
219
- status.innerHTML = '<span class="spinner"></span> Gerando vídeo... isso pode levar alguns minutos';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
  try {
222
  const res = await fetch(`${API}/api/pipeline/run-sync`, {
@@ -225,6 +244,8 @@
225
  body: JSON.stringify({ niche, platform, tone: 'engaging', language: 'pt-BR', voiceId: voice })
226
  });
227
 
 
 
228
  if (res.ok) {
229
  status.className = 'status success';
230
  status.textContent = '✅ Vídeo gerado com sucesso!';
@@ -232,9 +253,10 @@
232
  } else {
233
  const err = await res.text();
234
  status.className = 'status error';
235
- status.textContent = '❌ Erro: ' + err.substring(0, 100);
236
  }
237
  } catch (e) {
 
238
  status.className = 'status error';
239
  status.textContent = '❌ Erro de conexão: ' + e.message;
240
  }
 
216
 
217
  btn.disabled = true;
218
  status.className = 'status loading';
219
+
220
+ const steps = [
221
+ '🧠 Gerando ideia viral...',
222
+ '📝 Escrevendo roteiro...',
223
+ '🎙️ Gerando narração...',
224
+ '🎬 Baixando clips do YouTube...',
225
+ '🎞️ Montando vídeo...',
226
+ '💬 Adicionando legendas...',
227
+ '✨ Finalizando...'
228
+ ];
229
+
230
+ let stepIndex = 0;
231
+ status.innerHTML = `<span class="spinner"></span> ${steps[0]}`;
232
+
233
+ const stepInterval = setInterval(() => {
234
+ stepIndex++;
235
+ if (stepIndex < steps.length) {
236
+ status.innerHTML = `<span class="spinner"></span> ${steps[stepIndex]}`;
237
+ }
238
+ }, 30000); // Avança etapa a cada 30s
239
 
240
  try {
241
  const res = await fetch(`${API}/api/pipeline/run-sync`, {
 
244
  body: JSON.stringify({ niche, platform, tone: 'engaging', language: 'pt-BR', voiceId: voice })
245
  });
246
 
247
+ clearInterval(stepInterval);
248
+
249
  if (res.ok) {
250
  status.className = 'status success';
251
  status.textContent = '✅ Vídeo gerado com sucesso!';
 
253
  } else {
254
  const err = await res.text();
255
  status.className = 'status error';
256
+ status.textContent = '❌ Erro: ' + err.substring(0, 150);
257
  }
258
  } catch (e) {
259
+ clearInterval(stepInterval);
260
  status.className = 'status error';
261
  status.textContent = '❌ Erro de conexão: ' + e.message;
262
  }