@kodaris/krubble-app-components 1.0.103 → 1.0.105
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 +4 -2
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +46 -18
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +46 -18
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +22 -13
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +46 -18
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +17 -8
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -5530,15 +5530,23 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
5530
5530
|
};
|
|
5531
5531
|
/** Image extensions the chatbot renders as thumbnails (used when MIME is absent). */
|
|
5532
5532
|
const IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
|
|
5533
|
+
/**
|
|
5534
|
+
* Video extensions the picker accepts. The AI cannot watch video — these upload
|
|
5535
|
+
* and store for playback and tool use only, and the backend tells the model so.
|
|
5536
|
+
* Matches what kr-file-preview can play back.
|
|
5537
|
+
*/
|
|
5538
|
+
const VIDEO_EXTENSIONS = ['mp4', 'webm', 'ogg', 'mov'];
|
|
5533
5539
|
/**
|
|
5534
5540
|
* File extensions the picker accepts. Mirrors what the backend can read: the
|
|
5535
5541
|
* document/spreadsheet family Bedrock ingests, the plain-text family read as
|
|
5536
|
-
* fallback, and the image formats.
|
|
5542
|
+
* fallback, and the image formats. Videos are accepted for upload/storage even
|
|
5543
|
+
* though the model can't read them. This is a UX convenience — the backend
|
|
5537
5544
|
* accepts anything and just tells the model when a type can't be read.
|
|
5538
5545
|
*/
|
|
5539
5546
|
const ACCEPTED_FILE_EXTENSIONS = [
|
|
5540
5547
|
'pdf', 'doc', 'docx', 'xls', 'xlsx', 'csv', 'html', 'md', 'txt', 'json', 'xml',
|
|
5541
5548
|
...IMAGE_EXTENSIONS,
|
|
5549
|
+
...VIDEO_EXTENSIONS,
|
|
5542
5550
|
];
|
|
5543
5551
|
/**
|
|
5544
5552
|
* AI chatbot component with SSE streaming.
|
|
@@ -6048,6 +6056,10 @@ let KRChatbot = class KRChatbot extends i$3 {
|
|
|
6048
6056
|
stop() {
|
|
6049
6057
|
this._handleStop();
|
|
6050
6058
|
}
|
|
6059
|
+
/** Whether a turn is in flight — true from send until the stream ends. */
|
|
6060
|
+
isStreaming() {
|
|
6061
|
+
return this._isStreaming;
|
|
6062
|
+
}
|
|
6051
6063
|
/** Open the chat panel. */
|
|
6052
6064
|
open() {
|
|
6053
6065
|
if (!this.opened) {
|
|
@@ -6848,8 +6860,9 @@ let KRChatbot = class KRChatbot extends i$3 {
|
|
|
6848
6860
|
return;
|
|
6849
6861
|
}
|
|
6850
6862
|
files.forEach((file) => {
|
|
6851
|
-
// Only images get a local preview thumbnail; documents
|
|
6852
|
-
// Prefer the File's MIME, falling back to the
|
|
6863
|
+
// Only images get a local preview thumbnail; documents (and videos, which are
|
|
6864
|
+
// tiles too) render an icon. Prefer the File's MIME, falling back to the
|
|
6865
|
+
// extension when it's absent.
|
|
6853
6866
|
let previewUrl;
|
|
6854
6867
|
if (file.type.startsWith('image/') || IMAGE_EXTENSIONS.includes(this._getFileExtension(file.name))) {
|
|
6855
6868
|
previewUrl = URL.createObjectURL(file);
|
|
@@ -6880,22 +6893,25 @@ let KRChatbot = class KRChatbot extends i$3 {
|
|
|
6880
6893
|
});
|
|
6881
6894
|
this._pendingConversationFiles = [];
|
|
6882
6895
|
}
|
|
6883
|
-
/** Open the shared full-screen previewer for a message image. */
|
|
6884
|
-
|
|
6896
|
+
/** Open the shared full-screen previewer for a message attachment (image or video). */
|
|
6897
|
+
_handleFileOpen(file) {
|
|
6885
6898
|
// Use the local preview if the upload hasn't finished yet; otherwise the
|
|
6886
6899
|
// backend view URL (prefixed with the base URL — a raw fetch of a relative
|
|
6887
6900
|
// path would hit the page origin, e.g. the dev server, not the backend).
|
|
6888
|
-
|
|
6889
|
-
|
|
6901
|
+
// The previewer picks image vs video playback off the name's extension, so
|
|
6902
|
+
// niceName has to carry it — hence the generic fallback keeps no extension
|
|
6903
|
+
// only when there's no name at all.
|
|
6904
|
+
const src = file.previewUrl
|
|
6905
|
+
|| `${KRHttp.getBaseUrl()}/api/system/conversationFile/${file.conversationFileID}/view`;
|
|
6890
6906
|
const preview = KRFilePreview.open({
|
|
6891
6907
|
src,
|
|
6892
|
-
name:
|
|
6908
|
+
name: file.niceName || 'file',
|
|
6893
6909
|
});
|
|
6894
6910
|
// The previewer's download button only fires a `download` event — the
|
|
6895
6911
|
// consumer performs the actual download. Hit the view endpoint with
|
|
6896
6912
|
// `?download=true` (Content-Disposition: attachment) in a new tab.
|
|
6897
6913
|
preview.addEventListener('download', () => {
|
|
6898
|
-
window.open(`${KRHttp.getBaseUrl()}/api/system/conversationFile/${
|
|
6914
|
+
window.open(`${KRHttp.getBaseUrl()}/api/system/conversationFile/${file.conversationFileID}/view?download=true`, '_blank');
|
|
6899
6915
|
});
|
|
6900
6916
|
}
|
|
6901
6917
|
_handleSubmit() {
|
|
@@ -7830,15 +7846,18 @@ let KRChatbot = class KRChatbot extends i$3 {
|
|
|
7830
7846
|
if (file.mimeType) {
|
|
7831
7847
|
isImage = file.mimeType.startsWith('image/');
|
|
7832
7848
|
}
|
|
7833
|
-
//
|
|
7834
|
-
//
|
|
7849
|
+
// An image shows its thumbnail; everything else shows a
|
|
7850
|
+
// file-type tile. Both open the previewer on click — it renders
|
|
7851
|
+
// images, video, PDFs, and text inline, and shows a download
|
|
7852
|
+
// tile for the rest (Office formats), so a click always does
|
|
7853
|
+
// something useful.
|
|
7835
7854
|
if (isImage) {
|
|
7836
7855
|
return b `
|
|
7837
7856
|
<button
|
|
7838
7857
|
class="attachment"
|
|
7839
7858
|
type="button"
|
|
7840
7859
|
title=${file.niceName || 'View image'}
|
|
7841
|
-
@click=${() => this.
|
|
7860
|
+
@click=${() => this._handleFileOpen(file)}
|
|
7842
7861
|
>
|
|
7843
7862
|
<img
|
|
7844
7863
|
src=${file.previewUrl || `${KRHttp.getBaseUrl()}/api/system/conversationFile/${file.conversationFileID}/view`}
|
|
@@ -7848,13 +7867,15 @@ let KRChatbot = class KRChatbot extends i$3 {
|
|
|
7848
7867
|
`;
|
|
7849
7868
|
}
|
|
7850
7869
|
return b `
|
|
7851
|
-
<
|
|
7852
|
-
class="attachment attachment--doc"
|
|
7870
|
+
<button
|
|
7871
|
+
class="attachment attachment--doc attachment--openable"
|
|
7872
|
+
type="button"
|
|
7853
7873
|
title=${fileName}
|
|
7874
|
+
@click=${() => this._handleFileOpen(file)}
|
|
7854
7875
|
>
|
|
7855
7876
|
<span class="attachment__type">${this._getFileExtension(fileName) || 'File'}</span>
|
|
7856
7877
|
<span class="attachment__name">${fileName}</span>
|
|
7857
|
-
</
|
|
7878
|
+
</button>
|
|
7858
7879
|
`;
|
|
7859
7880
|
})}
|
|
7860
7881
|
</div>
|
|
@@ -9126,15 +9147,22 @@ KRChatbot.styles = i$6 `
|
|
|
9126
9147
|
display: block;
|
|
9127
9148
|
}
|
|
9128
9149
|
|
|
9129
|
-
/* Non-image attachment in a sent message — file-type label above the filename
|
|
9130
|
-
(the previewer is image-only, so this isn't clickable). */
|
|
9150
|
+
/* Non-image attachment in a sent message — file-type label above the filename. */
|
|
9131
9151
|
.attachment--doc {
|
|
9132
9152
|
display: flex;
|
|
9133
9153
|
flex-direction: column;
|
|
9134
9154
|
padding: 16px 14px;
|
|
9135
9155
|
box-sizing: border-box;
|
|
9136
9156
|
text-align: left;
|
|
9137
|
-
|
|
9157
|
+
}
|
|
9158
|
+
|
|
9159
|
+
/* Opens the previewer on click — same affordance as the composer's doc chip. */
|
|
9160
|
+
.attachment--openable {
|
|
9161
|
+
cursor: pointer;
|
|
9162
|
+
}
|
|
9163
|
+
|
|
9164
|
+
.attachment--openable:hover {
|
|
9165
|
+
background: #dfdddd;
|
|
9138
9166
|
}
|
|
9139
9167
|
|
|
9140
9168
|
.attachment__type {
|