Spaces:
Sleeping
Sleeping
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>
- 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 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
signal: controller.signal
|
| 517 |
-
});
|
| 518 |
-
|
| 519 |
-
clearTimeout(timeoutId);
|
| 520 |
-
clearTimeout(loadingTimeoutId);
|
| 521 |
-
|
| 522 |
-
const data = await response.json();
|
| 523 |
|
| 524 |
-
|
| 525 |
-
throw new Error(data.detail || 'Upload failed');
|
| 526 |
-
}
|
| 527 |
|
| 528 |
-
|
| 529 |
-
sessionId = data.session_id;
|
| 530 |
-
documentNameEl.textContent = data.filename;
|
| 531 |
|
| 532 |
-
|
| 533 |
-
|
|
|
|
| 534 |
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
|
| 539 |
-
|
| 540 |
-
|
| 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);
|