@hef2024/llmasaservice-ui 0.22.6 → 0.22.8
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/dist/index.js +49 -9
- package/dist/index.mjs +49 -9
- package/package.json +1 -1
- package/src/AIAgentPanel.tsx +54 -8
package/dist/index.js
CHANGED
|
@@ -6303,17 +6303,48 @@ var AIAgentPanel = import_react14.default.forwardRef(({
|
|
|
6303
6303
|
};
|
|
6304
6304
|
}, [context, sharedContextSections, pageContextSections, contextDataSources]);
|
|
6305
6305
|
(0, import_react14.useEffect)(() => {
|
|
6306
|
-
const contextString = JSON.stringify(
|
|
6307
|
-
|
|
6306
|
+
const contextString = JSON.stringify(
|
|
6307
|
+
mergedContext.sections.map((s) => ({
|
|
6308
|
+
id: s.id,
|
|
6309
|
+
data: s.data
|
|
6310
|
+
})),
|
|
6311
|
+
null,
|
|
6312
|
+
0
|
|
6313
|
+
);
|
|
6314
|
+
console.log("AIAgentPanel - Context effect running", {
|
|
6315
|
+
sectionsCount: mergedContext.sections.length,
|
|
6316
|
+
sectionIds: mergedContext.sections.map((s) => s.id),
|
|
6317
|
+
contextLength: contextString.length,
|
|
6318
|
+
contextHash: contextString.substring(0, 50) + "..." + contextString.substring(contextString.length - 50)
|
|
6319
|
+
});
|
|
6308
6320
|
if (prevContextRef.current === null) {
|
|
6309
6321
|
console.log("AIAgentPanel - First render, initializing context ref");
|
|
6310
6322
|
prevContextRef.current = contextString;
|
|
6311
6323
|
return;
|
|
6312
6324
|
}
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
console.log("AIAgentPanel -
|
|
6316
|
-
console.log("AIAgentPanel -
|
|
6325
|
+
const changed = prevContextRef.current !== contextString;
|
|
6326
|
+
if (changed) {
|
|
6327
|
+
console.log("AIAgentPanel - \u2705 Context CHANGED, showing notification");
|
|
6328
|
+
console.log("AIAgentPanel - String length old/new:", prevContextRef.current.length, contextString.length);
|
|
6329
|
+
if (prevContextRef.current.length !== contextString.length) {
|
|
6330
|
+
console.log("AIAgentPanel - Length difference:", contextString.length - prevContextRef.current.length);
|
|
6331
|
+
}
|
|
6332
|
+
try {
|
|
6333
|
+
const oldSections = JSON.parse(prevContextRef.current);
|
|
6334
|
+
const newSections = JSON.parse(contextString);
|
|
6335
|
+
console.log("AIAgentPanel - Section count old/new:", oldSections.length, newSections.length);
|
|
6336
|
+
newSections.forEach((newSec, idx) => {
|
|
6337
|
+
const oldSec = oldSections[idx];
|
|
6338
|
+
if (!oldSec || JSON.stringify(oldSec.data) !== JSON.stringify(newSec.data)) {
|
|
6339
|
+
console.log(`AIAgentPanel - Section "${newSec.id}" changed:`, {
|
|
6340
|
+
oldDataLength: oldSec ? JSON.stringify(oldSec.data).length : 0,
|
|
6341
|
+
newDataLength: JSON.stringify(newSec.data).length
|
|
6342
|
+
});
|
|
6343
|
+
}
|
|
6344
|
+
});
|
|
6345
|
+
} catch (e) {
|
|
6346
|
+
console.log("AIAgentPanel - Could not parse for diff:", e);
|
|
6347
|
+
}
|
|
6317
6348
|
prevContextRef.current = contextString;
|
|
6318
6349
|
if (contextNotificationTimeoutRef.current) {
|
|
6319
6350
|
clearTimeout(contextNotificationTimeoutRef.current);
|
|
@@ -6325,9 +6356,18 @@ var AIAgentPanel = import_react14.default.forwardRef(({
|
|
|
6325
6356
|
contextNotificationTimeoutRef.current = null;
|
|
6326
6357
|
}, 3e3);
|
|
6327
6358
|
} else {
|
|
6328
|
-
console.log("AIAgentPanel - Context
|
|
6329
|
-
|
|
6330
|
-
|
|
6359
|
+
console.log("AIAgentPanel - \u274C Context UNCHANGED (strings match)");
|
|
6360
|
+
console.log("AIAgentPanel - Current context data:", mergedContext.sections.map((s) => ({
|
|
6361
|
+
id: s.id,
|
|
6362
|
+
dataKeys: Object.keys(s.data || {}),
|
|
6363
|
+
dataLength: JSON.stringify(s.data).length,
|
|
6364
|
+
dataPreview: JSON.stringify(s.data).substring(0, 200)
|
|
6365
|
+
})));
|
|
6366
|
+
console.log("AIAgentPanel - prevContextRef length:", prevContextRef.current.length);
|
|
6367
|
+
console.log("AIAgentPanel - new contextString length:", contextString.length);
|
|
6368
|
+
console.log("AIAgentPanel - Are they identical?", prevContextRef.current === contextString);
|
|
6369
|
+
}
|
|
6370
|
+
}, [mergedContext.sections]);
|
|
6331
6371
|
(0, import_react14.useEffect)(() => {
|
|
6332
6372
|
return () => {
|
|
6333
6373
|
if (contextNotificationTimeoutRef.current) {
|
package/dist/index.mjs
CHANGED
|
@@ -6270,17 +6270,48 @@ var AIAgentPanel = React13.forwardRef(({
|
|
|
6270
6270
|
};
|
|
6271
6271
|
}, [context, sharedContextSections, pageContextSections, contextDataSources]);
|
|
6272
6272
|
useEffect9(() => {
|
|
6273
|
-
const contextString = JSON.stringify(
|
|
6274
|
-
|
|
6273
|
+
const contextString = JSON.stringify(
|
|
6274
|
+
mergedContext.sections.map((s) => ({
|
|
6275
|
+
id: s.id,
|
|
6276
|
+
data: s.data
|
|
6277
|
+
})),
|
|
6278
|
+
null,
|
|
6279
|
+
0
|
|
6280
|
+
);
|
|
6281
|
+
console.log("AIAgentPanel - Context effect running", {
|
|
6282
|
+
sectionsCount: mergedContext.sections.length,
|
|
6283
|
+
sectionIds: mergedContext.sections.map((s) => s.id),
|
|
6284
|
+
contextLength: contextString.length,
|
|
6285
|
+
contextHash: contextString.substring(0, 50) + "..." + contextString.substring(contextString.length - 50)
|
|
6286
|
+
});
|
|
6275
6287
|
if (prevContextRef.current === null) {
|
|
6276
6288
|
console.log("AIAgentPanel - First render, initializing context ref");
|
|
6277
6289
|
prevContextRef.current = contextString;
|
|
6278
6290
|
return;
|
|
6279
6291
|
}
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
console.log("AIAgentPanel -
|
|
6283
|
-
console.log("AIAgentPanel -
|
|
6292
|
+
const changed = prevContextRef.current !== contextString;
|
|
6293
|
+
if (changed) {
|
|
6294
|
+
console.log("AIAgentPanel - \u2705 Context CHANGED, showing notification");
|
|
6295
|
+
console.log("AIAgentPanel - String length old/new:", prevContextRef.current.length, contextString.length);
|
|
6296
|
+
if (prevContextRef.current.length !== contextString.length) {
|
|
6297
|
+
console.log("AIAgentPanel - Length difference:", contextString.length - prevContextRef.current.length);
|
|
6298
|
+
}
|
|
6299
|
+
try {
|
|
6300
|
+
const oldSections = JSON.parse(prevContextRef.current);
|
|
6301
|
+
const newSections = JSON.parse(contextString);
|
|
6302
|
+
console.log("AIAgentPanel - Section count old/new:", oldSections.length, newSections.length);
|
|
6303
|
+
newSections.forEach((newSec, idx) => {
|
|
6304
|
+
const oldSec = oldSections[idx];
|
|
6305
|
+
if (!oldSec || JSON.stringify(oldSec.data) !== JSON.stringify(newSec.data)) {
|
|
6306
|
+
console.log(`AIAgentPanel - Section "${newSec.id}" changed:`, {
|
|
6307
|
+
oldDataLength: oldSec ? JSON.stringify(oldSec.data).length : 0,
|
|
6308
|
+
newDataLength: JSON.stringify(newSec.data).length
|
|
6309
|
+
});
|
|
6310
|
+
}
|
|
6311
|
+
});
|
|
6312
|
+
} catch (e) {
|
|
6313
|
+
console.log("AIAgentPanel - Could not parse for diff:", e);
|
|
6314
|
+
}
|
|
6284
6315
|
prevContextRef.current = contextString;
|
|
6285
6316
|
if (contextNotificationTimeoutRef.current) {
|
|
6286
6317
|
clearTimeout(contextNotificationTimeoutRef.current);
|
|
@@ -6292,9 +6323,18 @@ var AIAgentPanel = React13.forwardRef(({
|
|
|
6292
6323
|
contextNotificationTimeoutRef.current = null;
|
|
6293
6324
|
}, 3e3);
|
|
6294
6325
|
} else {
|
|
6295
|
-
console.log("AIAgentPanel - Context
|
|
6296
|
-
|
|
6297
|
-
|
|
6326
|
+
console.log("AIAgentPanel - \u274C Context UNCHANGED (strings match)");
|
|
6327
|
+
console.log("AIAgentPanel - Current context data:", mergedContext.sections.map((s) => ({
|
|
6328
|
+
id: s.id,
|
|
6329
|
+
dataKeys: Object.keys(s.data || {}),
|
|
6330
|
+
dataLength: JSON.stringify(s.data).length,
|
|
6331
|
+
dataPreview: JSON.stringify(s.data).substring(0, 200)
|
|
6332
|
+
})));
|
|
6333
|
+
console.log("AIAgentPanel - prevContextRef length:", prevContextRef.current.length);
|
|
6334
|
+
console.log("AIAgentPanel - new contextString length:", contextString.length);
|
|
6335
|
+
console.log("AIAgentPanel - Are they identical?", prevContextRef.current === contextString);
|
|
6336
|
+
}
|
|
6337
|
+
}, [mergedContext.sections]);
|
|
6298
6338
|
useEffect9(() => {
|
|
6299
6339
|
return () => {
|
|
6300
6340
|
if (contextNotificationTimeoutRef.current) {
|
package/package.json
CHANGED
package/src/AIAgentPanel.tsx
CHANGED
|
@@ -1532,9 +1532,21 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
1532
1532
|
// Detect context changes and show notification
|
|
1533
1533
|
useEffect(() => {
|
|
1534
1534
|
// Create a stable string representation of the context for comparison
|
|
1535
|
-
const contextString = JSON.stringify(
|
|
1535
|
+
const contextString = JSON.stringify(
|
|
1536
|
+
mergedContext.sections.map(s => ({
|
|
1537
|
+
id: s.id,
|
|
1538
|
+
data: s.data
|
|
1539
|
+
})),
|
|
1540
|
+
null,
|
|
1541
|
+
0
|
|
1542
|
+
);
|
|
1536
1543
|
|
|
1537
|
-
console.log('AIAgentPanel - Context effect running
|
|
1544
|
+
console.log('AIAgentPanel - Context effect running', {
|
|
1545
|
+
sectionsCount: mergedContext.sections.length,
|
|
1546
|
+
sectionIds: mergedContext.sections.map(s => s.id),
|
|
1547
|
+
contextLength: contextString.length,
|
|
1548
|
+
contextHash: contextString.substring(0, 50) + '...' + contextString.substring(contextString.length - 50)
|
|
1549
|
+
});
|
|
1538
1550
|
|
|
1539
1551
|
// Skip on first render
|
|
1540
1552
|
if (prevContextRef.current === null) {
|
|
@@ -1544,10 +1556,35 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
1544
1556
|
}
|
|
1545
1557
|
|
|
1546
1558
|
// Check if context actually changed
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
console.log('AIAgentPanel -
|
|
1559
|
+
const changed = prevContextRef.current !== contextString;
|
|
1560
|
+
|
|
1561
|
+
if (changed) {
|
|
1562
|
+
console.log('AIAgentPanel - ✅ Context CHANGED, showing notification');
|
|
1563
|
+
console.log('AIAgentPanel - String length old/new:', prevContextRef.current.length, contextString.length);
|
|
1564
|
+
|
|
1565
|
+
// Find what changed
|
|
1566
|
+
if (prevContextRef.current.length !== contextString.length) {
|
|
1567
|
+
console.log('AIAgentPanel - Length difference:', contextString.length - prevContextRef.current.length);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
// Show detailed diff for debugging
|
|
1571
|
+
try {
|
|
1572
|
+
const oldSections = JSON.parse(prevContextRef.current);
|
|
1573
|
+
const newSections = JSON.parse(contextString);
|
|
1574
|
+
console.log('AIAgentPanel - Section count old/new:', oldSections.length, newSections.length);
|
|
1575
|
+
newSections.forEach((newSec: any, idx: number) => {
|
|
1576
|
+
const oldSec = oldSections[idx];
|
|
1577
|
+
if (!oldSec || JSON.stringify(oldSec.data) !== JSON.stringify(newSec.data)) {
|
|
1578
|
+
console.log(`AIAgentPanel - Section "${newSec.id}" changed:`, {
|
|
1579
|
+
oldDataLength: oldSec ? JSON.stringify(oldSec.data).length : 0,
|
|
1580
|
+
newDataLength: JSON.stringify(newSec.data).length
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
} catch (e) {
|
|
1585
|
+
console.log('AIAgentPanel - Could not parse for diff:', e);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1551
1588
|
prevContextRef.current = contextString;
|
|
1552
1589
|
|
|
1553
1590
|
// Clear any existing timeout before setting a new one
|
|
@@ -1565,12 +1602,21 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
1565
1602
|
contextNotificationTimeoutRef.current = null;
|
|
1566
1603
|
}, 3000);
|
|
1567
1604
|
} else {
|
|
1568
|
-
console.log('AIAgentPanel - Context
|
|
1605
|
+
console.log('AIAgentPanel - ❌ Context UNCHANGED (strings match)');
|
|
1606
|
+
console.log('AIAgentPanel - Current context data:', mergedContext.sections.map(s => ({
|
|
1607
|
+
id: s.id,
|
|
1608
|
+
dataKeys: Object.keys(s.data || {}),
|
|
1609
|
+
dataLength: JSON.stringify(s.data).length,
|
|
1610
|
+
dataPreview: JSON.stringify(s.data).substring(0, 200)
|
|
1611
|
+
})));
|
|
1612
|
+
console.log('AIAgentPanel - prevContextRef length:', prevContextRef.current.length);
|
|
1613
|
+
console.log('AIAgentPanel - new contextString length:', contextString.length);
|
|
1614
|
+
console.log('AIAgentPanel - Are they identical?', prevContextRef.current === contextString);
|
|
1569
1615
|
}
|
|
1570
1616
|
|
|
1571
1617
|
// Note: No cleanup on every re-render - only clear timeout when context changes
|
|
1572
1618
|
// This prevents race conditions when switching rapidly
|
|
1573
|
-
}, [mergedContext]);
|
|
1619
|
+
}, [mergedContext.sections]);
|
|
1574
1620
|
|
|
1575
1621
|
// Separate cleanup effect for unmount only
|
|
1576
1622
|
useEffect(() => {
|