agentgui 1.0.22 → 1.0.23
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/package.json +1 -1
- package/static/app.js +65 -16
package/package.json
CHANGED
package/static/app.js
CHANGED
|
@@ -96,6 +96,18 @@ class GMGUIApp {
|
|
|
96
96
|
async init() {
|
|
97
97
|
console.log('[DEBUG] Init: Starting initialization');
|
|
98
98
|
console.log('[DEBUG] Init: BASE_URL =', BASE_URL);
|
|
99
|
+
console.log('[DEBUG] Init: Window width:', window.innerWidth);
|
|
100
|
+
|
|
101
|
+
// Ensure sidebar is visible on desktop (open on wide screens)
|
|
102
|
+
const sidebar = document.getElementById('sidebar');
|
|
103
|
+
if (window.innerWidth >= 768 && sidebar) {
|
|
104
|
+
console.log('[DEBUG] Init: Wide screen detected, ensuring sidebar is visible');
|
|
105
|
+
sidebar.classList.remove('open'); // On desktop, sidebar is always visible, no need for 'open' class
|
|
106
|
+
} else if (sidebar) {
|
|
107
|
+
console.log('[DEBUG] Init: Mobile/narrow screen detected, opening sidebar');
|
|
108
|
+
sidebar.classList.add('open');
|
|
109
|
+
}
|
|
110
|
+
|
|
99
111
|
this.loadSettings();
|
|
100
112
|
this.setupEventListeners();
|
|
101
113
|
await this.fetchHome();
|
|
@@ -330,20 +342,37 @@ class GMGUIApp {
|
|
|
330
342
|
console.log('[DEBUG] fetchConversations: Starting fetch from', BASE_URL + '/api/conversations');
|
|
331
343
|
const res = await fetch(BASE_URL + '/api/conversations');
|
|
332
344
|
console.log('[DEBUG] fetchConversations: Response status:', res.status);
|
|
345
|
+
|
|
346
|
+
if (!res.ok) {
|
|
347
|
+
console.error('[DEBUG] fetchConversations: Response not OK, status:', res.status);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
|
|
333
351
|
const data = await res.json();
|
|
334
352
|
console.log('[DEBUG] fetchConversations response count:', data.conversations?.length);
|
|
335
|
-
|
|
353
|
+
|
|
336
354
|
if (data.conversations) {
|
|
355
|
+
console.log('[DEBUG] fetchConversations: About to clear and load conversations');
|
|
337
356
|
this.conversations.clear();
|
|
338
|
-
console.log('[DEBUG] fetchConversations: Cleared conversations map');
|
|
339
|
-
|
|
357
|
+
console.log('[DEBUG] fetchConversations: Cleared conversations map, size now:', this.conversations.size);
|
|
358
|
+
|
|
359
|
+
data.conversations.forEach(c => {
|
|
360
|
+
this.conversations.set(c.id, c);
|
|
361
|
+
});
|
|
362
|
+
|
|
340
363
|
console.log('[DEBUG] Loaded conversations, total:', this.conversations.size);
|
|
341
364
|
console.log('[DEBUG] First few conversation IDs:', Array.from(this.conversations.keys()).slice(0, 5));
|
|
365
|
+
|
|
366
|
+
if (this.conversations.size === 0) {
|
|
367
|
+
console.error('[DEBUG] ERROR: conversations.size is 0 after loading!');
|
|
368
|
+
}
|
|
342
369
|
} else {
|
|
343
370
|
console.warn('[DEBUG] fetchConversations: data.conversations is undefined or null');
|
|
371
|
+
console.warn('[DEBUG] fetchConversations: Full response:', data);
|
|
344
372
|
}
|
|
345
373
|
} catch (e) {
|
|
346
|
-
console.error('fetchConversations error:', e);
|
|
374
|
+
console.error('[DEBUG] fetchConversations error:', e);
|
|
375
|
+
console.error('[DEBUG] Error details:', e.message, e.stack);
|
|
347
376
|
}
|
|
348
377
|
}
|
|
349
378
|
|
|
@@ -1280,15 +1309,35 @@ function confirmFolderSelection() {
|
|
|
1280
1309
|
app.closeFolderBrowser();
|
|
1281
1310
|
}
|
|
1282
1311
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1312
|
+
// Wait for DOM to be fully ready before initializing
|
|
1313
|
+
function initializeApp() {
|
|
1314
|
+
console.log('[DEBUG] initializeApp: Checking if DOM is ready');
|
|
1315
|
+
const chatList = document.getElementById('chatList');
|
|
1316
|
+
if (!chatList) {
|
|
1317
|
+
console.warn('[DEBUG] initializeApp: chatList not found, waiting 100ms');
|
|
1318
|
+
setTimeout(initializeApp, 100);
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
console.log('[DEBUG] initializeApp: DOM is ready, creating GMGUIApp');
|
|
1323
|
+
window.app = new GMGUIApp();
|
|
1324
|
+
window._app = window.app;
|
|
1325
|
+
|
|
1326
|
+
// Debug: Log app state to window for inspection
|
|
1327
|
+
window._debug = {
|
|
1328
|
+
get conversations() { return Array.from(window.app.conversations.values()).map(c => ({ id: c.id, title: c.title })); },
|
|
1329
|
+
get conversationCount() { return window.app.conversations.size; },
|
|
1330
|
+
get selectedAgent() { return window.app.selectedAgent; },
|
|
1331
|
+
get currentConversation() { return window.app.currentConversation; },
|
|
1332
|
+
checkChatListElement() { return document.getElementById('chatList'); },
|
|
1333
|
+
checkChatListChildCount() { return document.getElementById('chatList')?.children?.length || 0; }
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
console.log('[DEBUG] initializeApp: GMGUIApp created successfully');
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
if (document.readyState === 'loading') {
|
|
1340
|
+
document.addEventListener('DOMContentLoaded', initializeApp);
|
|
1341
|
+
} else {
|
|
1342
|
+
initializeApp();
|
|
1343
|
+
}
|