Spaces:
Running
Running
Priyanshi Saxena
commited on
Commit
Β·
43c3569
1
Parent(s):
4c07e01
Fix frontend status checking logic
Browse files- Improved status check conditions to handle enabled state properly
- Added immediate status check on page load
- Enhanced debugging with DOM element verification
- Simplified status checking flow
app.py
CHANGED
@@ -1220,24 +1220,27 @@ async def get_homepage(request: Request):
|
|
1220 |
|
1221 |
const statusDiv = document.getElementById('status');
|
1222 |
|
1223 |
-
if (
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
|
|
|
|
|
|
1241 |
} else {
|
1242 |
console.log('β System is disabled');
|
1243 |
statusDiv.className = 'status offline';
|
@@ -1529,13 +1532,21 @@ async def get_homepage(request: Request):
|
|
1529 |
console.log('π Current URL:', window.location.href);
|
1530 |
console.log('π User Agent:', navigator.userAgent.substring(0, 100));
|
1531 |
|
|
|
|
|
|
|
|
|
1532 |
initializeTheme();
|
1533 |
|
1534 |
-
//
|
|
|
|
|
|
|
|
|
1535 |
setTimeout(() => {
|
1536 |
-
console.log('π Starting status check...');
|
1537 |
checkStatus();
|
1538 |
-
},
|
1539 |
|
1540 |
document.getElementById('queryInput').focus();
|
1541 |
console.log('β
Application initialization complete');
|
|
|
1220 |
|
1221 |
const statusDiv = document.getElementById('status');
|
1222 |
|
1223 |
+
// Check if system is operational (either fully enabled or in limited mode)
|
1224 |
+
if (status.enabled) {
|
1225 |
+
if (status.gemini_configured) {
|
1226 |
+
console.log('β
System is fully operational');
|
1227 |
+
statusDiv.className = 'status online';
|
1228 |
+
statusDiv.innerHTML = `
|
1229 |
+
<span>Research systems online</span>
|
1230 |
+
<div style="margin-top: 0.5rem; font-size: 0.85rem; opacity: 0.8;">
|
1231 |
+
Tools: ${status.tools_available.join(' β’ ')}
|
1232 |
+
</div>
|
1233 |
+
`;
|
1234 |
+
} else {
|
1235 |
+
console.log('β οΈ System is in limited mode');
|
1236 |
+
statusDiv.className = 'status offline';
|
1237 |
+
statusDiv.innerHTML = `
|
1238 |
+
<span>Limited mode - Configure GEMINI_API_KEY for full functionality</span>
|
1239 |
+
<div style="margin-top: 0.5rem; font-size: 0.85rem; opacity: 0.8;">
|
1240 |
+
Available: ${status.tools_available.join(' β’ ')}
|
1241 |
+
</div>
|
1242 |
+
`;
|
1243 |
+
}
|
1244 |
} else {
|
1245 |
console.log('β System is disabled');
|
1246 |
statusDiv.className = 'status offline';
|
|
|
1532 |
console.log('π Current URL:', window.location.href);
|
1533 |
console.log('π User Agent:', navigator.userAgent.substring(0, 100));
|
1534 |
|
1535 |
+
// Test basic functionality
|
1536 |
+
const statusDiv = document.getElementById('status');
|
1537 |
+
console.log('π Status div found:', !!statusDiv);
|
1538 |
+
|
1539 |
initializeTheme();
|
1540 |
|
1541 |
+
// Immediate status check for debugging
|
1542 |
+
console.log('π Starting immediate status check...');
|
1543 |
+
checkStatus();
|
1544 |
+
|
1545 |
+
// Also do a delayed check
|
1546 |
setTimeout(() => {
|
1547 |
+
console.log('π Starting delayed status check...');
|
1548 |
checkStatus();
|
1549 |
+
}, 2000);
|
1550 |
|
1551 |
document.getElementById('queryInput').focus();
|
1552 |
console.log('β
Application initialization complete');
|