@kodaris/krubble-app-components 1.0.91 → 1.0.93
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/chatbot.d.ts +7 -0
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +29 -9
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +29 -9
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +2 -2
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +29 -9
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +4 -4
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/krubble-app.umd.js
CHANGED
|
@@ -6706,10 +6706,13 @@
|
|
|
6706
6706
|
}
|
|
6707
6707
|
/** Open the shared full-screen previewer for a message image. */
|
|
6708
6708
|
_openImage(img) {
|
|
6709
|
-
//
|
|
6710
|
-
//
|
|
6709
|
+
// Use the local preview if the upload hasn't finished yet; otherwise the
|
|
6710
|
+
// backend view URL (prefixed with the base URL — a raw fetch of a relative
|
|
6711
|
+
// path would hit the page origin, e.g. the dev server, not the backend).
|
|
6712
|
+
const src = img.previewUrl
|
|
6713
|
+
|| `${krubbleHttp.Http.getBaseUrl()}/api/system/conversationFile/${img.conversationFileID}/view`;
|
|
6711
6714
|
const preview = krubbleComponents.FilePreview.open({
|
|
6712
|
-
src
|
|
6715
|
+
src,
|
|
6713
6716
|
name: img.niceName || 'image',
|
|
6714
6717
|
});
|
|
6715
6718
|
// The previewer's download button only fires a `download` event — the
|
|
@@ -6766,13 +6769,24 @@
|
|
|
6766
6769
|
type: 'user',
|
|
6767
6770
|
content: params.message,
|
|
6768
6771
|
};
|
|
6772
|
+
// Attach the staged files' local previews to the message so its thumbnails
|
|
6773
|
+
// show INSTANTLY, without waiting on the upload. Each carries a temporary
|
|
6774
|
+
// previewUrl (and conversationFileID -1 as a placeholder); the built-in send
|
|
6775
|
+
// swaps these for the real server files once the upload returns.
|
|
6776
|
+
if (this._pendingConversationFiles.length) {
|
|
6777
|
+
userMessage.conversationFiles = this._pendingConversationFiles.map((p) => ({
|
|
6778
|
+
conversationFileID: -1,
|
|
6779
|
+
niceName: p.name,
|
|
6780
|
+
previewUrl: p.previewUrl,
|
|
6781
|
+
}));
|
|
6782
|
+
}
|
|
6769
6783
|
this.messages = [...this.messages, userMessage];
|
|
6770
6784
|
this._inputValue = '';
|
|
6771
6785
|
this._saveState();
|
|
6772
6786
|
this._error = '';
|
|
6773
6787
|
this._userHasScrolledUp = false;
|
|
6774
|
-
// Clear the composer
|
|
6775
|
-
|
|
6788
|
+
// Clear the composer, but DON'T revoke the preview object URLs — the sent
|
|
6789
|
+
// message now renders them until the upload's real files replace them.
|
|
6776
6790
|
this._pendingConversationFiles = [];
|
|
6777
6791
|
// Reset textarea height
|
|
6778
6792
|
if (this._inputEl) {
|
|
@@ -6835,12 +6849,18 @@
|
|
|
6835
6849
|
}));
|
|
6836
6850
|
}
|
|
6837
6851
|
return uploaded.then((files) => {
|
|
6838
|
-
//
|
|
6839
|
-
//
|
|
6840
|
-
// one _send appended before the trailing empty assistant
|
|
6852
|
+
// Replace the just-sent user message's local previews with the real
|
|
6853
|
+
// uploaded files (backed by the stored file's view URL). The last user
|
|
6854
|
+
// message is the one _send appended before the trailing empty assistant
|
|
6855
|
+
// message; revoke its now-defunct preview object URLs first.
|
|
6841
6856
|
if (files.length) {
|
|
6842
6857
|
for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
6843
6858
|
if (this.messages[i].type === 'user') {
|
|
6859
|
+
(this.messages[i].conversationFiles || []).forEach((f) => {
|
|
6860
|
+
if (f.previewUrl) {
|
|
6861
|
+
URL.revokeObjectURL(f.previewUrl);
|
|
6862
|
+
}
|
|
6863
|
+
});
|
|
6844
6864
|
this.messages[i].conversationFiles = files;
|
|
6845
6865
|
this.requestUpdate();
|
|
6846
6866
|
break;
|
|
@@ -7591,7 +7611,7 @@
|
|
|
7591
7611
|
@click=${() => this._openImage(img)}
|
|
7592
7612
|
>
|
|
7593
7613
|
<img
|
|
7594
|
-
src
|
|
7614
|
+
src=${img.previewUrl || `${krubbleHttp.Http.getBaseUrl()}/api/system/conversationFile/${img.conversationFileID}/view`}
|
|
7595
7615
|
alt=${img.niceName || ''}
|
|
7596
7616
|
/>
|
|
7597
7617
|
</button>
|