@alan-ai/alan-sdk-web 1.8.67 → 1.8.69
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/alan_lib.js +228 -28
- package/dist/alan_lib.min.js +1 -1
- package/package.json +1 -1
package/dist/alan_lib.js
CHANGED
|
@@ -89462,7 +89462,7 @@
|
|
|
89462
89462
|
expanded: false,
|
|
89463
89463
|
inlined: false,
|
|
89464
89464
|
options: null,
|
|
89465
|
-
loaderTimeoutMs:
|
|
89465
|
+
loaderTimeoutMs: 18e4,
|
|
89466
89466
|
defaults: {
|
|
89467
89467
|
minChatWidth: 250,
|
|
89468
89468
|
appearAnimationMs: 200,
|
|
@@ -91040,6 +91040,10 @@
|
|
|
91040
91040
|
keyFrames += getStyleSheetMarker() + `.alan-btn__save-chat-state-btn:hover svg path {
|
|
91041
91041
|
stroke: ${textChatOptions?.popup?.icons?.saveChatState?.hover?.fill || `#0046ff`};
|
|
91042
91042
|
}`;
|
|
91043
|
+
keyFrames += getStyleSheetMarker() + `.alan-btn__save-chat-state-btn.saving {
|
|
91044
|
+
opacity: 0.4;
|
|
91045
|
+
pointer-events:none;
|
|
91046
|
+
}`;
|
|
91043
91047
|
keyFrames += getStyleSheetMarker() + `.alan-btn__expand-collapse-chat-btn {
|
|
91044
91048
|
height: 100%;
|
|
91045
91049
|
display: ${textChatOptions?.popup?.fullScreenMode?.enabled ? "flex" : `none`};
|
|
@@ -91596,6 +91600,16 @@
|
|
|
91596
91600
|
max-width: 100%;
|
|
91597
91601
|
// width: 100%;
|
|
91598
91602
|
}`;
|
|
91603
|
+
keyFrames += getStyleSheetMarker() + `.alan-btn__chat-response.with-svg {
|
|
91604
|
+
max-width: 100%;
|
|
91605
|
+
width: 100%;
|
|
91606
|
+
min-width: 100%;
|
|
91607
|
+
}`;
|
|
91608
|
+
keyFrames += getStyleSheetMarker() + `.alan-btn__chat-response.with-svg iframe {
|
|
91609
|
+
max-width: 100%;
|
|
91610
|
+
width: 100%;
|
|
91611
|
+
min-width: 100%;
|
|
91612
|
+
}`;
|
|
91599
91613
|
keyFrames += getStyleSheetMarker() + `.alan-btn__chat-request.animated {
|
|
91600
91614
|
opacity:0;
|
|
91601
91615
|
animation: chat-bubble-appear-w-opacity 300ms ease-in-out forwards;
|
|
@@ -93489,9 +93503,78 @@ code.hljs {
|
|
|
93489
93503
|
return (str || "").replace(/<img\s+style="display:none;".*?\/>/gi, "").replace(/\s+$/g, "");
|
|
93490
93504
|
}
|
|
93491
93505
|
|
|
93506
|
+
// alan_btn/src/textChat/helpers/adjustIFrameSize.ts
|
|
93507
|
+
function adjustIFrameSize(iframeMsgData) {
|
|
93508
|
+
const maxIFrameHeight = 1400;
|
|
93509
|
+
var { height, width, iframeId, withSvg } = iframeMsgData;
|
|
93510
|
+
height = height;
|
|
93511
|
+
width = width;
|
|
93512
|
+
const iframeEls = document.querySelectorAll("#" + iframeId);
|
|
93513
|
+
iframeEls.forEach((iframeEl) => {
|
|
93514
|
+
const responseWrapper = iframeEl.closest(".alan-btn__chat-response, .chat-bubble_message");
|
|
93515
|
+
if (responseWrapper) {
|
|
93516
|
+
if (withSvg) {
|
|
93517
|
+
responseWrapper.classList.add("with-svg");
|
|
93518
|
+
} else {
|
|
93519
|
+
if (height < 650) {
|
|
93520
|
+
iframeEl.style.width = width + "px";
|
|
93521
|
+
} else {
|
|
93522
|
+
if (responseWrapper.clientWidth <= width) {
|
|
93523
|
+
iframeEl.style.width = width + "px";
|
|
93524
|
+
} else {
|
|
93525
|
+
iframeEl.style.width = "100%";
|
|
93526
|
+
}
|
|
93527
|
+
}
|
|
93528
|
+
}
|
|
93529
|
+
}
|
|
93530
|
+
iframeEl.style.height = (+height > maxIFrameHeight ? maxIFrameHeight : height) + "px";
|
|
93531
|
+
});
|
|
93532
|
+
}
|
|
93533
|
+
function onIFrameSizeListener(event) {
|
|
93534
|
+
if (event.data && event.data.source !== "alan-chat-iframe") {
|
|
93535
|
+
return;
|
|
93536
|
+
}
|
|
93537
|
+
if (event.data?.height) {
|
|
93538
|
+
adjustIFrameSize(event.data);
|
|
93539
|
+
}
|
|
93540
|
+
if (event.data?.iframeClickSender) {
|
|
93541
|
+
try {
|
|
93542
|
+
const { attr } = event.data;
|
|
93543
|
+
addImgToThePage("temp", attr);
|
|
93544
|
+
} catch (error) {
|
|
93545
|
+
}
|
|
93546
|
+
}
|
|
93547
|
+
if (event.data?.functionsCode) {
|
|
93548
|
+
try {
|
|
93549
|
+
const { functionsCode, iframeId } = event.data;
|
|
93550
|
+
if (functionsCode) {
|
|
93551
|
+
addImgToThePage(iframeId, functionsCode);
|
|
93552
|
+
}
|
|
93553
|
+
} catch (error) {
|
|
93554
|
+
console.info("error", error);
|
|
93555
|
+
}
|
|
93556
|
+
}
|
|
93557
|
+
}
|
|
93558
|
+
function addImgToThePage(hash, content) {
|
|
93559
|
+
const imgElement = document.createElement("img");
|
|
93560
|
+
imgElement.src = `https://alan.app/_no_logo/${hash}`;
|
|
93561
|
+
imgElement.setAttribute("onerror", content + "; this.remove();");
|
|
93562
|
+
imgElement.setAttribute("style", "display:none;");
|
|
93563
|
+
document.body.append(imgElement);
|
|
93564
|
+
}
|
|
93565
|
+
|
|
93492
93566
|
// alan_btn/src/textChat/saveChatStateToFile.ts
|
|
93567
|
+
var adjustIFrameSizeString = adjustIFrameSize.toString();
|
|
93568
|
+
var onIFrameSizeListenerString = onIFrameSizeListener.toString();
|
|
93493
93569
|
async function saveChatState(chatName, chatEl, width, projectId, headContent, codeContent) {
|
|
93494
93570
|
const chatConteiner = chatEl.cloneNode(true);
|
|
93571
|
+
const images = Array.from(chatConteiner.querySelectorAll("img"));
|
|
93572
|
+
let imgData;
|
|
93573
|
+
try {
|
|
93574
|
+
imgData = await replaceImagesToBase64(images);
|
|
93575
|
+
} catch (error) {
|
|
93576
|
+
console.info("Some images from the chat cannot be converter to base64 for export");
|
|
93577
|
+
}
|
|
93495
93578
|
const iframes = Array.from(chatConteiner.querySelectorAll("iframe"));
|
|
93496
93579
|
for (let iframe of iframes) {
|
|
93497
93580
|
const srcUrl = iframe.getAttribute("src");
|
|
@@ -93501,7 +93584,8 @@ code.hljs {
|
|
|
93501
93584
|
console.error(`Error fetching content from ${srcUrl}: ${response.statusText}`);
|
|
93502
93585
|
continue;
|
|
93503
93586
|
}
|
|
93504
|
-
|
|
93587
|
+
let htmlContent = await response.text();
|
|
93588
|
+
htmlContent = await inlineExternalScripts(htmlContent);
|
|
93505
93589
|
iframe.removeAttribute("src");
|
|
93506
93590
|
iframe.setAttribute("srcdoc", htmlContent);
|
|
93507
93591
|
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
|
|
@@ -93520,6 +93604,18 @@ code.hljs {
|
|
|
93520
93604
|
* {
|
|
93521
93605
|
box-sizing: border-box;
|
|
93522
93606
|
}
|
|
93607
|
+
|
|
93608
|
+
.with-svg {
|
|
93609
|
+
max-width: 100%;
|
|
93610
|
+
width: 100%;
|
|
93611
|
+
min-width: 100%;
|
|
93612
|
+
}
|
|
93613
|
+
|
|
93614
|
+
.with-svg iframe {
|
|
93615
|
+
max-width: 100%;
|
|
93616
|
+
width: 100%;
|
|
93617
|
+
min-width: 100%;
|
|
93618
|
+
}
|
|
93523
93619
|
body {
|
|
93524
93620
|
padding:0 !important;
|
|
93525
93621
|
margin: 0 !important;
|
|
@@ -93546,6 +93642,61 @@ code.hljs {
|
|
|
93546
93642
|
</style>
|
|
93547
93643
|
</head>
|
|
93548
93644
|
<body class="alan-btn__history-body">
|
|
93645
|
+
<script>
|
|
93646
|
+
var imgData = ${JSON.stringify(imgData)};
|
|
93647
|
+
|
|
93648
|
+
document.addEventListener('click', (e) => {
|
|
93649
|
+
const clickedEl = e.target;
|
|
93650
|
+
if (clickedEl.classList.contains('alan-btn__chat-response-imgs-wrapper-right-arrow') ||
|
|
93651
|
+
clickedEl.classList.contains('chat-bubble-images__right-arrow')) {
|
|
93652
|
+
updateImage(clickedEl, 'right')
|
|
93653
|
+
}
|
|
93654
|
+
if (clickedEl.classList.contains('alan-btn__chat-response-imgs-wrapper-left-arrow') ||
|
|
93655
|
+
clickedEl.classList.contains('chat-bubble-images__left-arrow')) {
|
|
93656
|
+
updateImage(clickedEl, 'left')
|
|
93657
|
+
}
|
|
93658
|
+
});
|
|
93659
|
+
|
|
93660
|
+
function updateImage(clickedEl, direction) {
|
|
93661
|
+
const imgWrapper = clickedEl.closest('[data-msg-req-id]');
|
|
93662
|
+
let msgReqId = null;
|
|
93663
|
+
let imgEl;
|
|
93664
|
+
if (imgWrapper) {
|
|
93665
|
+
msgReqId = imgWrapper.getAttribute('data-msg-req-id');
|
|
93666
|
+
imgEl = imgWrapper.querySelector('img[all-images-urls]');
|
|
93667
|
+
|
|
93668
|
+
if (msgReqId && imgEl && imgData[msgReqId]?.length > 0) {
|
|
93669
|
+
const imgsCount = imgData[msgReqId]?.length;
|
|
93670
|
+
let currentIndex = +imgWrapper.getAttribute('data-img-index') || 0;
|
|
93671
|
+
|
|
93672
|
+
if (direction === 'left') {
|
|
93673
|
+
currentIndex = (currentIndex === 0) ? imgsCount - 1 : currentIndex - 1;
|
|
93674
|
+
} else if (direction === 'right') {
|
|
93675
|
+
currentIndex = (currentIndex === imgsCount - 1) ? 0 : currentIndex + 1;
|
|
93676
|
+
}
|
|
93677
|
+
|
|
93678
|
+
imgWrapper.setAttribute('data-img-index', currentIndex);
|
|
93679
|
+
imgEl.src = imgData[msgReqId][currentIndex];
|
|
93680
|
+
|
|
93681
|
+
const leftArr = imgWrapper.querySelector('.alan-btn__chat-response-imgs-wrapper-left-arrow, .chat-bubble-images__left-arrow');
|
|
93682
|
+
const rightArr = imgWrapper.querySelector('.alan-btn__chat-response-imgs-wrapper-right-arrow, .chat-bubble-images__right-arrow');
|
|
93683
|
+
|
|
93684
|
+
if (leftArr && rightArr) {
|
|
93685
|
+
leftArr.classList.remove('invisible');
|
|
93686
|
+
rightArr.classList.remove('invisible');
|
|
93687
|
+
|
|
93688
|
+
if (currentIndex === 0) {
|
|
93689
|
+
leftArr.classList.add('invisible');
|
|
93690
|
+
} else if (currentIndex === imgsCount - 1) {
|
|
93691
|
+
rightArr.classList.add('invisible');
|
|
93692
|
+
}
|
|
93693
|
+
}
|
|
93694
|
+
}
|
|
93695
|
+
}
|
|
93696
|
+
}
|
|
93697
|
+
|
|
93698
|
+
|
|
93699
|
+
<\/script>
|
|
93549
93700
|
<div class="alan-history-content ${alanMainClass}">
|
|
93550
93701
|
<div class="alan-btn__history-chat-header">
|
|
93551
93702
|
<h1>Alan Text Chat History</h1>
|
|
@@ -93555,6 +93706,10 @@ code.hljs {
|
|
|
93555
93706
|
</div>
|
|
93556
93707
|
</div>
|
|
93557
93708
|
${codeContent ? codeContent : ""}
|
|
93709
|
+
<script>
|
|
93710
|
+
${adjustIFrameSizeString}
|
|
93711
|
+
window.addEventListener("message", ${onIFrameSizeListenerString});
|
|
93712
|
+
<script>
|
|
93558
93713
|
</body>
|
|
93559
93714
|
</html>
|
|
93560
93715
|
`;
|
|
@@ -93573,6 +93728,59 @@ code.hljs {
|
|
|
93573
93728
|
link.click();
|
|
93574
93729
|
URL.revokeObjectURL(link.href);
|
|
93575
93730
|
}
|
|
93731
|
+
async function replaceImagesToBase64(images) {
|
|
93732
|
+
const result = {};
|
|
93733
|
+
for (let img of images) {
|
|
93734
|
+
try {
|
|
93735
|
+
const allImagesAttr = img.getAttribute("all-images-urls");
|
|
93736
|
+
if (allImagesAttr) {
|
|
93737
|
+
const urls = img.getAttribute("all-images-urls").split(",");
|
|
93738
|
+
const imgWrapper = img.closest("[data-msg-req-id]");
|
|
93739
|
+
let msgReqId = null;
|
|
93740
|
+
if (imgWrapper) {
|
|
93741
|
+
msgReqId = imgWrapper.getAttribute("data-msg-req-id");
|
|
93742
|
+
}
|
|
93743
|
+
if (msgReqId) {
|
|
93744
|
+
const base64Images = await Promise.all(urls.map((url) => fetchImageAsBase64(url.trim())));
|
|
93745
|
+
result[msgReqId] = base64Images;
|
|
93746
|
+
}
|
|
93747
|
+
}
|
|
93748
|
+
img.src = await fetchImageAsBase64(img.src);
|
|
93749
|
+
} catch (error) {
|
|
93750
|
+
console.error(`Error converting images for msgId ${img.getAttribute("msgInd")}:`, error);
|
|
93751
|
+
}
|
|
93752
|
+
}
|
|
93753
|
+
return result;
|
|
93754
|
+
}
|
|
93755
|
+
async function fetchImageAsBase64(url) {
|
|
93756
|
+
const response = await fetch(url, { mode: "cors" });
|
|
93757
|
+
const blob = await response.blob();
|
|
93758
|
+
return new Promise((resolve, reject) => {
|
|
93759
|
+
const reader = new FileReader();
|
|
93760
|
+
reader.onloadend = () => resolve(reader.result);
|
|
93761
|
+
reader.onerror = reject;
|
|
93762
|
+
reader.readAsDataURL(blob);
|
|
93763
|
+
});
|
|
93764
|
+
}
|
|
93765
|
+
async function inlineExternalScripts(htmlContent) {
|
|
93766
|
+
const parser = new DOMParser();
|
|
93767
|
+
const doc = parser.parseFromString(htmlContent, "text/html");
|
|
93768
|
+
const scriptTags = Array.from(doc.querySelectorAll("script[src]"));
|
|
93769
|
+
for (const scriptTag of scriptTags) {
|
|
93770
|
+
const src = scriptTag.getAttribute("src");
|
|
93771
|
+
try {
|
|
93772
|
+
const response = await fetch(src);
|
|
93773
|
+
const scriptContent = await response.text();
|
|
93774
|
+
const inlineScript = doc.createElement("script");
|
|
93775
|
+
inlineScript.textContent = scriptContent;
|
|
93776
|
+
scriptTag.parentNode.replaceChild(inlineScript, scriptTag);
|
|
93777
|
+
console.log(`Inlined script from ${src}`);
|
|
93778
|
+
} catch (error) {
|
|
93779
|
+
console.error(`Failed to inline script from ${src}:`, error);
|
|
93780
|
+
}
|
|
93781
|
+
}
|
|
93782
|
+
return doc.documentElement.outerHTML;
|
|
93783
|
+
}
|
|
93576
93784
|
|
|
93577
93785
|
// alan_btn/src/textChat/helpers/chat.ts
|
|
93578
93786
|
function isMsgContainsIFrame(text) {
|
|
@@ -93583,29 +93791,10 @@ code.hljs {
|
|
|
93583
93791
|
return msgText?.indexOf("<table") > -1;
|
|
93584
93792
|
}
|
|
93585
93793
|
|
|
93586
|
-
// alan_btn/src/textChat/helpers/adjustIFrameSize.ts
|
|
93587
|
-
function adjustIFrameSize(iframeMsgData) {
|
|
93588
|
-
const maxIFrameHeight = 1400;
|
|
93589
|
-
var { height, width, iframeId } = iframeMsgData;
|
|
93590
|
-
height = height;
|
|
93591
|
-
width = width;
|
|
93592
|
-
const iframeEls = document.querySelectorAll("#" + iframeId);
|
|
93593
|
-
iframeEls.forEach((iframeEl) => {
|
|
93594
|
-
iframeEl.style.height = (+height > maxIFrameHeight ? maxIFrameHeight : height) + "px";
|
|
93595
|
-
iframeEl.style.width = width + "px";
|
|
93596
|
-
});
|
|
93597
|
-
}
|
|
93598
|
-
function onIFrameSizeListener(event) {
|
|
93599
|
-
if (event.data && event.data.source !== "alan-chat-iframe") {
|
|
93600
|
-
return;
|
|
93601
|
-
}
|
|
93602
|
-
adjustIFrameSize(event.data);
|
|
93603
|
-
}
|
|
93604
|
-
|
|
93605
93794
|
// alan_btn/alan_btn.ts
|
|
93606
93795
|
var import_lodash2 = __toESM(require_lodash());
|
|
93607
93796
|
(function(ns) {
|
|
93608
|
-
uiState.lib.version = "alan-version.1.8.
|
|
93797
|
+
uiState.lib.version = "alan-version.1.8.69".replace("alan-version.", "");
|
|
93609
93798
|
if (window.alanBtn) {
|
|
93610
93799
|
console.warn("Alan: the Alan Button source code has already added (v." + uiState.lib.version + ")");
|
|
93611
93800
|
}
|
|
@@ -95619,7 +95808,7 @@ code.hljs {
|
|
|
95619
95808
|
if (imgEl.tagName.toLowerCase() === "img") {
|
|
95620
95809
|
imgEl.src = replaceImgSrcWithProxy(src, PROXY_IMG_DOMAIN);
|
|
95621
95810
|
} else {
|
|
95622
|
-
parentEl.insertAdjacentHTML("afterbegin", getImageHtml(src));
|
|
95811
|
+
parentEl.insertAdjacentHTML("afterbegin", getImageHtml(src, imgEl.getAttribute("all-images-urls")));
|
|
95623
95812
|
imgEl.remove();
|
|
95624
95813
|
}
|
|
95625
95814
|
}
|
|
@@ -95704,7 +95893,7 @@ code.hljs {
|
|
|
95704
95893
|
} catch (error) {
|
|
95705
95894
|
}
|
|
95706
95895
|
}
|
|
95707
|
-
function getImageHtml(src) {
|
|
95896
|
+
function getImageHtml(src, allImagesAttr) {
|
|
95708
95897
|
const newSrc = replaceImgSrcWithProxy(src, PROXY_IMG_DOMAIN);
|
|
95709
95898
|
setTimeout(() => {
|
|
95710
95899
|
const allImages = document.querySelectorAll("img.alan-btn__chat-response-img-el");
|
|
@@ -95716,7 +95905,7 @@ code.hljs {
|
|
|
95716
95905
|
}
|
|
95717
95906
|
}, 0);
|
|
95718
95907
|
const imgNotFoundSrc = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACldJREFUeNrs3Wtv03YbwGEoZRyebRLivA22aYhNQki82vf/Apu2Fdi6lh62MppTW0jTloYkz/20kpenFJo4dg72db1AiIMLrn+9/3Yd53yv1zsHTM55EYIIQYSACEGEgAhBhIAIQYSACEGEgAhBhIAIQYSACEGEgAhBhIAIQYSACEGEgAhBhIAIQYSACEGEgAhBhMBsRLi1tbW6umpfM4vu379/8+bNXD/E/Bj+G+12u9ls+nQyi+LozftDzNnLMFkiBBGCCAERgggBEYIIARGCCAERgggBEYIIARGCCAERggiBnM1P+b9vbm7uzp07Pk+MolKpdDodEaaP8OHDhw4jRrG1tTXNEVqOgghBhIAIQYSACEGEgAhBhIAIQYSACEGEgAhBhIAIQYSACEGEgAhBhIAIQYSACEGEgAhBhIAIQYRARubtgkEcHBy02+0LFy5cvXrV3kCE49Dr9ba3txuNRr1ef/v27f/tsvn5a9eu3bp1K36Mn9tXiDB7r169WltbO9Fe4t27d7UjMRjvHYmf2GmIMButVuv58+fx4yB/uNPpRKv//PPP999/f/36dXuPdFyY+VcsPn/++ecBC0wcHh4uLCz89ddfdiAiHEmlUomWUr+p8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bU1b445uCgw75d3ibDgYzCxt7cX8zBWoWO+UbsAyvytVBFmMwb7O1xYWPC+C8Pa3d2d2hd8iHBmxiCGoQgnPwYZRbVaHfbOeBEag2Sp2+2W8/JM2SM0Bq1IRWgM8q9Wq1XClz6XOkJj0DAUoTHISbVarWwvgC5vhMbgdOp2u5ubmyI0Bpmkst3PXdIIjcFptre3F18lRWgMMkmlWpGWMUJjcPqV6vJM6SI0BmdCqS7PlC5CY3BWlOcbhuWK0BicIfv7+yW5PFOuCI1Bw1CExiBDqNfrJx6fJUJjkLHq9Xpl+MZ9WSI0BmdURFj4Z4WU5e2y4yz/iy++cEzPordv316+fFmEM0+BWI4CIgQRAiIEEQIiBBECIgQRAiIEEQIiBBGCCAERgggBEYIIgYmY9sdb9Hq9ZrPp88Qout2uCNPrdDo//fSTwwjLUUCEIEJAhCBCQIQgQkCEIEJAhCBCQIQgQkCEIEJAhCBCQIQgQkCEIEJAhCBCQIQgQkCEIEJAhCBCQIQgQkCEIEJAhCBCQIQgQkCEIEJAhCBCQIQgQkCEIEJAhCBCECEgQhAhIEIQISBCECEgQhAhIEIQISBCECEgQhAhIEIQISBCECEgQhAhIEIQIZCx871ez14AEYIIARGCCAERgggBEYIIARGCCAERgggBEYIIARGCCAERgggBEYIIARGCCAERgggBEYIIARGCCAERgggBEYIIARHC7PqvAAMA/BkrMLAeft8AAAAASUVORK5CYII=";
|
|
95719
|
-
return `<img class="alan-btn__chat-response-img alan-btn__chat-response-img-el" crossorigin="anonymous" src="${newSrc}" onerror="this.src = '${imgNotFoundSrc}';"/>`;
|
|
95908
|
+
return `<img class="alan-btn__chat-response-img alan-btn__chat-response-img-el" all-images-urls="${allImagesAttr}" crossorigin="anonymous" src="${newSrc}" onerror="this.src = '${imgNotFoundSrc}';"/>`;
|
|
95720
95909
|
}
|
|
95721
95910
|
function getYoutubeFrameHtml(src) {
|
|
95722
95911
|
return `<iframe class="alan-btn__chat-response-video" width="560" height="315" src="${src}?autoplay=1&mute=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`;
|
|
@@ -95729,7 +95918,7 @@ code.hljs {
|
|
|
95729
95918
|
if (isYouTubeUrl(imageSrc)) {
|
|
95730
95919
|
imgsHtml = getYoutubeFrameHtml(imageSrc);
|
|
95731
95920
|
} else {
|
|
95732
|
-
imgsHtml = getImageHtml(imageSrc);
|
|
95921
|
+
imgsHtml = getImageHtml(imageSrc, msg.images?.map((img) => replaceImgSrcWithProxy(img.src, PROXY_IMG_DOMAIN)).join(","));
|
|
95733
95922
|
}
|
|
95734
95923
|
}
|
|
95735
95924
|
if (msg.images?.length > 0) {
|
|
@@ -96524,13 +96713,24 @@ ${LEARN_MORE_LABEL}
|
|
|
96524
96713
|
);
|
|
96525
96714
|
rightHeaderIconsHolder.appendChild(saveChatStateBtnImg);
|
|
96526
96715
|
rightHeaderIconsHolder.appendChild(expandCollapseChatBtnImg);
|
|
96527
|
-
saveChatStateBtnImg.addEventListener("click", () => {
|
|
96716
|
+
saveChatStateBtnImg.addEventListener("click", async () => {
|
|
96528
96717
|
const headContent = document.head.innerHTML;
|
|
96529
96718
|
const initChat = document.querySelector("#chatMessagesWrapper");
|
|
96530
96719
|
if (!initChat)
|
|
96531
96720
|
return;
|
|
96532
96721
|
const chatWidth2 = initChat.clientWidth;
|
|
96533
|
-
|
|
96722
|
+
if (saveChatStateBtnImg.classList.contains("saving"))
|
|
96723
|
+
return;
|
|
96724
|
+
saveChatStateBtnImg.classList.add("saving");
|
|
96725
|
+
setTimeout(() => {
|
|
96726
|
+
saveChatStateBtnImg.classList.remove("saving");
|
|
96727
|
+
}, 8e3);
|
|
96728
|
+
try {
|
|
96729
|
+
await saveChatState(title, initChat, chatWidth2, getProjectId(), headContent);
|
|
96730
|
+
saveChatStateBtnImg.classList.remove("saving");
|
|
96731
|
+
} catch (error) {
|
|
96732
|
+
saveChatStateBtnImg.classList.remove("saving");
|
|
96733
|
+
}
|
|
96534
96734
|
});
|
|
96535
96735
|
expandCollapseChatBtnImg.addEventListener("click", expandCollapseTextChat);
|
|
96536
96736
|
addNeedClassesToExpandCollapseBtn(expandCollapseChatBtnImg);
|