@alan-ai/alan-sdk-web 1.8.82 → 1.8.84
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/AlanButtonOptions.d.ts +1 -1
- package/dist/alan_lib.js +39 -11
- package/dist/alan_lib.min.js +1 -1
- package/package.json +1 -1
package/dist/alan_lib.js
CHANGED
|
@@ -90534,6 +90534,14 @@
|
|
|
90534
90534
|
};
|
|
90535
90535
|
}
|
|
90536
90536
|
|
|
90537
|
+
// alan_btn/src/helpers/mini/guid.ts
|
|
90538
|
+
function guid() {
|
|
90539
|
+
function s4() {
|
|
90540
|
+
return Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
90541
|
+
}
|
|
90542
|
+
return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
|
|
90543
|
+
}
|
|
90544
|
+
|
|
90537
90545
|
// alan_btn/src/textChat/helpers/mergeProgressiveMessages.ts
|
|
90538
90546
|
function mergeProgressiveMessages(messages, i, message) {
|
|
90539
90547
|
const maxLinksCount = 9;
|
|
@@ -90543,6 +90551,20 @@
|
|
|
90543
90551
|
messages[i].text = oldText + newText;
|
|
90544
90552
|
messages[i].images = [...messages[i].images || [], ...newImages];
|
|
90545
90553
|
messages[i].links = [...messages[i].links || [], ...message.links || []].splice(0, maxLinksCount);
|
|
90554
|
+
if (!messages[i].parts) {
|
|
90555
|
+
messages[i].parts = [];
|
|
90556
|
+
}
|
|
90557
|
+
const msgPart = getMsgPart(newText);
|
|
90558
|
+
if (msgPart.type === "iframe") {
|
|
90559
|
+
messages[i].parts.push(msgPart);
|
|
90560
|
+
} else {
|
|
90561
|
+
const lastPart = messages[i].parts.at(-1);
|
|
90562
|
+
if (lastPart && lastPart.type === "text") {
|
|
90563
|
+
lastPart.chunks.push(msgPart.chunks[0]);
|
|
90564
|
+
} else {
|
|
90565
|
+
messages[i].parts.push(msgPart);
|
|
90566
|
+
}
|
|
90567
|
+
}
|
|
90546
90568
|
if (message.ctx?.format === "markdown") {
|
|
90547
90569
|
if (messages[i].ctx) {
|
|
90548
90570
|
messages[i].ctx.format = "markdown";
|
|
@@ -90554,6 +90576,18 @@
|
|
|
90554
90576
|
messages[i].ctx.final = message.ctx?.final;
|
|
90555
90577
|
}
|
|
90556
90578
|
}
|
|
90579
|
+
function getMsgPart(text) {
|
|
90580
|
+
const iframeRegex = /<iframe[^>]*src=["']([^"']+)["'][^>]*>(.*?)<\/iframe>/gis;
|
|
90581
|
+
let match = iframeRegex.exec(text);
|
|
90582
|
+
if (match) {
|
|
90583
|
+
return { id: guid(), chunks: [text], type: "iframe", src: match[1] };
|
|
90584
|
+
}
|
|
90585
|
+
return {
|
|
90586
|
+
id: guid(),
|
|
90587
|
+
chunks: [text],
|
|
90588
|
+
type: "text"
|
|
90589
|
+
};
|
|
90590
|
+
}
|
|
90557
90591
|
|
|
90558
90592
|
// alan_btn/src/textChat/helpers/processMessageForChat.ts
|
|
90559
90593
|
var import_lodash = __toESM(require_lodash());
|
|
@@ -90778,14 +90812,6 @@
|
|
|
90778
90812
|
}
|
|
90779
90813
|
}
|
|
90780
90814
|
|
|
90781
|
-
// alan_btn/src/helpers/mini/guid.ts
|
|
90782
|
-
function guid() {
|
|
90783
|
-
function s4() {
|
|
90784
|
-
return Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
|
|
90785
|
-
}
|
|
90786
|
-
return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
|
|
90787
|
-
}
|
|
90788
|
-
|
|
90789
90815
|
// alan_btn/src/helpers/mini/isStorageAvailable.ts
|
|
90790
90816
|
var _isLocalStorageAvailable = false;
|
|
90791
90817
|
try {
|
|
@@ -95012,7 +95038,7 @@ code.hljs {
|
|
|
95012
95038
|
// alan_btn/alan_btn.ts
|
|
95013
95039
|
var import_sjcl = __toESM(require_sjcl());
|
|
95014
95040
|
(function(ns) {
|
|
95015
|
-
uiState.lib.version = "alan-version.1.8.
|
|
95041
|
+
uiState.lib.version = "alan-version.1.8.84".replace("alan-version.", "");
|
|
95016
95042
|
if (window.alanBtn) {
|
|
95017
95043
|
console.warn("Alan: the Alan Button source code has already added (v." + uiState.lib.version + ")");
|
|
95018
95044
|
}
|
|
@@ -95046,11 +95072,12 @@ code.hljs {
|
|
|
95046
95072
|
var sentMessageInd = null;
|
|
95047
95073
|
var sentMessages = [];
|
|
95048
95074
|
const LOCAL_STORAGE_KEYS = {
|
|
95075
|
+
textChatMessagesKeyPrefix: "alan-btn-text-chat-message-history",
|
|
95049
95076
|
getDialogIdKey: () => {
|
|
95050
95077
|
return `alan-btn-dialogId${getUserIdLsPrefix()}-${getProjectId()}`;
|
|
95051
95078
|
},
|
|
95052
95079
|
getTextChatMessagesKey: () => {
|
|
95053
|
-
return
|
|
95080
|
+
return `${LOCAL_STORAGE_KEYS.textChatMessagesKeyPrefix}${getUserIdLsPrefix()}-${getProjectId()}`;
|
|
95054
95081
|
},
|
|
95055
95082
|
getSentMessagesKey: () => {
|
|
95056
95083
|
return `alan-btn-text-chat-sent-message-history${getUserIdLsPrefix()}-${getProjectId()}`;
|
|
@@ -95196,6 +95223,7 @@ code.hljs {
|
|
|
95196
95223
|
},
|
|
95197
95224
|
open: () => {
|
|
95198
95225
|
showTextChat();
|
|
95226
|
+
broadcastReloadIframeToIframes();
|
|
95199
95227
|
},
|
|
95200
95228
|
close: () => {
|
|
95201
95229
|
closeTextChat();
|
|
@@ -97706,7 +97734,7 @@ ${LEARN_MORE_LABEL}
|
|
|
97706
97734
|
console.info("Alan: clear messages history", curDialogId);
|
|
97707
97735
|
for (let i2 = 0; i2 < localStorage.length; i2++) {
|
|
97708
97736
|
const key = localStorage.key(i2);
|
|
97709
|
-
if (key.indexOf(
|
|
97737
|
+
if (key.indexOf(LOCAL_STORAGE_KEYS.textChatMessagesKeyPrefix) > -1) {
|
|
97710
97738
|
localStorage.removeItem(key);
|
|
97711
97739
|
}
|
|
97712
97740
|
}
|