agentgui 1.0.530 → 1.0.532
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/database.js +26 -1
- package/lib/ws-handlers-conv.js +11 -3
- package/package.json +1 -1
- package/static/js/client.js +4 -0
package/database.js
CHANGED
|
@@ -1389,7 +1389,7 @@ export const queries = {
|
|
|
1389
1389
|
});
|
|
1390
1390
|
},
|
|
1391
1391
|
|
|
1392
|
-
getRecentConversationChunks(conversationId, limit) {
|
|
1392
|
+
getRecentConversationChunks(conversationId, limit = 500) {
|
|
1393
1393
|
const stmt = prep(
|
|
1394
1394
|
`SELECT id, sessionId, conversationId, sequence, type, data, created_at
|
|
1395
1395
|
FROM chunks WHERE conversationId = ?
|
|
@@ -1409,6 +1409,31 @@ export const queries = {
|
|
|
1409
1409
|
});
|
|
1410
1410
|
},
|
|
1411
1411
|
|
|
1412
|
+
getRecentMessages(conversationId, limit = 20) {
|
|
1413
|
+
const countStmt = prep('SELECT COUNT(*) as count FROM messages WHERE conversationId = ?');
|
|
1414
|
+
const total = countStmt.get(conversationId).count;
|
|
1415
|
+
|
|
1416
|
+
const stmt = prep(
|
|
1417
|
+
'SELECT * FROM messages WHERE conversationId = ? ORDER BY created_at DESC LIMIT ? '
|
|
1418
|
+
);
|
|
1419
|
+
const messages = stmt.all(conversationId, limit).reverse();
|
|
1420
|
+
|
|
1421
|
+
return {
|
|
1422
|
+
messages: messages.map(msg => {
|
|
1423
|
+
if (typeof msg.content === 'string') {
|
|
1424
|
+
try {
|
|
1425
|
+
msg.content = JSON.parse(msg.content);
|
|
1426
|
+
} catch (_) {}
|
|
1427
|
+
}
|
|
1428
|
+
return msg;
|
|
1429
|
+
}),
|
|
1430
|
+
total,
|
|
1431
|
+
limit,
|
|
1432
|
+
offset: Math.max(0, total - limit),
|
|
1433
|
+
hasMore: total > limit
|
|
1434
|
+
};
|
|
1435
|
+
},
|
|
1436
|
+
|
|
1412
1437
|
getChunksSince(sessionId, timestamp) {
|
|
1413
1438
|
const stmt = prep(
|
|
1414
1439
|
`SELECT id, sessionId, conversationId, sequence, type, data, created_at
|
package/lib/ws-handlers-conv.js
CHANGED
|
@@ -47,13 +47,21 @@ export function register(router, deps) {
|
|
|
47
47
|
const conv = queries.getConversation(p.id);
|
|
48
48
|
if (!conv) notFound();
|
|
49
49
|
const chunkLimit = Math.min(p.chunkLimit || 500, 5000);
|
|
50
|
+
const messageLimit = Math.min(p.messageLimit || 20, 100);
|
|
50
51
|
const totalChunks = queries.getConversationChunkCount(p.id);
|
|
51
52
|
const chunks = (p.allChunks || totalChunks <= chunkLimit)
|
|
52
53
|
? queries.getConversationChunks(p.id) : queries.getRecentConversationChunks(p.id, chunkLimit);
|
|
54
|
+
const messagesResult = queries.getRecentMessages(p.id, messageLimit);
|
|
53
55
|
return {
|
|
54
|
-
conversation: conv,
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
conversation: conv,
|
|
57
|
+
isActivelyStreaming: activeExecutions.has(p.id),
|
|
58
|
+
latestSession: queries.getLatestSession(p.id),
|
|
59
|
+
chunks,
|
|
60
|
+
totalChunks,
|
|
61
|
+
hasMoreChunks: totalChunks > chunkLimit,
|
|
62
|
+
messages: messagesResult.messages,
|
|
63
|
+
totalMessages: messagesResult.total,
|
|
64
|
+
hasMoreMessages: messagesResult.hasMore,
|
|
57
65
|
rateLimitInfo: rateLimitState.get(p.id) || null
|
|
58
66
|
};
|
|
59
67
|
});
|
package/package.json
CHANGED
package/static/js/client.js
CHANGED
|
@@ -2372,6 +2372,10 @@ class AgentGUIClient {
|
|
|
2372
2372
|
this.ui.messageInput.disabled = false;
|
|
2373
2373
|
}
|
|
2374
2374
|
|
|
2375
|
+
if (this.ui.stopButton) this.ui.stopButton.classList.remove('visible');
|
|
2376
|
+
if (this.ui.injectButton) this.ui.injectButton.classList.remove('visible');
|
|
2377
|
+
if (this.ui.sendButton) this.ui.sendButton.style.display = '';
|
|
2378
|
+
|
|
2375
2379
|
var prevId = this.state.currentConversation?.id;
|
|
2376
2380
|
if (prevId && prevId !== conversationId) {
|
|
2377
2381
|
if (this.wsManager.isConnected && !this.state.streamingConversations.has(prevId)) {
|