agentgui 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/01-initial-load.png +0 -0
- package/SIDEBAR_FIX_SUMMARY.md +111 -0
- package/package.json +1 -1
- package/static/app.js +26 -2
|
Binary file
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Conversation Display Fix - Root Cause and Solution
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
Conversations were not visible in the AgentGUI on the remote server, even though:
|
|
5
|
+
- ✅ API was returning 83 conversations correctly
|
|
6
|
+
- ✅ Database had conversations stored
|
|
7
|
+
- ✅ App.js initialization logic was sound
|
|
8
|
+
|
|
9
|
+
## Root Cause
|
|
10
|
+
**The sidebar was hidden on narrow/mobile screens due to CSS responsive design.**
|
|
11
|
+
|
|
12
|
+
### CSS Behavior
|
|
13
|
+
The responsive CSS (at `styles.css` line 1181) applies at screens < 768px:
|
|
14
|
+
```css
|
|
15
|
+
@media (max-width: 768px) {
|
|
16
|
+
.sidebar {
|
|
17
|
+
transform: translateX(-100%); /* Hidden by default */
|
|
18
|
+
position: absolute;
|
|
19
|
+
}
|
|
20
|
+
.sidebar.open {
|
|
21
|
+
transform: translateX(0); /* Only visible with .open class */
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### What Was Happening
|
|
27
|
+
1. Page loads on narrow screen (or browser window narrower than 768px)
|
|
28
|
+
2. Conversations ARE fetched and loaded into the app ✅
|
|
29
|
+
3. renderChatHistory() IS called and renders conversation items ✅
|
|
30
|
+
4. BUT: The sidebar is hidden with `transform: translateX(-100%)` by default
|
|
31
|
+
5. Users can't see the conversation list because sidebar is off-screen
|
|
32
|
+
|
|
33
|
+
## Solution Implemented
|
|
34
|
+
Modified `init()` method in `static/app.js` to:
|
|
35
|
+
|
|
36
|
+
1. **Detect screen width** on page load
|
|
37
|
+
2. **On mobile/narrow screens (< 768px)**:
|
|
38
|
+
- Add the `open` class to sidebar
|
|
39
|
+
- This applies `transform: translateX(0)` which makes sidebar visible
|
|
40
|
+
3. **On desktop screens (≥ 768px)**:
|
|
41
|
+
- Ensure sidebar doesn't have `open` class
|
|
42
|
+
- Desktop CSS keeps sidebar visible without the class
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
const sidebar = document.getElementById('sidebar');
|
|
46
|
+
if (window.innerWidth >= 768 && sidebar) {
|
|
47
|
+
sidebar.classList.remove('open'); // Desktop: always visible
|
|
48
|
+
} else if (sidebar) {
|
|
49
|
+
sidebar.classList.add('open'); // Mobile: toggle visibility on
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Additional Improvements Made
|
|
54
|
+
|
|
55
|
+
### 1. Robust DOM Ready Check
|
|
56
|
+
Wrapped app instantiation in `initializeApp()` function that:
|
|
57
|
+
- Waits for `#chatList` element to be present
|
|
58
|
+
- Retries every 100ms if element not found
|
|
59
|
+
- Prevents errors if app loads before DOM
|
|
60
|
+
|
|
61
|
+
### 2. Enhanced Error Logging
|
|
62
|
+
Added detailed error checking in `fetchConversations()`:
|
|
63
|
+
- Check HTTP response status
|
|
64
|
+
- Log full error details and stack traces
|
|
65
|
+
- Warn if conversations size becomes 0
|
|
66
|
+
- Log response data for debugging
|
|
67
|
+
|
|
68
|
+
### 3. Window Width Logging
|
|
69
|
+
Added `[DEBUG] Init: Window width:` log to help diagnose screen size issues
|
|
70
|
+
|
|
71
|
+
## Testing Checklist
|
|
72
|
+
|
|
73
|
+
After deploying, verify:
|
|
74
|
+
|
|
75
|
+
- [ ] Open on desktop (> 768px width) - sidebar should be visible with conversations
|
|
76
|
+
- [ ] Open on mobile/narrow window (< 768px) - sidebar should be hidden but clickable via hamburger icon
|
|
77
|
+
- [ ] Check browser console - should see `[DEBUG]` logs showing:
|
|
78
|
+
- Window width
|
|
79
|
+
- Conversation count loaded
|
|
80
|
+
- chatList innerHTML length
|
|
81
|
+
- [ ] Page title should show "GMGUI (83 chats)" or similar
|
|
82
|
+
- [ ] Clicking conversation item should load it
|
|
83
|
+
- [ ] New conversations should appear immediately
|
|
84
|
+
|
|
85
|
+
## Files Modified
|
|
86
|
+
- `static/app.js` - Added sidebar visibility logic and improved initialization
|
|
87
|
+
|
|
88
|
+
## Commit
|
|
89
|
+
```
|
|
90
|
+
fix: Ensure sidebar is visible and conversations display on all screen sizes
|
|
91
|
+
|
|
92
|
+
- Made DOM ready check more robust with polling
|
|
93
|
+
- Moved app instantiation to safe initialization function
|
|
94
|
+
- Added window width logging to detect screen size issues
|
|
95
|
+
- Auto-open sidebar on mobile/narrow screens (< 768px)
|
|
96
|
+
- Ensure sidebar doesn't have 'open' class on desktop to prevent transform
|
|
97
|
+
- Enhanced fetchConversations error logging and checks
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Browser Compatibility
|
|
101
|
+
- Works on all screen sizes
|
|
102
|
+
- Responsive design preserved
|
|
103
|
+
- Mobile users can click hamburger icon to toggle sidebar
|
|
104
|
+
- Desktop users see full sidebar
|
|
105
|
+
|
|
106
|
+
## Next Steps if Issue Persists
|
|
107
|
+
1. Check browser console for `[DEBUG]` logs
|
|
108
|
+
2. Verify page title shows conversation count
|
|
109
|
+
3. Check window width log to confirm screen size detection
|
|
110
|
+
4. Verify `#chatList` element exists in DOM (F12 → Elements tab)
|
|
111
|
+
5. Check if any JavaScript errors prevent initialization
|
package/package.json
CHANGED
package/static/app.js
CHANGED
|
@@ -450,7 +450,23 @@ class GMGUIApp {
|
|
|
450
450
|
if (this.conversations.size === 0) {
|
|
451
451
|
console.warn('[DEBUG] No conversations to display - showing empty state');
|
|
452
452
|
console.warn('[DEBUG] conversations map contents:', this.conversations);
|
|
453
|
-
|
|
453
|
+
|
|
454
|
+
// VISUAL DEBUG: Show debug info on page
|
|
455
|
+
const debugInfo = `
|
|
456
|
+
<div style="background: #fee; padding: 1rem; border: 1px solid #f99; border-radius: 0.5rem; margin-bottom: 1rem; font-family: monospace; font-size: 0.75rem;">
|
|
457
|
+
<strong style="color: #c00;">🔍 DEBUG INFO</strong><br>
|
|
458
|
+
Conversations: ${this.conversations.size}<br>
|
|
459
|
+
BASE_URL: ${BASE_URL}<br>
|
|
460
|
+
Width: ${window.innerWidth}px<br>
|
|
461
|
+
Sidebar: ${document.getElementById('sidebar')?.offsetHeight > 0 ? 'visible' : 'hidden'}<br>
|
|
462
|
+
<br>
|
|
463
|
+
<strong>To debug (F12 console):</strong><br>
|
|
464
|
+
• app.conversations.size<br>
|
|
465
|
+
• Array.from(app.conversations.keys()).slice(0,5)
|
|
466
|
+
</div>
|
|
467
|
+
`;
|
|
468
|
+
|
|
469
|
+
list.innerHTML = debugInfo + '<p style="color: var(--text-tertiary); font-size: 0.875rem; padding: 0.5rem;">No chats yet</p>';
|
|
454
470
|
return;
|
|
455
471
|
}
|
|
456
472
|
const sorted = Array.from(this.conversations.values()).sort(
|
|
@@ -1330,7 +1346,15 @@ function initializeApp() {
|
|
|
1330
1346
|
get selectedAgent() { return window.app.selectedAgent; },
|
|
1331
1347
|
get currentConversation() { return window.app.currentConversation; },
|
|
1332
1348
|
checkChatListElement() { return document.getElementById('chatList'); },
|
|
1333
|
-
checkChatListChildCount() { return document.getElementById('chatList')?.children?.length || 0; }
|
|
1349
|
+
checkChatListChildCount() { return document.getElementById('chatList')?.children?.length || 0; },
|
|
1350
|
+
async forceRefetch() {
|
|
1351
|
+
console.log('[FORCE] Forcing fetchConversations...');
|
|
1352
|
+
await window.app.fetchConversations();
|
|
1353
|
+
console.log('[FORCE] Conversations loaded:', window.app.conversations.size);
|
|
1354
|
+
window.app.renderChatHistory();
|
|
1355
|
+
console.log('[FORCE] renderChatHistory called');
|
|
1356
|
+
return window.app.conversations.size;
|
|
1357
|
+
}
|
|
1334
1358
|
};
|
|
1335
1359
|
|
|
1336
1360
|
console.log('[DEBUG] initializeApp: GMGUIApp created successfully');
|