@alan-ai/alan-sdk-web 1.8.72 → 1.8.74
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 +152 -62
- package/dist/alan_lib.min.js +1 -1
- package/package.json +1 -1
package/dist/alan_lib.js
CHANGED
|
@@ -35706,7 +35706,7 @@
|
|
|
35706
35706
|
function replaceUnsafeChar(ch) {
|
|
35707
35707
|
return HTML_REPLACEMENTS[ch];
|
|
35708
35708
|
}
|
|
35709
|
-
function
|
|
35709
|
+
function escapeHtml(str) {
|
|
35710
35710
|
if (HTML_ESCAPE_TEST_RE.test(str)) {
|
|
35711
35711
|
return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
|
|
35712
35712
|
}
|
|
@@ -35801,7 +35801,7 @@
|
|
|
35801
35801
|
__proto__: null,
|
|
35802
35802
|
arrayReplaceAt,
|
|
35803
35803
|
assign,
|
|
35804
|
-
escapeHtml
|
|
35804
|
+
escapeHtml,
|
|
35805
35805
|
escapeRE,
|
|
35806
35806
|
fromCodePoint,
|
|
35807
35807
|
has,
|
|
@@ -35975,11 +35975,11 @@
|
|
|
35975
35975
|
var default_rules = {};
|
|
35976
35976
|
default_rules.code_inline = function(tokens, idx, options, env, slf) {
|
|
35977
35977
|
const token = tokens[idx];
|
|
35978
|
-
return "<code" + slf.renderAttrs(token) + ">" +
|
|
35978
|
+
return "<code" + slf.renderAttrs(token) + ">" + escapeHtml(token.content) + "</code>";
|
|
35979
35979
|
};
|
|
35980
35980
|
default_rules.code_block = function(tokens, idx, options, env, slf) {
|
|
35981
35981
|
const token = tokens[idx];
|
|
35982
|
-
return "<pre" + slf.renderAttrs(token) + "><code>" +
|
|
35982
|
+
return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml(tokens[idx].content) + "</code></pre>\n";
|
|
35983
35983
|
};
|
|
35984
35984
|
default_rules.fence = function(tokens, idx, options, env, slf) {
|
|
35985
35985
|
const token = tokens[idx];
|
|
@@ -35993,9 +35993,9 @@
|
|
|
35993
35993
|
}
|
|
35994
35994
|
let highlighted;
|
|
35995
35995
|
if (options.highlight) {
|
|
35996
|
-
highlighted = options.highlight(token.content, langName, langAttrs) ||
|
|
35996
|
+
highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
|
|
35997
35997
|
} else {
|
|
35998
|
-
highlighted =
|
|
35998
|
+
highlighted = escapeHtml(token.content);
|
|
35999
35999
|
}
|
|
36000
36000
|
if (highlighted.indexOf("<pre") === 0) {
|
|
36001
36001
|
return highlighted + "\n";
|
|
@@ -36030,7 +36030,7 @@
|
|
|
36030
36030
|
return options.breaks ? options.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
|
|
36031
36031
|
};
|
|
36032
36032
|
default_rules.text = function(tokens, idx) {
|
|
36033
|
-
return
|
|
36033
|
+
return escapeHtml(tokens[idx].content);
|
|
36034
36034
|
};
|
|
36035
36035
|
default_rules.html_block = function(tokens, idx) {
|
|
36036
36036
|
return tokens[idx].content;
|
|
@@ -36048,7 +36048,7 @@
|
|
|
36048
36048
|
}
|
|
36049
36049
|
result = "";
|
|
36050
36050
|
for (i = 0, l = token.attrs.length; i < l; i++) {
|
|
36051
|
-
result += " " +
|
|
36051
|
+
result += " " + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
|
|
36052
36052
|
}
|
|
36053
36053
|
return result;
|
|
36054
36054
|
};
|
|
@@ -89509,12 +89509,53 @@
|
|
|
89509
89509
|
<path d="M17.2915 17.7085L29.3026 5.69727M17.4375 18.0837L20.4438 25.8143C20.7086 26.4954 20.8411 26.8358 21.0319 26.9352C21.1973 27.0215 21.3944 27.0216 21.5598 26.9356C21.7507 26.8364 21.8836 26.4961 22.1493 25.8153L29.688 6.4971C29.9279 5.88261 30.0478 5.57536 29.9821 5.37903C29.9252 5.20853 29.7914 5.07473 29.6209 5.01777C29.4246 4.95219 29.1173 5.07209 28.5028 5.31188L9.18467 12.8507C8.50392 13.1164 8.16361 13.2492 8.06444 13.4401C7.97841 13.6056 7.97852 13.8027 8.06477 13.9681C8.16418 14.1589 8.50473 14.2913 9.18571 14.5562L16.9163 17.5625C17.0545 17.6163 17.1236 17.6432 17.1818 17.6847C17.2334 17.7214 17.2784 17.7666 17.3153 17.8182C17.3568 17.8763 17.3837 17.9455 17.4375 18.0837Z" stroke="#4A515D" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
89510
89510
|
</svg>
|
|
89511
89511
|
`,
|
|
89512
|
+
msgLoader: `<svg xmlns="http://www.w3.org/2000/svg" class="alan-text-chat__msg-loader-svg" viewBox="0 0 200 200">
|
|
89513
|
+
<radialGradient id="a12" cx=".66" fx=".66" cy=".3125" fy=".3125" gradientTransform="scale(1.5)">
|
|
89514
|
+
<stop offset="0" stop-color="currentColor"></stop>
|
|
89515
|
+
<stop offset=".3" stop-color="currentColor" stop-opacity=".9"></stop>
|
|
89516
|
+
<stop offset=".6" stop-color="currentColor" stop-opacity=".6"></stop>
|
|
89517
|
+
<stop offset=".8" stop-color="currentColor" stop-opacity=".3"></stop>
|
|
89518
|
+
<stop offset="1" stop-color="currentColor" stop-opacity="0"></stop>
|
|
89519
|
+
</radialGradient>
|
|
89520
|
+
<circle
|
|
89521
|
+
transform-origin="center"
|
|
89522
|
+
fill="none"
|
|
89523
|
+
stroke="url(#a12)"
|
|
89524
|
+
stroke-width="15"
|
|
89525
|
+
stroke-linecap="round"
|
|
89526
|
+
stroke-dasharray="200 1000"
|
|
89527
|
+
stroke-dashoffset="0"
|
|
89528
|
+
cx="100"
|
|
89529
|
+
cy="100"
|
|
89530
|
+
r="70"
|
|
89531
|
+
>
|
|
89532
|
+
<animateTransform
|
|
89533
|
+
type="rotate"
|
|
89534
|
+
attributeName="transform"
|
|
89535
|
+
calcMode="spline"
|
|
89536
|
+
dur="2"
|
|
89537
|
+
values="360;0"
|
|
89538
|
+
keyTimes="0;1"
|
|
89539
|
+
keySplines="0 0 1 1"
|
|
89540
|
+
repeatCount="indefinite"
|
|
89541
|
+
></animateTransform>
|
|
89542
|
+
</circle>
|
|
89543
|
+
<circle
|
|
89544
|
+
transform-origin="center"
|
|
89545
|
+
fill="none"
|
|
89546
|
+
opacity=".2"
|
|
89547
|
+
stroke="currentColor"
|
|
89548
|
+
stroke-width="15"
|
|
89549
|
+
stroke-linecap="round"
|
|
89550
|
+
cx="100"
|
|
89551
|
+
cy="100"
|
|
89552
|
+
r="70"
|
|
89553
|
+
></circle>
|
|
89554
|
+
</svg>`,
|
|
89512
89555
|
stopResponse: `
|
|
89513
|
-
<svg width="
|
|
89514
|
-
<
|
|
89515
|
-
<circle cx="11" cy="11" r="10" stroke="black"/>
|
|
89556
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
89557
|
+
<rect x="6" y="6" width="8" height="8" rx="1" fill="#64AED5"/>
|
|
89516
89558
|
</svg>
|
|
89517
|
-
|
|
89518
89559
|
`,
|
|
89519
89560
|
mic: `
|
|
89520
89561
|
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -89573,11 +89614,17 @@
|
|
|
89573
89614
|
<path d="M2.375 12.875C2.375 15.1141 2.375 16.2337 3.07062 16.9294C3.76624 17.625 4.88583 17.625 7.125 17.625H11.875C14.1142 17.625 15.2337 17.625 15.9294 16.9294C16.625 16.2337 16.625 15.1141 16.625 12.875" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
89574
89615
|
<path d="M9.50001 3.375V13.6667M9.50001 13.6667L12.6667 10.2031M9.50001 13.6667L6.33334 10.2031" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
89575
89616
|
</svg>
|
|
89576
|
-
|
|
89617
|
+
`,
|
|
89618
|
+
minimize: `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
89619
|
+
<path d="M3 17.25L18 17.25" stroke="none" stroke-width="1.5" stroke-linecap="round"/>
|
|
89620
|
+
</svg>`
|
|
89577
89621
|
};
|
|
89578
89622
|
function getCloseChatIcon(textChatOptions) {
|
|
89579
89623
|
return textChatOptions?.popup?.icons?.close?.svg || chatIcons.closeChat;
|
|
89580
89624
|
}
|
|
89625
|
+
function getMinimizeChatIcon(textChatOptions) {
|
|
89626
|
+
return textChatOptions?.popup?.icons?.minimize?.svg || chatIcons.minimize;
|
|
89627
|
+
}
|
|
89581
89628
|
function getExpandChatIcon(textChatOptions) {
|
|
89582
89629
|
return textChatOptions?.popup?.icons?.fullScreen?.svgExpand || chatIcons.expandChat;
|
|
89583
89630
|
}
|
|
@@ -89608,7 +89655,8 @@
|
|
|
89608
89655
|
const isQueryProgressEnabled = textChatOptions?.bubbles?.waitingResponse?.queryProgress?.enabled;
|
|
89609
89656
|
const waitingResponseBubbleLayout = textChatOptions?.bubbles?.waitingResponse?.layout || "default";
|
|
89610
89657
|
const isDefaultLayout = waitingResponseBubbleLayout === "default";
|
|
89611
|
-
|
|
89658
|
+
const hasCustomLoaderSvg = textChatOptions?.bubbles?.waitingResponse?.icon?.svg;
|
|
89659
|
+
let waitingResponseBubbleLabel = textChatOptions?.bubbles?.waitingResponse?.label || "Generating result";
|
|
89612
89660
|
if (message?.queryProgress) {
|
|
89613
89661
|
const unshownStatuses = message?.queryProgress?.filter((s) => s.isShown === false);
|
|
89614
89662
|
waitingResponseBubbleLabel = unshownStatuses?.length > 0 ? unshownStatuses[0].text : message?.queryProgress[message?.queryProgress?.length - 1].text || "";
|
|
@@ -89617,18 +89665,15 @@
|
|
|
89617
89665
|
if (onlyLoader) {
|
|
89618
89666
|
waitingResponseBubbleLabel = "";
|
|
89619
89667
|
}
|
|
89620
|
-
const content =
|
|
89621
|
-
|
|
89622
|
-
${waitingResponseBubbleLabel || ""}</span>
|
|
89623
|
-
<div class="alan-btn__chat-incomming-msg-inner-wrapper ${waitingResponseBubbleLabel === "" ? "" : "with-text"}"><div class="alan-btn__chat-incomming-msg msg-1"> </div> <div class="alan-btn__chat-incomming-msg msg-2"> </div> <div class="alan-btn__chat-incomming-msg msg-3"> </div></div>` : `<span class="alan-btn__chat-incomming-msg-loader-icon alan-btn__chat-stop-response-holder">
|
|
89624
|
-
${getMsgStopBtn(textChatOptions, false)}
|
|
89668
|
+
const content = `<span class="alan-btn__chat-incomming-msg-loader-icon alan-btn__chat-stop-response-holder">
|
|
89669
|
+
${!hasCustomLoaderSvg ? chatIcons.msgLoader : ""}${getMsgStopBtn(textChatOptions)}
|
|
89625
89670
|
</span>
|
|
89626
|
-
|
|
89671
|
+
<span class="alan-btn__chat-incomming-msg-loader-label">${waitingResponseBubbleLabel}</span>`;
|
|
89627
89672
|
return `<div class="alan-btn__chat-incomming-msg-wrapper">${content}</div>`;
|
|
89628
89673
|
}
|
|
89629
|
-
function getMsgStopBtn(textChatOptions
|
|
89630
|
-
const content = `<div class="alan-btn__stop-response-btn">${getStopChatIcon(textChatOptions)}</div>`;
|
|
89631
|
-
return
|
|
89674
|
+
function getMsgStopBtn(textChatOptions) {
|
|
89675
|
+
const content = `<div style="position:absolute;" class="alan-btn__stop-response-btn" title="Stop response generation">${getStopChatIcon(textChatOptions)}</div>`;
|
|
89676
|
+
return content;
|
|
89632
89677
|
}
|
|
89633
89678
|
function capitalize(str) {
|
|
89634
89679
|
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
@@ -91056,6 +91101,21 @@
|
|
|
91056
91101
|
fill: ${textChatOptions?.popup?.icons?.close?.hover?.fill || `#97989c`};
|
|
91057
91102
|
}`;
|
|
91058
91103
|
}
|
|
91104
|
+
keyFrames += getStyleSheetMarker() + `.alan-btn__minimize-chat-btn {
|
|
91105
|
+
height: 100%;
|
|
91106
|
+
display: ${textChatOptions?.popup?.minimizeMode?.enabled ? "flex" : `none`};
|
|
91107
|
+
align-items: center;
|
|
91108
|
+
cursor: pointer;
|
|
91109
|
+
pointer-events: all;
|
|
91110
|
+
}`;
|
|
91111
|
+
keyFrames += getStyleSheetMarker() + `.alan-btn__minimize-chat-btn svg path {
|
|
91112
|
+
stroke: ${textChatOptions?.popup?.icons?.minimize?.default?.fill || `#969EB0`};
|
|
91113
|
+
}`;
|
|
91114
|
+
if (!isMobile()) {
|
|
91115
|
+
keyFrames += getStyleSheetMarker() + `.alan-btn__minimize-chat-btn:hover svg path {
|
|
91116
|
+
stroke: ${textChatOptions?.popup?.icons?.minimize?.hover?.fill || `#0046ff`};
|
|
91117
|
+
}`;
|
|
91118
|
+
}
|
|
91059
91119
|
keyFrames += getStyleSheetMarker() + `.alan-btn__save-chat-state-btn {
|
|
91060
91120
|
height: 100%;
|
|
91061
91121
|
display: ${textChatOptions?.popup?.saveChatState?.enabled ? "flex" : `none`};
|
|
@@ -91247,6 +91307,9 @@
|
|
|
91247
91307
|
keyFrames += getStyleSheetMarker() + `.alan-btn__chat .alan-btn__chat-stop-response-holder {
|
|
91248
91308
|
cursor: pointer;
|
|
91249
91309
|
display: flex;
|
|
91310
|
+
justify-content: center;
|
|
91311
|
+
align-items: center;
|
|
91312
|
+
poisiton: relative;
|
|
91250
91313
|
}`;
|
|
91251
91314
|
keyFrames += getStyleSheetMarker() + `.alan-btn__chat .alan-btn__chat-stop-response-holder .alan-btn__stop-response-btn svg path {
|
|
91252
91315
|
stroke: ${stopResponseIconDefaultColor};
|
|
@@ -92177,6 +92240,15 @@
|
|
|
92177
92240
|
const responseBubbleBg = textChatOptions?.bubbles?.response?.backgroundColor || `#ffffff`;
|
|
92178
92241
|
const responseBubbleFontColor = textChatOptions?.bubbles?.response?.color || `#171717`;
|
|
92179
92242
|
const [responseLabelWidth, responseLabelHeight] = parseSvgSize(waitingResponseBubbleLoaderIcon);
|
|
92243
|
+
keyFrames += styleSheetMarker + `.alan-text-chat__msg-loader-svg {
|
|
92244
|
+
color: ${responseBubbleFontColor};
|
|
92245
|
+
min-width: 22px;
|
|
92246
|
+
max-width: 22px;
|
|
92247
|
+
width: 22px;
|
|
92248
|
+
min-height: 22px;
|
|
92249
|
+
max-height: 22px;
|
|
92250
|
+
height: 22px;
|
|
92251
|
+
}`;
|
|
92180
92252
|
keyFrames += styleSheetMarker + `.alan-btn__chat-incomming-msg-wrapper {
|
|
92181
92253
|
display: flex;
|
|
92182
92254
|
max-width: 100%;
|
|
@@ -92349,21 +92421,25 @@
|
|
|
92349
92421
|
// alan_btn/src/textChat/alanMarkdown.ts
|
|
92350
92422
|
var iterator = require_index_cjs();
|
|
92351
92423
|
var markdownItScrollTable = require_markdown_it_scrolltable();
|
|
92352
|
-
var
|
|
92353
|
-
"<
|
|
92354
|
-
"
|
|
92355
|
-
"<
|
|
92356
|
-
"
|
|
92357
|
-
"<thinking>": '<span class="alan-special-markdown-tag-hl-green"><thinking></span>',
|
|
92358
|
-
"</thinking>": '<span class="alan-special-markdown-tag-hl-green"></thinking></span>',
|
|
92359
|
-
"<reasoning>": '<span class="alan-special-markdown-tag-hl-green"><reasoning></span>',
|
|
92360
|
-
"</reasoning>": '<span class="alan-special-markdown-tag-hl-green"></reasoning></span>'
|
|
92424
|
+
var ESCAPE_CUSTOM_TAG_MAP = {
|
|
92425
|
+
"<thinking>": '<div class="alan-special-markdown-tag-wrapper"><span class="alan-special-markdown-tag-hl-green"><thinking></span>',
|
|
92426
|
+
"</thinking>": '<span class="alan-special-markdown-tag-hl-green"></thinking></span></div>',
|
|
92427
|
+
"<reasoning>": '<div class="alan-special-markdown-tag-wrapper"><span class="alan-special-markdown-tag-hl-green"><reasoning></span>',
|
|
92428
|
+
"</reasoning>": '<span class="alan-special-markdown-tag-hl-green"></reasoning></span></div>'
|
|
92361
92429
|
};
|
|
92362
92430
|
function alanMarkdown(str = "") {
|
|
92363
92431
|
var md = require_index_cjs5()({ html: true }).use(require_index_cjs6()).use(markdownItScrollTable).use(iterator, "url_new_win", "link_open", function(tokens, idx) {
|
|
92364
92432
|
tokens[idx].attrSet("target", "_blank");
|
|
92365
92433
|
});
|
|
92366
|
-
return sanitize(md.render(str || ""));
|
|
92434
|
+
return sanitize(md.render(sanitizeCustomTags(str || "")));
|
|
92435
|
+
}
|
|
92436
|
+
function sanitizeCustomTags(str) {
|
|
92437
|
+
let result = str;
|
|
92438
|
+
for (const [tag, replacement] of Object.entries(ESCAPE_CUSTOM_TAG_MAP)) {
|
|
92439
|
+
const tagRegex = new RegExp(tag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g");
|
|
92440
|
+
result = result.replace(tagRegex, replacement);
|
|
92441
|
+
}
|
|
92442
|
+
return result;
|
|
92367
92443
|
}
|
|
92368
92444
|
function sanitize(str) {
|
|
92369
92445
|
let tag = "";
|
|
@@ -92378,16 +92454,6 @@
|
|
|
92378
92454
|
break;
|
|
92379
92455
|
}
|
|
92380
92456
|
}
|
|
92381
|
-
for (const escapedTag in ESCAPE_TAG_MAP) {
|
|
92382
|
-
if (tag.startsWith(escapedTag)) {
|
|
92383
|
-
result += escapeHtml(tag);
|
|
92384
|
-
tag = "";
|
|
92385
|
-
if (str[i + 1] === "\n" && str[i + 2] === "<") {
|
|
92386
|
-
result += "<br/>";
|
|
92387
|
-
}
|
|
92388
|
-
break;
|
|
92389
|
-
}
|
|
92390
|
-
}
|
|
92391
92457
|
if (tag !== "") {
|
|
92392
92458
|
result += tag;
|
|
92393
92459
|
tag = "";
|
|
@@ -92398,14 +92464,6 @@
|
|
|
92398
92464
|
}
|
|
92399
92465
|
return result;
|
|
92400
92466
|
}
|
|
92401
|
-
function escapeHtml(text) {
|
|
92402
|
-
let resultStr = text;
|
|
92403
|
-
for (const key in ESCAPE_TAG_MAP) {
|
|
92404
|
-
var r = new RegExp(`${key}`, "gi");
|
|
92405
|
-
resultStr = String(resultStr).replace(r, ESCAPE_TAG_MAP[key]);
|
|
92406
|
-
}
|
|
92407
|
-
return resultStr;
|
|
92408
|
-
}
|
|
92409
92467
|
|
|
92410
92468
|
// alan_btn/src/textChat/helpers/getLinkIcon.ts
|
|
92411
92469
|
function getLinkIcon(link) {
|
|
@@ -92596,10 +92654,6 @@
|
|
|
92596
92654
|
}`,
|
|
92597
92655
|
`* + pre {
|
|
92598
92656
|
margin-top: 8px!important;
|
|
92599
|
-
}`,
|
|
92600
|
-
`pre + * {
|
|
92601
|
-
margin-top: 16px!important;
|
|
92602
|
-
font-size: ${responseBubbleFontSize}px!important;
|
|
92603
92657
|
}`,
|
|
92604
92658
|
`* + ul {
|
|
92605
92659
|
margin-top: 8px!important;
|
|
@@ -93924,9 +93978,14 @@ code.hljs {
|
|
|
93924
93978
|
;
|
|
93925
93979
|
}
|
|
93926
93980
|
|
|
93981
|
+
// alan_btn/src/textChat/helpers/shouldTextBeSavedInChatHistory.ts
|
|
93982
|
+
function shouldTextBeSavedInChatHistory(text, sentMessages) {
|
|
93983
|
+
return sentMessages?.at(-1) !== text;
|
|
93984
|
+
}
|
|
93985
|
+
|
|
93927
93986
|
// alan_btn/alan_btn.ts
|
|
93928
93987
|
(function(ns) {
|
|
93929
|
-
uiState.lib.version = "alan-version.1.8.
|
|
93988
|
+
uiState.lib.version = "alan-version.1.8.74".replace("alan-version.", "");
|
|
93930
93989
|
if (window.alanBtn) {
|
|
93931
93990
|
console.warn("Alan: the Alan Button source code has already added (v." + uiState.lib.version + ")");
|
|
93932
93991
|
}
|
|
@@ -93952,6 +94011,7 @@ code.hljs {
|
|
|
93952
94011
|
var dragAndDropEnabled = true;
|
|
93953
94012
|
var curDialogId = null;
|
|
93954
94013
|
var textChatIsHidden = true;
|
|
94014
|
+
var textChatWasClosedManually = false;
|
|
93955
94015
|
var voiceEnabledInTextChat = true;
|
|
93956
94016
|
var textChatMessages = [];
|
|
93957
94017
|
var canceledRequests = [];
|
|
@@ -95463,7 +95523,9 @@ code.hljs {
|
|
|
95463
95523
|
}
|
|
95464
95524
|
initTextChat();
|
|
95465
95525
|
if (isInlinedMode() || data.web.chatOptions?.textChat?.popup?.openByDefualt === true || isTextChatSavedStateOpened()) {
|
|
95466
|
-
|
|
95526
|
+
if (!textChatWasClosedManually) {
|
|
95527
|
+
showTextChat(true);
|
|
95528
|
+
}
|
|
95467
95529
|
}
|
|
95468
95530
|
} else {
|
|
95469
95531
|
uiState.textChat.available = false;
|
|
@@ -95826,7 +95888,7 @@ code.hljs {
|
|
|
95826
95888
|
logosToHide[i2].style.opacity = 0;
|
|
95827
95889
|
}
|
|
95828
95890
|
}
|
|
95829
|
-
function
|
|
95891
|
+
function escapeHtml(text) {
|
|
95830
95892
|
let resultStr = text;
|
|
95831
95893
|
var entityMap = {
|
|
95832
95894
|
"<script>": "<script>",
|
|
@@ -96092,7 +96154,7 @@ code.hljs {
|
|
|
96092
96154
|
if (msg.ctx?.format === "markdown") {
|
|
96093
96155
|
result = alanMarkdown(msg.text || "");
|
|
96094
96156
|
} else {
|
|
96095
|
-
result =
|
|
96157
|
+
result = escapeHtml(msg.text);
|
|
96096
96158
|
}
|
|
96097
96159
|
return result ? `<span class="alan-btn__chat-response-text-wrapper">${fixTargetForLinks(result)}</span>` : "";
|
|
96098
96160
|
}
|
|
@@ -96202,7 +96264,7 @@ ${LEARN_MORE_LABEL}
|
|
|
96202
96264
|
} else {
|
|
96203
96265
|
if (msg.name === "text" || msg.name === "parsed" || msg.name === "recognized") {
|
|
96204
96266
|
if (msg.type === "request") {
|
|
96205
|
-
innerMsgPart =
|
|
96267
|
+
innerMsgPart = escapeHtml(msg.text);
|
|
96206
96268
|
} else {
|
|
96207
96269
|
innerMsgPart = buildMsgContent(msg);
|
|
96208
96270
|
}
|
|
@@ -96401,6 +96463,9 @@ ${LEARN_MORE_LABEL}
|
|
|
96401
96463
|
}
|
|
96402
96464
|
}
|
|
96403
96465
|
function onClearTextChatBtnClick() {
|
|
96466
|
+
if (options.onEvent) {
|
|
96467
|
+
options.onEvent({ name: "textChatCleared" });
|
|
96468
|
+
}
|
|
96404
96469
|
clearDialogId();
|
|
96405
96470
|
if (window.tutorProject) {
|
|
96406
96471
|
window.tutorProject.close();
|
|
@@ -96420,7 +96485,6 @@ ${LEARN_MORE_LABEL}
|
|
|
96420
96485
|
manageSaveChatHistoryBtn();
|
|
96421
96486
|
}
|
|
96422
96487
|
function onNewDialogAutoReconnect() {
|
|
96423
|
-
console.info("onNewDialogAutoReconnect");
|
|
96424
96488
|
if (textChatMessages?.length === 0)
|
|
96425
96489
|
return;
|
|
96426
96490
|
if (textChatMessages?.at(-1)?.type === "connection-separator")
|
|
@@ -96663,7 +96727,7 @@ ${LEARN_MORE_LABEL}
|
|
|
96663
96727
|
if (isLocalStorageAvailable) {
|
|
96664
96728
|
const maxSavedForHistoryMsgCount = 25;
|
|
96665
96729
|
const key = getRestoreMsgsLsKey();
|
|
96666
|
-
if (
|
|
96730
|
+
if (!shouldTextBeSavedInChatHistory(text, sentMessages))
|
|
96667
96731
|
return;
|
|
96668
96732
|
sentMessages.push(text);
|
|
96669
96733
|
if (sentMessages.length > 50) {
|
|
@@ -96851,6 +96915,7 @@ ${LEARN_MORE_LABEL}
|
|
|
96851
96915
|
var rightHeaderIconsHolder = document.getElementById("chat-header-right-icons");
|
|
96852
96916
|
var leftHeaderIconsHolder = document.getElementById("chat-header-left-icons");
|
|
96853
96917
|
var closeChatBtnImg = document.getElementById("alan-btn-chat-close-btn");
|
|
96918
|
+
var minimizeChatBtnImg = document.getElementById("alan-btn-chat-minimize-btn");
|
|
96854
96919
|
var expandCollapseChatBtnImg = document.getElementById("alan-btn-expand-collapse-chat-btn");
|
|
96855
96920
|
var saveChatStateBtnImg = document.getElementById("alan-btn-save-chat-state-btn");
|
|
96856
96921
|
const title = uiState.textChat.options?.header?.label || "Alan AI Assistant";
|
|
@@ -96922,6 +96987,11 @@ ${LEARN_MORE_LABEL}
|
|
|
96922
96987
|
addNeedClassesToExpandCollapseBtn(expandCollapseChatBtnImg);
|
|
96923
96988
|
}
|
|
96924
96989
|
if (!isInlinedMode()) {
|
|
96990
|
+
if (uiState.textChat.options?.popup?.minimizeMode?.enabled === true) {
|
|
96991
|
+
minimizeChatBtnImg = createDivWithSvg(getMinimizeChatIcon(uiState.textChat.options), { class: "alan-btn__minimize-chat-btn", id: "alan-btn-chat-minimize-btn" });
|
|
96992
|
+
rightHeaderIconsHolder.appendChild(minimizeChatBtnImg);
|
|
96993
|
+
minimizeChatBtnImg.addEventListener("click", minimizeTextChat);
|
|
96994
|
+
}
|
|
96925
96995
|
closeChatBtnImg = createDivWithSvg(getCloseChatIcon(uiState.textChat.options), { class: "alan-btn__close-chat-btn", id: "alan-btn-chat-close-btn" });
|
|
96926
96996
|
rightHeaderIconsHolder.appendChild(closeChatBtnImg);
|
|
96927
96997
|
closeChatBtnImg.addEventListener("click", closeTextChat);
|
|
@@ -96969,6 +97039,9 @@ ${LEARN_MORE_LABEL}
|
|
|
96969
97039
|
const icon = uiState.textChat.options?.header?.icon?.svg;
|
|
96970
97040
|
headerTille.innerHTML = `${icon ? `<span class="alan-btn__chat-header-title-icon">${icon}</span>` : ""}<span class="alan-btn__chat-header-title-label" title="${title}">${title}</span>`;
|
|
96971
97041
|
}
|
|
97042
|
+
if (minimizeChatBtnImg) {
|
|
97043
|
+
minimizeChatBtnImg.innerHTML = getMinimizeChatIcon(uiState.textChat.options);
|
|
97044
|
+
}
|
|
96972
97045
|
if (closeChatBtnImg) {
|
|
96973
97046
|
closeChatBtnImg.innerHTML = getCloseChatIcon(uiState.textChat.options);
|
|
96974
97047
|
}
|
|
@@ -97055,6 +97128,10 @@ ${LEARN_MORE_LABEL}
|
|
|
97055
97128
|
}
|
|
97056
97129
|
}
|
|
97057
97130
|
function showTextChat(noAnimation) {
|
|
97131
|
+
textChatWasClosedManually = false;
|
|
97132
|
+
if (options.onEvent) {
|
|
97133
|
+
options.onEvent({ name: "textChatOpened" });
|
|
97134
|
+
}
|
|
97058
97135
|
fixPopupScrollOnMobileForTextChat(true);
|
|
97059
97136
|
hideChatNotifications();
|
|
97060
97137
|
hidePopup();
|
|
@@ -97100,6 +97177,19 @@ ${LEARN_MORE_LABEL}
|
|
|
97100
97177
|
return false;
|
|
97101
97178
|
}
|
|
97102
97179
|
function closeTextChat() {
|
|
97180
|
+
textChatWasClosedManually = true;
|
|
97181
|
+
if (options.onEvent) {
|
|
97182
|
+
options.onEvent({ name: "textChatClosed" });
|
|
97183
|
+
}
|
|
97184
|
+
hideTextChat();
|
|
97185
|
+
if (uiState.textChat.options?.popup?.clearChatOnClose === true) {
|
|
97186
|
+
onClearTextChatBtnClick();
|
|
97187
|
+
}
|
|
97188
|
+
}
|
|
97189
|
+
function minimizeTextChat() {
|
|
97190
|
+
if (options.onEvent) {
|
|
97191
|
+
options.onEvent({ name: "textChatMinimized" });
|
|
97192
|
+
}
|
|
97103
97193
|
hideTextChat();
|
|
97104
97194
|
}
|
|
97105
97195
|
function expandCollapseChatSidePanel() {
|