@aravindc26/velu 0.13.13 → 0.13.15
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/package.json
CHANGED
|
@@ -585,12 +585,8 @@ export function renderDocsLayout(config: DocsLayoutConfig, children: ReactNode):
|
|
|
585
585
|
</div>
|
|
586
586
|
)
|
|
587
587
|
: undefined,
|
|
588
|
-
footer: (
|
|
589
|
-
<div
|
|
590
|
-
className={['velu-sidebar-footer-shell', className].filter(Boolean).join(' ')}
|
|
591
|
-
{...props}
|
|
592
|
-
>
|
|
593
|
-
{footerChildren ? <div className="velu-sidebar-footer-icons">{footerChildren}</div> : null}
|
|
588
|
+
footer: (
|
|
589
|
+
<div className="velu-sidebar-footer-shell">
|
|
594
590
|
<SidebarLinks anchors={globalAnchors} iconLibrary={iconLibrary} languages={languages} />
|
|
595
591
|
</div>
|
|
596
592
|
),
|
|
@@ -478,7 +478,59 @@ function initAssistant() {
|
|
|
478
478
|
if (savedConvToken) state.conversationToken = savedConvToken;
|
|
479
479
|
if (savedSeq) state.lastSeq = parseInt(savedSeq, 10) || 0;
|
|
480
480
|
if (savedFeedback) try { state.feedback = JSON.parse(savedFeedback); } catch {}
|
|
481
|
-
if (savedMessages)
|
|
481
|
+
if (savedMessages) {
|
|
482
|
+
messagesEl.innerHTML = savedMessages;
|
|
483
|
+
// Re-bind action handlers on restored messages
|
|
484
|
+
messagesEl.querySelectorAll('.velu-msg-assistant').forEach((msgDiv) => {
|
|
485
|
+
const messageId = msgDiv.getAttribute('data-message-id');
|
|
486
|
+
const mid = messageId ? parseInt(messageId, 10) : null;
|
|
487
|
+
const likeBtn = msgDiv.querySelector('.velu-msg-like') as HTMLElement | null;
|
|
488
|
+
const dislikeBtn = msgDiv.querySelector('.velu-msg-dislike') as HTMLElement | null;
|
|
489
|
+
const copyBtn = msgDiv.querySelector('.velu-msg-copy') as HTMLElement | null;
|
|
490
|
+
const bubble = msgDiv.querySelector('.velu-msg-bubble') as HTMLElement | null;
|
|
491
|
+
|
|
492
|
+
if (likeBtn && dislikeBtn && mid) {
|
|
493
|
+
likeBtn.onclick = () => {
|
|
494
|
+
const isActive = likeBtn.classList.contains('velu-msg-action-active');
|
|
495
|
+
if (isActive) {
|
|
496
|
+
likeBtn.classList.remove('velu-msg-action-active');
|
|
497
|
+
delete state.feedback[mid];
|
|
498
|
+
saveFeedbackState();
|
|
499
|
+
retractFeedback(mid).catch(() => {});
|
|
500
|
+
} else {
|
|
501
|
+
likeBtn.classList.add('velu-msg-action-active');
|
|
502
|
+
dislikeBtn.classList.remove('velu-msg-action-active');
|
|
503
|
+
state.feedback[mid] = 'up';
|
|
504
|
+
saveFeedbackState();
|
|
505
|
+
submitFeedback(mid, 'up').catch(() => {});
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
dislikeBtn.onclick = () => {
|
|
509
|
+
const isActive = dislikeBtn.classList.contains('velu-msg-action-active');
|
|
510
|
+
if (isActive) {
|
|
511
|
+
dislikeBtn.classList.remove('velu-msg-action-active');
|
|
512
|
+
delete state.feedback[mid];
|
|
513
|
+
saveFeedbackState();
|
|
514
|
+
retractFeedback(mid).catch(() => {});
|
|
515
|
+
} else {
|
|
516
|
+
dislikeBtn.classList.add('velu-msg-action-active');
|
|
517
|
+
likeBtn.classList.remove('velu-msg-action-active');
|
|
518
|
+
state.feedback[mid] = 'down';
|
|
519
|
+
saveFeedbackState();
|
|
520
|
+
submitFeedback(mid, 'down').catch(() => {});
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
if (copyBtn && bubble) {
|
|
525
|
+
copyBtn.onclick = () => {
|
|
526
|
+
navigator.clipboard.writeText(bubble.textContent || '');
|
|
527
|
+
copyBtn.classList.add('velu-msg-action-active');
|
|
528
|
+
copyBtn.title = 'Copied!';
|
|
529
|
+
setTimeout(() => { copyBtn.classList.remove('velu-msg-action-active'); copyBtn.title = 'Copy'; }, 1500);
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
482
534
|
if (savedExpanded === '1') {
|
|
483
535
|
state.expanded = true;
|
|
484
536
|
panel.classList.add('velu-assistant-expanded');
|