@hef2024/llmasaservice-ui 0.22.6 → 0.22.7
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 +23 -8
- package/dist/index.mjs +23 -8
- package/package.json +1 -1
- package/src/AIAgentPanel.tsx +27 -8
package/dist/index.js
CHANGED
|
@@ -6303,17 +6303,32 @@ 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
|
+
}
|
|
6317
6332
|
prevContextRef.current = contextString;
|
|
6318
6333
|
if (contextNotificationTimeoutRef.current) {
|
|
6319
6334
|
clearTimeout(contextNotificationTimeoutRef.current);
|
|
@@ -6325,9 +6340,9 @@ var AIAgentPanel = import_react14.default.forwardRef(({
|
|
|
6325
6340
|
contextNotificationTimeoutRef.current = null;
|
|
6326
6341
|
}, 3e3);
|
|
6327
6342
|
} else {
|
|
6328
|
-
console.log("AIAgentPanel - Context
|
|
6343
|
+
console.log("AIAgentPanel - \u274C Context UNCHANGED (strings match)");
|
|
6329
6344
|
}
|
|
6330
|
-
}, [mergedContext]);
|
|
6345
|
+
}, [mergedContext.sections]);
|
|
6331
6346
|
(0, import_react14.useEffect)(() => {
|
|
6332
6347
|
return () => {
|
|
6333
6348
|
if (contextNotificationTimeoutRef.current) {
|
package/dist/index.mjs
CHANGED
|
@@ -6270,17 +6270,32 @@ 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
|
+
}
|
|
6284
6299
|
prevContextRef.current = contextString;
|
|
6285
6300
|
if (contextNotificationTimeoutRef.current) {
|
|
6286
6301
|
clearTimeout(contextNotificationTimeoutRef.current);
|
|
@@ -6292,9 +6307,9 @@ var AIAgentPanel = React13.forwardRef(({
|
|
|
6292
6307
|
contextNotificationTimeoutRef.current = null;
|
|
6293
6308
|
}, 3e3);
|
|
6294
6309
|
} else {
|
|
6295
|
-
console.log("AIAgentPanel - Context
|
|
6310
|
+
console.log("AIAgentPanel - \u274C Context UNCHANGED (strings match)");
|
|
6296
6311
|
}
|
|
6297
|
-
}, [mergedContext]);
|
|
6312
|
+
}, [mergedContext.sections]);
|
|
6298
6313
|
useEffect9(() => {
|
|
6299
6314
|
return () => {
|
|
6300
6315
|
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,17 @@ 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
|
+
|
|
1551
1570
|
prevContextRef.current = contextString;
|
|
1552
1571
|
|
|
1553
1572
|
// Clear any existing timeout before setting a new one
|
|
@@ -1565,12 +1584,12 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
1565
1584
|
contextNotificationTimeoutRef.current = null;
|
|
1566
1585
|
}, 3000);
|
|
1567
1586
|
} else {
|
|
1568
|
-
console.log('AIAgentPanel - Context
|
|
1587
|
+
console.log('AIAgentPanel - ❌ Context UNCHANGED (strings match)');
|
|
1569
1588
|
}
|
|
1570
1589
|
|
|
1571
1590
|
// Note: No cleanup on every re-render - only clear timeout when context changes
|
|
1572
1591
|
// This prevents race conditions when switching rapidly
|
|
1573
|
-
}, [mergedContext]);
|
|
1592
|
+
}, [mergedContext.sections]);
|
|
1574
1593
|
|
|
1575
1594
|
// Separate cleanup effect for unmount only
|
|
1576
1595
|
useEffect(() => {
|