Fix Global Timeout and JS Error Logs

This commit is contained in:
2025-12-26 18:20:11 +01:00
parent b13a6e2be0
commit d6a4b667a8
2 changed files with 19 additions and 8 deletions

View File

@@ -97,16 +97,27 @@
body: formData body: formData
}); });
const data = await response.json();
// Remove loading
const loadingEl = document.getElementById(loadingId);
if (loadingEl) loadingEl.remove();
if (response.ok) { if (response.ok) {
const data = await response.json();
// Remove loading
const loadingEl = document.getElementById(loadingId);
if (loadingEl) loadingEl.remove();
addMessage('assistant', data.answer); addMessage('assistant', data.answer);
} else { } else {
addMessage('error', data.answer || 'Error communicating with server.'); // Try to parse error JSON, but handle HTML error pages (like 504)
let errorMsg = "Error communicating with server.";
try {
const data = await response.json();
if (data.detail) errorMsg = data.detail;
else if (data.answer) errorMsg = data.answer;
} catch (e) {
errorMsg = `Server Error: ${response.status} ${response.statusText}`;
}
const loadingEl = document.getElementById(loadingId);
if (loadingEl) loadingEl.remove();
addMessage('error', errorMsg);
} }
} catch (error) { } catch (error) {

View File

@@ -15,7 +15,7 @@ location / {
# Timeouts # Timeouts
proxy_connect_timeout 60s; proxy_connect_timeout 60s;
proxy_send_timeout 60s; proxy_send_timeout 60s;
proxy_read_timeout 60s; proxy_read_timeout 300s;
# Buffering # Buffering
proxy_buffering on; proxy_buffering on;