sbv Claude commited on
Commit
b3590f6
·
1 Parent(s): 278e357

Remove upload timeout - allow CPU processing to take as long as needed

Browse files

- Removed 2-minute timeout that was interrupting legitimate long uploads
- CPU-only environments need time for model downloads and processing
- Keep helpful loading message after 15s ("downloading model...")
- Frontend will wait for backend to complete (no artificial limit)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. frontend/script.js +15 -32
frontend/script.js CHANGED
@@ -499,48 +499,31 @@ async function handleUpload() {
499
  formData.append('file', file);
500
  formData.append('api_key', apiKey);
501
 
502
- // Create abort controller for timeout (2 minutes for large docs / model downloads)
503
- const controller = new AbortController();
504
- const timeoutId = setTimeout(() => controller.abort(), 120000); // 2 min timeout
505
-
506
  // Show model download message after 15 seconds
507
  const loadingTimeoutId = setTimeout(() => {
508
  showLoading(getNestedTranslation('loading.modelDownload'));
509
  }, 15000);
510
 
511
- try {
512
- // Upload
513
- const response = await fetch(`${API_BASE}/upload`, {
514
- method: 'POST',
515
- body: formData,
516
- signal: controller.signal
517
- });
518
-
519
- clearTimeout(timeoutId);
520
- clearTimeout(loadingTimeoutId);
521
-
522
- const data = await response.json();
523
 
524
- if (!response.ok) {
525
- throw new Error(data.detail || 'Upload failed');
526
- }
527
 
528
- // Success
529
- sessionId = data.session_id;
530
- documentNameEl.textContent = data.filename;
531
 
532
- // Show chat interface
533
- chatOverlay.classList.add('active');
 
534
 
535
- } catch (error) {
536
- clearTimeout(timeoutId);
537
- clearTimeout(loadingTimeoutId);
538
 
539
- if (error.name === 'AbortError') {
540
- throw new Error('Upload timed out. Please try again or check your connection.');
541
- }
542
- throw error;
543
- }
544
 
545
  } catch (error) {
546
  console.error('Upload error:', error);
 
499
  formData.append('file', file);
500
  formData.append('api_key', apiKey);
501
 
 
 
 
 
502
  // Show model download message after 15 seconds
503
  const loadingTimeoutId = setTimeout(() => {
504
  showLoading(getNestedTranslation('loading.modelDownload'));
505
  }, 15000);
506
 
507
+ // Upload (no timeout - CPU processing can take a while)
508
+ const response = await fetch(`${API_BASE}/upload`, {
509
+ method: 'POST',
510
+ body: formData
511
+ });
 
 
 
 
 
 
 
512
 
513
+ clearTimeout(loadingTimeoutId);
 
 
514
 
515
+ const data = await response.json();
 
 
516
 
517
+ if (!response.ok) {
518
+ throw new Error(data.detail || 'Upload failed');
519
+ }
520
 
521
+ // Success
522
+ sessionId = data.session_id;
523
+ documentNameEl.textContent = data.filename;
524
 
525
+ // Show chat interface
526
+ chatOverlay.classList.add('active');
 
 
 
527
 
528
  } catch (error) {
529
  console.error('Upload error:', error);