@hef2024/llmasaservice-ui 0.22.2 → 0.22.3
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 +16 -1
- package/dist/index.mjs +16 -1
- package/package.json +1 -1
- package/src/AIAgentPanel.tsx +8 -1
- package/src/AIChatPanel.tsx +14 -1
package/dist/index.js
CHANGED
|
@@ -4576,9 +4576,18 @@ var AIChatPanel = ({
|
|
|
4576
4576
|
(0, import_react12.useEffect)(() => {
|
|
4577
4577
|
const currentResponseLength = response.length;
|
|
4578
4578
|
const responseGotLonger = currentResponseLength > prevResponseLengthRef.current;
|
|
4579
|
+
console.log("AIChatPanel - Auto-scroll effect:", {
|
|
4580
|
+
idle,
|
|
4581
|
+
currentResponseLength,
|
|
4582
|
+
prevLength: prevResponseLengthRef.current,
|
|
4583
|
+
responseGotLonger,
|
|
4584
|
+
userHasScrolled,
|
|
4585
|
+
scrollToEnd
|
|
4586
|
+
});
|
|
4579
4587
|
prevResponseLengthRef.current = currentResponseLength;
|
|
4580
4588
|
const shouldAutoScroll = scrollToEnd || !userHasScrolled;
|
|
4581
4589
|
if (!idle && shouldAutoScroll && response && responseGotLonger) {
|
|
4590
|
+
console.log("AIChatPanel - Calling scrollToBottom");
|
|
4582
4591
|
scrollToBottom(false);
|
|
4583
4592
|
}
|
|
4584
4593
|
}, [response, scrollToBottom, idle, userHasScrolled, scrollToEnd]);
|
|
@@ -6273,12 +6282,16 @@ var AIAgentPanel = import_react14.default.forwardRef(({
|
|
|
6273
6282
|
}, [context, sharedContextSections, pageContextSections, contextDataSources]);
|
|
6274
6283
|
(0, import_react14.useEffect)(() => {
|
|
6275
6284
|
const contextString = JSON.stringify(mergedContext.sections.map((s) => ({ id: s.id, data: s.data })));
|
|
6285
|
+
console.log("AIAgentPanel - Context effect running, sections:", mergedContext.sections.length);
|
|
6276
6286
|
if (prevContextRef.current === null) {
|
|
6287
|
+
console.log("AIAgentPanel - First render, initializing context ref");
|
|
6277
6288
|
prevContextRef.current = contextString;
|
|
6278
6289
|
return;
|
|
6279
6290
|
}
|
|
6280
6291
|
if (prevContextRef.current !== contextString) {
|
|
6281
6292
|
console.log("AIAgentPanel - Context changed, showing notification");
|
|
6293
|
+
console.log("AIAgentPanel - Old context:", prevContextRef.current.substring(0, 100));
|
|
6294
|
+
console.log("AIAgentPanel - New context:", contextString.substring(0, 100));
|
|
6282
6295
|
prevContextRef.current = contextString;
|
|
6283
6296
|
if (contextNotificationTimeoutRef.current) {
|
|
6284
6297
|
clearTimeout(contextNotificationTimeoutRef.current);
|
|
@@ -6289,8 +6302,10 @@ var AIAgentPanel = import_react14.default.forwardRef(({
|
|
|
6289
6302
|
setShowContextNotification(false);
|
|
6290
6303
|
contextNotificationTimeoutRef.current = null;
|
|
6291
6304
|
}, 3e3);
|
|
6305
|
+
} else {
|
|
6306
|
+
console.log("AIAgentPanel - Context unchanged");
|
|
6292
6307
|
}
|
|
6293
|
-
}, [mergedContext
|
|
6308
|
+
}, [mergedContext]);
|
|
6294
6309
|
(0, import_react14.useEffect)(() => {
|
|
6295
6310
|
return () => {
|
|
6296
6311
|
if (contextNotificationTimeoutRef.current) {
|
package/dist/index.mjs
CHANGED
|
@@ -4543,9 +4543,18 @@ var AIChatPanel = ({
|
|
|
4543
4543
|
useEffect7(() => {
|
|
4544
4544
|
const currentResponseLength = response.length;
|
|
4545
4545
|
const responseGotLonger = currentResponseLength > prevResponseLengthRef.current;
|
|
4546
|
+
console.log("AIChatPanel - Auto-scroll effect:", {
|
|
4547
|
+
idle,
|
|
4548
|
+
currentResponseLength,
|
|
4549
|
+
prevLength: prevResponseLengthRef.current,
|
|
4550
|
+
responseGotLonger,
|
|
4551
|
+
userHasScrolled,
|
|
4552
|
+
scrollToEnd
|
|
4553
|
+
});
|
|
4546
4554
|
prevResponseLengthRef.current = currentResponseLength;
|
|
4547
4555
|
const shouldAutoScroll = scrollToEnd || !userHasScrolled;
|
|
4548
4556
|
if (!idle && shouldAutoScroll && response && responseGotLonger) {
|
|
4557
|
+
console.log("AIChatPanel - Calling scrollToBottom");
|
|
4549
4558
|
scrollToBottom(false);
|
|
4550
4559
|
}
|
|
4551
4560
|
}, [response, scrollToBottom, idle, userHasScrolled, scrollToEnd]);
|
|
@@ -6240,12 +6249,16 @@ var AIAgentPanel = React13.forwardRef(({
|
|
|
6240
6249
|
}, [context, sharedContextSections, pageContextSections, contextDataSources]);
|
|
6241
6250
|
useEffect9(() => {
|
|
6242
6251
|
const contextString = JSON.stringify(mergedContext.sections.map((s) => ({ id: s.id, data: s.data })));
|
|
6252
|
+
console.log("AIAgentPanel - Context effect running, sections:", mergedContext.sections.length);
|
|
6243
6253
|
if (prevContextRef.current === null) {
|
|
6254
|
+
console.log("AIAgentPanel - First render, initializing context ref");
|
|
6244
6255
|
prevContextRef.current = contextString;
|
|
6245
6256
|
return;
|
|
6246
6257
|
}
|
|
6247
6258
|
if (prevContextRef.current !== contextString) {
|
|
6248
6259
|
console.log("AIAgentPanel - Context changed, showing notification");
|
|
6260
|
+
console.log("AIAgentPanel - Old context:", prevContextRef.current.substring(0, 100));
|
|
6261
|
+
console.log("AIAgentPanel - New context:", contextString.substring(0, 100));
|
|
6249
6262
|
prevContextRef.current = contextString;
|
|
6250
6263
|
if (contextNotificationTimeoutRef.current) {
|
|
6251
6264
|
clearTimeout(contextNotificationTimeoutRef.current);
|
|
@@ -6256,8 +6269,10 @@ var AIAgentPanel = React13.forwardRef(({
|
|
|
6256
6269
|
setShowContextNotification(false);
|
|
6257
6270
|
contextNotificationTimeoutRef.current = null;
|
|
6258
6271
|
}, 3e3);
|
|
6272
|
+
} else {
|
|
6273
|
+
console.log("AIAgentPanel - Context unchanged");
|
|
6259
6274
|
}
|
|
6260
|
-
}, [mergedContext
|
|
6275
|
+
}, [mergedContext]);
|
|
6261
6276
|
useEffect9(() => {
|
|
6262
6277
|
return () => {
|
|
6263
6278
|
if (contextNotificationTimeoutRef.current) {
|
package/package.json
CHANGED
package/src/AIAgentPanel.tsx
CHANGED
|
@@ -1534,8 +1534,11 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
1534
1534
|
// Create a stable string representation of the context for comparison
|
|
1535
1535
|
const contextString = JSON.stringify(mergedContext.sections.map(s => ({ id: s.id, data: s.data })));
|
|
1536
1536
|
|
|
1537
|
+
console.log('AIAgentPanel - Context effect running, sections:', mergedContext.sections.length);
|
|
1538
|
+
|
|
1537
1539
|
// Skip on first render
|
|
1538
1540
|
if (prevContextRef.current === null) {
|
|
1541
|
+
console.log('AIAgentPanel - First render, initializing context ref');
|
|
1539
1542
|
prevContextRef.current = contextString;
|
|
1540
1543
|
return;
|
|
1541
1544
|
}
|
|
@@ -1543,6 +1546,8 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
1543
1546
|
// Check if context actually changed
|
|
1544
1547
|
if (prevContextRef.current !== contextString) {
|
|
1545
1548
|
console.log('AIAgentPanel - Context changed, showing notification');
|
|
1549
|
+
console.log('AIAgentPanel - Old context:', prevContextRef.current.substring(0, 100));
|
|
1550
|
+
console.log('AIAgentPanel - New context:', contextString.substring(0, 100));
|
|
1546
1551
|
prevContextRef.current = contextString;
|
|
1547
1552
|
|
|
1548
1553
|
// Clear any existing timeout before setting a new one
|
|
@@ -1559,11 +1564,13 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
1559
1564
|
setShowContextNotification(false);
|
|
1560
1565
|
contextNotificationTimeoutRef.current = null;
|
|
1561
1566
|
}, 3000);
|
|
1567
|
+
} else {
|
|
1568
|
+
console.log('AIAgentPanel - Context unchanged');
|
|
1562
1569
|
}
|
|
1563
1570
|
|
|
1564
1571
|
// Note: No cleanup on every re-render - only clear timeout when context changes
|
|
1565
1572
|
// This prevents race conditions when switching rapidly
|
|
1566
|
-
}, [mergedContext
|
|
1573
|
+
}, [mergedContext]);
|
|
1567
1574
|
|
|
1568
1575
|
// Separate cleanup effect for unmount only
|
|
1569
1576
|
useEffect(() => {
|
package/src/AIChatPanel.tsx
CHANGED
|
@@ -1830,14 +1830,27 @@ const AIChatPanel: React.FC<AIChatPanelProps> = ({
|
|
|
1830
1830
|
// 4. The response actually got longer (not just a re-render from layout change)
|
|
1831
1831
|
const currentResponseLength = response.length;
|
|
1832
1832
|
const responseGotLonger = currentResponseLength > prevResponseLengthRef.current;
|
|
1833
|
+
|
|
1834
|
+
console.log('AIChatPanel - Auto-scroll effect:', {
|
|
1835
|
+
idle,
|
|
1836
|
+
currentResponseLength,
|
|
1837
|
+
prevLength: prevResponseLengthRef.current,
|
|
1838
|
+
responseGotLonger,
|
|
1839
|
+
userHasScrolled,
|
|
1840
|
+
scrollToEnd,
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1833
1843
|
prevResponseLengthRef.current = currentResponseLength;
|
|
1834
1844
|
|
|
1845
|
+
// CRITICAL: Only auto-scroll during active streaming when response grows
|
|
1846
|
+
// This prevents scroll on layout changes (toast, context updates, etc.)
|
|
1835
1847
|
const shouldAutoScroll = scrollToEnd || !userHasScrolled;
|
|
1836
1848
|
if (!idle && shouldAutoScroll && response && responseGotLonger) {
|
|
1849
|
+
console.log('AIChatPanel - Calling scrollToBottom');
|
|
1837
1850
|
// Use non-forced scroll - will only scroll if near bottom
|
|
1838
1851
|
scrollToBottom(false);
|
|
1839
1852
|
}
|
|
1840
|
-
}, [response, scrollToBottom, idle, userHasScrolled, scrollToEnd]);
|
|
1853
|
+
}, [response, scrollToBottom, idle, userHasScrolled, scrollToEnd]);
|
|
1841
1854
|
|
|
1842
1855
|
// Ref to track idle state for scroll handler (avoids stale closure)
|
|
1843
1856
|
const idleRef = useRef(idle);
|