ai12z 3.5.0 → 3.5.1
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/cjs/ai12z-chat_2.cjs.entry.js +35 -9
- package/dist/cjs/ai12z-chat_2.cjs.entry.js.map +1 -1
- package/dist/collection/components/input/Input.js +35 -9
- package/dist/collection/components/input/Input.js.map +1 -1
- package/dist/esm/ai12z-chat_2.entry.js +35 -9
- package/dist/esm/ai12z-chat_2.entry.js.map +1 -1
- package/dist/library/library.esm.js +1 -1
- package/dist/library/{p-20010c17.entry.js → p-c509c5a1.entry.js} +2 -2
- package/dist/library/p-c509c5a1.entry.js.map +1 -0
- package/dist/types/components/input/Input.d.ts +1 -0
- package/package.json +2 -2
- package/dist/library/p-20010c17.entry.js.map +0 -1
|
@@ -1148,6 +1148,32 @@ const InputForm = class {
|
|
|
1148
1148
|
e.stopPropagation();
|
|
1149
1149
|
this.isOpen = !this.isOpen;
|
|
1150
1150
|
};
|
|
1151
|
+
// Replace your existing handlePaste method with this enhanced version
|
|
1152
|
+
this.handlePaste = (event) => {
|
|
1153
|
+
var _a;
|
|
1154
|
+
event.preventDefault(); // Prevent default paste behavior
|
|
1155
|
+
// console.log("Text pasted into textarea")
|
|
1156
|
+
const pastedText = ((_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) || "";
|
|
1157
|
+
if (this.searchInputElem && pastedText) {
|
|
1158
|
+
const textarea = this.searchInputElem;
|
|
1159
|
+
const startPos = textarea.selectionStart;
|
|
1160
|
+
const endPos = textarea.selectionEnd;
|
|
1161
|
+
const currentValue = textarea.value;
|
|
1162
|
+
// Replace selected text or insert at cursor position
|
|
1163
|
+
const newValue = currentValue.substring(0, startPos) +
|
|
1164
|
+
pastedText +
|
|
1165
|
+
currentValue.substring(endPos);
|
|
1166
|
+
// Update the textarea value
|
|
1167
|
+
textarea.value = newValue;
|
|
1168
|
+
// Set cursor position after pasted text
|
|
1169
|
+
const newCursorPos = startPos + pastedText.length;
|
|
1170
|
+
textarea.setSelectionRange(newCursorPos, newCursorPos);
|
|
1171
|
+
// Adjust height after paste
|
|
1172
|
+
setTimeout(() => {
|
|
1173
|
+
this.adjustHeight();
|
|
1174
|
+
}, 0);
|
|
1175
|
+
}
|
|
1176
|
+
};
|
|
1151
1177
|
this.imagesBase64List = [];
|
|
1152
1178
|
this.isChat = undefined;
|
|
1153
1179
|
this.placeholder = undefined;
|
|
@@ -1251,22 +1277,22 @@ const InputForm = class {
|
|
|
1251
1277
|
// this.icon_width = url.searchParams.get("w") || "28"
|
|
1252
1278
|
// this.icon_height = url.searchParams.get("h") || "28"
|
|
1253
1279
|
// }
|
|
1254
|
-
return (index.h("div", { key: '
|
|
1255
|
-
${this.isOpen ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-90 pointer-events-none"}`, ref: el => (this.menuElem = el) }, index.h("ul", { key: '
|
|
1280
|
+
return (index.h("div", { key: '98ceba078e1a635c3242c7f38dc49ed4e75cf05e' }, index.h("div", { key: 'dc23463ab680d7b2da7dec3d7aa70738555785cc', class: `absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10
|
|
1281
|
+
${this.isOpen ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-90 pointer-events-none"}`, ref: el => (this.menuElem = el) }, index.h("ul", { key: 'bbc1e6dbe31fd44c0986833b08a90bbd53d797ef', class: "space-y-2" }, this.isImageUpload && (index.h("li", { key: '743edd563581aaa5d6169bad3a1b5822eb4aae92', class: "px-4 py-2 hover:bg-gray-100 cursor-pointer flex" }, index.h("image-uploader", { key: '0651ffeacd3cf433a930edab06a16278a857fa6c', maxImages: 10, images: this.imagesBase64List, targetElement: this.searchInputElem, onImagesChange: this.handleImageChange, onError: this.handleImageError, ref: el => (this.imageUploaderRef = el) }))), index.h("li", { key: '0cbc9de59820f59aa33d82f4534a16971fc81043', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", onClick: e => {
|
|
1256
1282
|
this.captureScreen();
|
|
1257
1283
|
this.toggleBox(e);
|
|
1258
|
-
} }, index.h("div", { key: '
|
|
1284
|
+
} }, index.h("div", { key: '6bbc6ad7eec9f1c015ff493061222b3b464a645b', class: "mr-1 mt-px" }, index.h("svg", { key: '14ef8708ebbfd306fb843e86f481fdecfb757147', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20" }, index.h("path", { key: '73d8a8329aadaa0da2ce23ddea622c4acac985df', d: "M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z" }), index.h("path", { key: 'e4c84a59f20e027fc831a199a16d562b63a3bd4e', "fill-rule": "evenodd", d: "M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z", "clip-rule": "evenodd" }))), index.h("div", { key: '320ad8cd49a32874b3ef50f494e9a5272a29b064' }, "Capture")), index.h("li", { key: '4e1b113e44b0b004a3ffe9b032e6be876f922951', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", onClick: e => {
|
|
1259
1285
|
// const escapeEvent = new KeyboardEvent("keydown", { key: "Escape" })
|
|
1260
1286
|
// document.dispatchEvent(escapeEvent)
|
|
1261
1287
|
this.handleFollowUp(e);
|
|
1262
1288
|
this.toggleBox(e);
|
|
1263
|
-
} }, index.h("div", { key: '
|
|
1289
|
+
} }, index.h("div", { key: 'fe0189b139ff8a2782da5b1814cfa790b29c9e2a', class: "mr-1 mt-px" }, index.h("svg", { key: '48e02832257da2610477f2e74105c6da6ea69444', fill: "#000000", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 52 52", "enable-background": "new 0 0 52 52", width: "20", height: "20" }, index.h("g", { key: 'fbb414d80cced2da2fa6fea67a93f59faf478cd5', id: "SVGRepo_bgCarrier", "stroke-width": "0" }), index.h("g", { key: 'fc612eb12ceec9ed4e1039040f64498f91e831fc', id: "SVGRepo_tracerCarrier", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("g", { key: 'c03e8e490cf140547273a864b463c2f3d683a525', id: "SVGRepo_iconCarrier" }, " ", index.h("g", { key: 'ad1fa403ad1fe08e1c4d05e8b6dcbbafc2d8d71e' }, " ", index.h("path", { key: '0b917d512d2eae96d169520d0f6503f395bceef0', d: "M24.6,40.6c0-8.8,7.2-16,16-16c1.5,0,2.9,0.2,4.2,0.6c0.2-1.1,0.3-2.1,0.3-3.2c-0.1-11-9.7-19.8-21.5-19.8 c-11.9,0-21.4,8.8-21.4,19.6c0,3.4,1,6.6,2.6,9.5c0.3,0.4,0.4,1,0.2,1.5l-2.8,7.6c-0.3,0.7,0.4,1.3,1.2,1.2l7.7-3 c0.4-0.2,1-0.1,1.5,0.2c3.2,1.8,7.1,2.9,11.2,2.9c0.3,0,0.5,0,0.8,0C24.6,41.3,24.6,40.9,24.6,40.6z M34.4,18.3 c2,0,3.6,1.6,3.6,3.6s-1.6,3.6-3.6,3.6s-3.6-1.6-3.6-3.6S32.4,18.3,34.4,18.3z M12.9,25.4c-2,0-3.6-1.6-3.6-3.6s1.6-3.6,3.6-3.6 c2,0,3.6,1.6,3.6,3.6S14.8,25.4,12.9,25.4z M23.6,25.4c-2,0-3.6-1.6-3.6-3.6s1.6-3.6,3.6-3.6c2,0,3.6,1.6,3.6,3.6 S25.6,25.4,23.6,25.4z" }), " "), " ", index.h("path", { key: '7624ce456bc477f060594057f28373b56d9fd894', d: "M31.7,34.6l6,6l-6,6c-0.6,0.6-0.6,1.6,0,2.1l0.7,0.7c0.6,0.6,1.6,0.6,2.1,0l6-6l6,6c0.6,0.6,1.6,0.6,2.1,0 l0.7-0.7c0.6-0.6,0.6-1.6,0-2.1l-6-6l6-6c0.6-0.6,0.6-1.6,0-2.1l-0.7-0.7c-0.6-0.6-1.6-0.6-2.1,0l-6,6l-6-6c-0.6-0.6-1.6-0.6-2.1,0 l-0.7,0.7C31.2,33,31.2,34,31.7,34.6z" }), " "))), index.h("div", { key: 'ab8ece4201609b671cee8e3e0e95e533b25d8480' }, "Clear Conversation")))), index.h("form", { key: 'd3627bebd0d8b8ef8964ab3b54ecdc7218378d36', class: "w-full flex flex-col gap-1.5 sticky", onSubmit: this.handleFormSubmit }, index.h("div", { key: 'c389a51bd4679d5bc5b3448554d57544856a053e', class: `flex-1 flex flex-col relative w-full rounded-3xl px-1 ${this.componentType === "inline" ? "inline-searchbar-bgcolor" : "searchbar-bgcolor"}`, dir: "LTR", ref: el => (this.searchFormElem = el) }, index.h("div", { key: '3cacad0dfcc8f649b70a8c81ae9d2a849c51609e', class: "flex items-center" }, index.h("div", { key: '921296c00b6cf77fbdbd4fa5ef018ebf8b76e4c1', class: "ml-1 self-center flex space-x-1" }, !this.hideAllButtons && (index.h("div", { key: 'e3b5a0c0b9fe0c8734374940efe10256073e778e', class: "relative inline-block", style: { width: "5%" } }, index.h("button", { key: 'f678f88e2063c8e4e69a49ddc396e5f7c91c9b57', class: "plus-icon", onClick: e => {
|
|
1264
1290
|
e.stopPropagation();
|
|
1265
1291
|
this.toggleBox(e);
|
|
1266
|
-
} }, index.h("svg", { key: '
|
|
1292
|
+
} }, index.h("svg", { key: '8240e1da04ba422384d77c4afe68e06d95adacc2', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", width: "20", height: "20" }, index.h("path", { key: '62c3d019b151db1420f30dab1229170bc5b8ee29', d: "M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" })))))), !this.hideAllButtons && (index.h("div", { key: 'deb4457075c2ec7c8d4dc67f04c9bf97d322968f', class: "scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto" }, index.h("div", { key: '3ed781332e08ba4ded2f9a2fe1f0204b70e61156', class: "relative w-full min-w-full h-full min-h-fit flex items-center input-prose" }, index.h("div", { key: '4ca76e48a600229064aa7793b004841117595b0b', id: "previewContainer", draggable: true }), index.h("textarea", { key: '75aaeb94978cd8dcc047252cda25eba3c1bcc9b9', readOnly: this.submitted, id: "searchInput", ref: el => {
|
|
1267
1293
|
this.searchInputElem = el;
|
|
1268
1294
|
el === null || el === void 0 ? void 0 : el.focus();
|
|
1269
|
-
}, placeholder: this.placeholder, autoComplete: "off", class: "w-full p-1 custom-input", value: this.searchInput, rows: 1, onInput: utils.debounce(e => this.handleInputChange(e), 500), onKeyUp: this.adjustHeight, onKeyDown: this.handleKeyDown, onFocus: () => this.searchFormElem.classList.add("input-focus-color"), onBlur: () => this.searchFormElem.classList.remove("input-focus-color") })))), index.h("div", { key: '
|
|
1295
|
+
}, placeholder: this.placeholder, autoComplete: "off", class: "w-full p-1 custom-input", value: this.searchInput, rows: 1, onInput: utils.debounce(e => this.handleInputChange(e), 500), onKeyUp: this.adjustHeight, onKeyDown: this.handleKeyDown, onFocus: () => this.searchFormElem.classList.add("input-focus-color"), onBlur: () => this.searchFormElem.classList.remove("input-focus-color"), onPaste: e => { this.handlePaste(e); } })))), index.h("div", { key: '81d73db7ea697795743837c2e259c4b87c0aaa1c', class: "p-1 self-end flex space-x-1 flex-row", style: { width: this.hideAllButtons ? "100%" : "auto" } }, index.h("div", { key: 'c1a54a965e4f75bac9c4674a83f4db793573304a', "aria-label": "Record voice", class: "flex self-center", style: { width: this.hideAllButtons ? "100%" : "auto" } }, this.isEnableMic && (index.h("audio-recorder", { key: 'bf986c308eb3f99901bc198e23cb4632feab4394', "component-type": "search", onStartRecord: _ev => {
|
|
1270
1296
|
// console.log("test", ev)
|
|
1271
1297
|
this.hideAllButtons = true;
|
|
1272
1298
|
}, onStopRecord: _ev => {
|
|
@@ -1284,14 +1310,14 @@ const InputForm = class {
|
|
|
1284
1310
|
});
|
|
1285
1311
|
}
|
|
1286
1312
|
}, 1000);
|
|
1287
|
-
}, style: { width: "100%" } }))), " ", !this.hideAllButtons && (index.h("div", { key: '
|
|
1313
|
+
}, style: { width: "100%" } }))), " ", !this.hideAllButtons && (index.h("div", { key: '7f864ec33058a60c47cc8d9c132c4aee4ede1c68', class: "flex items-center" }, index.h("div", { key: '67f4c30e8e0aeab2f5f555e367150dc43516e45f', "aria-label": "Send message", class: "flex" }, index.h("button", { key: '706383bb681967e6e36f4e669a5ba1aa13d2889f', id: "send-message-button", class: "btn-bg-color text-white transition rounded-full p-1.5 self-center",
|
|
1288
1314
|
// type="submit"
|
|
1289
|
-
disabled: this.submitted, onClick: this.handleAskAI }, index.h("svg", { key: '
|
|
1315
|
+
disabled: this.submitted, onClick: this.handleAskAI }, index.h("svg", { key: '301b258a006150f3fecca0d0d5616ac6fd0f3504', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", class: "size-6" }, index.h("path", { key: 'a9399c0d73562502318618f49eb7b55ef9986ebd', "fill-rule": "evenodd", d: "M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z", "clip-rule": "evenodd" })))))))), this.imagesBase64List.length > 0 && (index.h("div", { key: '75a1b0f24484c7deed9d53f4bf122c1495048a2c', class: "flex flex-wrap gap-2 mx-1 mt-2.5 mb-1" }, this.imagesBase64List.map((img, idx) => (index.h("div", { class: "image-Container sc-ai12z-input-form", key: idx }, index.h("img", { src: img, style: { width: "70px", height: "50px", borderRadius: ".75rem" } }), index.h("span", { class: "delete-image sc-ai12z-input-form cursor-pointer ml-1", onClick: () => {
|
|
1290
1316
|
this.imagesBase64List = this.imagesBase64List.filter((_, i) => i !== idx);
|
|
1291
1317
|
if (this.imageUploaderRef && typeof this.imageUploaderRef.removeImageAtIndex === "function") {
|
|
1292
1318
|
this.imageUploaderRef.removeImageAtIndex(idx);
|
|
1293
1319
|
}
|
|
1294
|
-
} }, "\u00D7"))))))), index.h("div", { key: '
|
|
1320
|
+
} }, "\u00D7"))))))), index.h("div", { key: '0a25ca34ce6bac67ba83c9963b471332c8494552', class: "flex" }, this.showErrorMessage && index.h("p", { key: 'ce0e394f201473acc57a22358cbb8bc25ef73476', class: "error-msg", innerHTML: this.errorMessage })))));
|
|
1295
1321
|
}
|
|
1296
1322
|
get el() { return index.getElement(this); }
|
|
1297
1323
|
};
|