shashwatIDR commited on
Commit
0ffbe2f
·
verified ·
1 Parent(s): b24cb40

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +3 -4
server.js CHANGED
@@ -570,7 +570,7 @@ app.post('/api/generate/anime-uc', authenticateToken, async (req, res) => {
570
  }
571
  });
572
 
573
- // Flux Generation endpoint (UNO-FLUX direct API with node-fetch SSE polling)
574
  app.get('/api/generate/flux', authenticateToken, async (req, res) => {
575
  try {
576
  const { prompt, aspect } = req.query;
@@ -631,7 +631,7 @@ app.get('/api/generate/flux', authenticateToken, async (req, res) => {
631
  return res.status(500).json({ success: false, error: 'Failed to join UNO-FLUX queue' });
632
  }
633
 
634
- // Poll for results using node-fetch and streaming
635
  const pollUrl = `https://bytedance-research-uno-flux.hf.space/gradio_api/queue/data?session_hash=${encodeURIComponent(sessionHash)}`;
636
  console.log(`[Flux] Polling for results at: ${pollUrl}`);
637
  let found = false;
@@ -646,8 +646,7 @@ app.get('/api/generate/flux', authenticateToken, async (req, res) => {
646
  'Accept': 'text/event-stream',
647
  'Referer': 'https://bytedance-research-uno-flux.hf.space/',
648
  'Origin': 'https://bytedance-research-uno-flux.hf.space'
649
- },
650
- timeout: 10000
651
  });
652
  if (!response.ok) {
653
  console.error(`[Flux] Poll error on attempt ${attempts}:`, response.status, await response.text());
 
570
  }
571
  });
572
 
573
+ // Flux Generation endpoint (UNO-FLUX direct API with native fetch SSE polling)
574
  app.get('/api/generate/flux', authenticateToken, async (req, res) => {
575
  try {
576
  const { prompt, aspect } = req.query;
 
631
  return res.status(500).json({ success: false, error: 'Failed to join UNO-FLUX queue' });
632
  }
633
 
634
+ // Poll for results using native fetch and streaming
635
  const pollUrl = `https://bytedance-research-uno-flux.hf.space/gradio_api/queue/data?session_hash=${encodeURIComponent(sessionHash)}`;
636
  console.log(`[Flux] Polling for results at: ${pollUrl}`);
637
  let found = false;
 
646
  'Accept': 'text/event-stream',
647
  'Referer': 'https://bytedance-research-uno-flux.hf.space/',
648
  'Origin': 'https://bytedance-research-uno-flux.hf.space'
649
+ }
 
650
  });
651
  if (!response.ok) {
652
  console.error(`[Flux] Poll error on attempt ${attempts}:`, response.status, await response.text());