@crestapps/ai-chat-ui 2.0.0-preview.259 → 2.0.0-preview.260
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/ai-chat.js +6 -3
- package/dist/ai-chat.js.map +1 -1
- package/dist/ai-chat.min.js +3 -3
- package/dist/ai-chat.min.js.map +1 -1
- package/dist/chat-interaction.js +6 -3
- package/dist/chat-interaction.js.map +1 -1
- package/dist/chat-interaction.min.js +4 -4
- package/dist/chat-interaction.min.js.map +1 -1
- package/dist/chat-markers.js +166 -0
- package/dist/chat-markers.js.map +1 -1
- package/dist/chat-markers.min.js +1 -1
- package/dist/chat-markers.min.js.map +1 -1
- package/package.json +1 -1
package/dist/chat-interaction.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
var defaultConfig = {
|
|
9
9
|
generatedImageAltText: "Generated Image",
|
|
10
10
|
generatedImageMaxWidth: 400,
|
|
11
|
+
allowedImageHosts: [],
|
|
11
12
|
downloadImageTitle: "Download image",
|
|
12
13
|
downloadChartTitle: "Download chart as image",
|
|
13
14
|
downloadChartButtonText: "Download",
|
|
@@ -261,6 +262,7 @@
|
|
|
261
262
|
renderer.image = function(data) {
|
|
262
263
|
const src = sanitizeUrl(data.href);
|
|
263
264
|
if (!src) return "";
|
|
265
|
+
if (!window.CoreAIImages.isAllowedSource(src, { allowedHosts: defaultConfig.allowedImageHosts })) return window.CoreAIImages.linkHtml(src, data.text);
|
|
264
266
|
const alt = data.text || defaultConfig.generatedImageAltText;
|
|
265
267
|
return `<span class="generated-image-container">
|
|
266
268
|
<img src="${src}" alt="${alt}" class="img-thumbnail" style="max-width: ${defaultConfig.generatedImageMaxWidth}px; height: auto;" />
|
|
@@ -372,10 +374,10 @@
|
|
|
372
374
|
_pendingCharts = [];
|
|
373
375
|
const html = styleMarkdownTables(marked.parse(content, { renderer }));
|
|
374
376
|
message._pendingCharts = _pendingCharts.length > 0 ? [..._pendingCharts] : [];
|
|
375
|
-
const sanitizedHtml =
|
|
377
|
+
const sanitizedHtml = window.CoreAIImages.sanitize(DOMPurify, html, {
|
|
376
378
|
ADD_TAGS: ["canvas"],
|
|
377
379
|
ADD_ATTR: ["target"]
|
|
378
|
-
});
|
|
380
|
+
}, { allowedHosts: defaultConfig.allowedImageHosts });
|
|
379
381
|
return window.CoreAIChatImageCarousel ? window.CoreAIChatImageCarousel.stackAdjacentImages(sanitizedHtml) : sanitizedHtml;
|
|
380
382
|
}
|
|
381
383
|
function compactObject(source) {
|
|
@@ -2087,6 +2089,7 @@
|
|
|
2087
2089
|
formData.append("files", file);
|
|
2088
2090
|
const xhr = new XMLHttpRequest();
|
|
2089
2091
|
xhr.open("POST", config.uploadDocumentUrl, true);
|
|
2092
|
+
window.CoreAIAntiforgery.apply(xhr, config, config.uploadDocumentUrl);
|
|
2090
2093
|
xhr.upload.addEventListener("progress", (event) => {
|
|
2091
2094
|
if (!event.lengthComputable) return;
|
|
2092
2095
|
updateUploadItem(itemIdToUpdate, {
|
|
@@ -2227,7 +2230,7 @@
|
|
|
2227
2230
|
try {
|
|
2228
2231
|
const response = await fetch(config.removeDocumentUrl, {
|
|
2229
2232
|
method: "POST",
|
|
2230
|
-
headers: { "Content-Type": "application/json" },
|
|
2233
|
+
headers: window.CoreAIAntiforgery.headers(config, { "Content-Type": "application/json" }, config.removeDocumentUrl),
|
|
2231
2234
|
body: JSON.stringify({
|
|
2232
2235
|
itemId: config.itemId,
|
|
2233
2236
|
documentId
|