agentgui 1.0.733 → 1.0.735
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 +19 -14
- package/package.json +1 -1
- package/static/js/client.js +1 -1
package/database.js
CHANGED
|
@@ -1523,22 +1523,27 @@ export const queries = {
|
|
|
1523
1523
|
},
|
|
1524
1524
|
|
|
1525
1525
|
getRecentConversationChunks(conversationId, limit = 500) {
|
|
1526
|
-
const
|
|
1526
|
+
const sessions = prep(
|
|
1527
|
+
`SELECT sessionId, COUNT(*) as n FROM chunks WHERE conversationId = ?
|
|
1528
|
+
GROUP BY sessionId ORDER BY MAX(created_at) DESC`
|
|
1529
|
+
).all(conversationId);
|
|
1530
|
+
if (!sessions.length) return [];
|
|
1531
|
+
const included = [];
|
|
1532
|
+
let total = 0;
|
|
1533
|
+
for (const s of sessions) {
|
|
1534
|
+
if (total + s.n > limit && included.length > 0) break;
|
|
1535
|
+
included.unshift(s.sessionId);
|
|
1536
|
+
total += s.n;
|
|
1537
|
+
}
|
|
1538
|
+
const placeholders = included.map(() => '?').join(',');
|
|
1539
|
+
const rows = prep(
|
|
1527
1540
|
`SELECT id, sessionId, conversationId, sequence, type, data, created_at
|
|
1528
|
-
FROM chunks WHERE conversationId = ?
|
|
1529
|
-
ORDER BY created_at
|
|
1530
|
-
);
|
|
1531
|
-
const rows = stmt.all(conversationId, limit);
|
|
1532
|
-
rows.reverse();
|
|
1541
|
+
FROM chunks WHERE conversationId = ? AND sessionId IN (${placeholders})
|
|
1542
|
+
ORDER BY created_at ASC`
|
|
1543
|
+
).all(conversationId, ...included);
|
|
1533
1544
|
return rows.map(row => {
|
|
1534
|
-
try {
|
|
1535
|
-
|
|
1536
|
-
...row,
|
|
1537
|
-
data: typeof row.data === 'string' ? JSON.parse(row.data) : row.data
|
|
1538
|
-
};
|
|
1539
|
-
} catch (e) {
|
|
1540
|
-
return row;
|
|
1541
|
-
}
|
|
1545
|
+
try { return { ...row, data: typeof row.data === 'string' ? JSON.parse(row.data) : row.data }; }
|
|
1546
|
+
catch (e) { return row; }
|
|
1542
1547
|
});
|
|
1543
1548
|
},
|
|
1544
1549
|
|
package/package.json
CHANGED
package/static/js/client.js
CHANGED
|
@@ -2706,7 +2706,7 @@ class AgentGUIClient {
|
|
|
2706
2706
|
|
|
2707
2707
|
let fullData;
|
|
2708
2708
|
try {
|
|
2709
|
-
fullData = await window.wsClient.rpc('conv.full', { id: conversationId
|
|
2709
|
+
fullData = await window.wsClient.rpc('conv.full', { id: conversationId });
|
|
2710
2710
|
if (convSignal.aborted) return;
|
|
2711
2711
|
} catch (wsErr) {
|
|
2712
2712
|
if (wsErr.code === 404) {
|