@kodaris/krubble-app-components 1.0.69 → 1.0.71
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 +113 -12
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +648 -178
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +688 -208
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +428 -178
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +687 -207
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +418 -168
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/chatbot.d.ts
CHANGED
|
@@ -1,20 +1,69 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* An internal file stored on the server. Mirrors the backend InternalFileViewDto
|
|
4
|
+
* (and its InternalFileCreateUpdateDto base), so files loaded with a conversation
|
|
5
|
+
* pass through unchanged. The chatbot displays images from these by building a
|
|
6
|
+
* view URL from `internalFileID` at render time.
|
|
7
|
+
*/
|
|
8
|
+
export interface KRChatbotInternalFile {
|
|
9
|
+
internalFileID: number;
|
|
10
|
+
internalFileUUID?: string;
|
|
11
|
+
niceName?: string;
|
|
12
|
+
mimeType?: string;
|
|
13
|
+
lastModified?: string;
|
|
14
|
+
fileType?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
created?: string;
|
|
17
|
+
entityID?: number;
|
|
18
|
+
entityType?: string;
|
|
19
|
+
geoCoordinates?: string;
|
|
20
|
+
imageDetectionType?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
creator?: string;
|
|
24
|
+
keywords?: string;
|
|
25
|
+
subType?: string;
|
|
26
|
+
alt?: string;
|
|
27
|
+
metadata?: string;
|
|
28
|
+
deleted?: boolean;
|
|
29
|
+
extraText?: string;
|
|
30
|
+
emailID?: number;
|
|
31
|
+
aiPimSource?: string;
|
|
32
|
+
aiPimLastParsed?: string;
|
|
33
|
+
aiPimStatus?: string;
|
|
34
|
+
folder?: string;
|
|
35
|
+
status?: string;
|
|
36
|
+
extra1?: string;
|
|
37
|
+
extra2?: string;
|
|
38
|
+
extra3?: string;
|
|
39
|
+
extra4?: string;
|
|
40
|
+
extra5?: string;
|
|
41
|
+
parentInternalFileID?: number;
|
|
42
|
+
isFolder?: boolean;
|
|
43
|
+
type?: string;
|
|
44
|
+
aiPimEnabled?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Chat message interface. Field names mirror the backend
|
|
48
|
+
* ConversationMessageViewDto so loaded messages pass through without remapping.
|
|
4
49
|
*/
|
|
5
50
|
export interface KRChatbotMessage {
|
|
6
|
-
|
|
51
|
+
type: 'user' | 'assistant';
|
|
7
52
|
content: string;
|
|
8
53
|
reasoning?: string;
|
|
54
|
+
/** Internal files attached to this message. */
|
|
55
|
+
internalFiles?: KRChatbotInternalFile[];
|
|
9
56
|
}
|
|
10
57
|
/**
|
|
11
58
|
* Callback function type for sending messages.
|
|
12
|
-
* Receives the user's message text
|
|
13
|
-
* Must return a Response with a
|
|
59
|
+
* Receives the user's message text, the current conversation history, and the
|
|
60
|
+
* raw image files attached to this message. Must return a Response with a
|
|
61
|
+
* streaming body (SSE format).
|
|
14
62
|
*/
|
|
15
63
|
export type KRChatbotSend = (params: {
|
|
16
64
|
message: string;
|
|
17
65
|
messages: KRChatbotMessage[];
|
|
66
|
+
internalFiles: File[];
|
|
18
67
|
}) => Promise<Response>;
|
|
19
68
|
/**
|
|
20
69
|
* AI chatbot component with SSE streaming.
|
|
@@ -36,7 +85,7 @@ export type KRChatbotSend = (params: {
|
|
|
36
85
|
* ## Usage
|
|
37
86
|
* ```html
|
|
38
87
|
* <kr-chatbot
|
|
39
|
-
*
|
|
88
|
+
* label="AI Assistant"
|
|
40
89
|
* .send=${(params) => {
|
|
41
90
|
* return fetch('/api/ai/chat/stream', {
|
|
42
91
|
* method: 'POST',
|
|
@@ -69,19 +118,32 @@ export declare class KRChatbot extends LitElement {
|
|
|
69
118
|
private _dragStartTop;
|
|
70
119
|
private _resizeStartW;
|
|
71
120
|
private _resizeStartH;
|
|
121
|
+
/** Counter for depth-aware dragenter/dragleave tracking. */
|
|
122
|
+
private _dragDepth;
|
|
123
|
+
/** Monotonic id source for pending attachments. */
|
|
124
|
+
private _pendingSeq;
|
|
72
125
|
/**
|
|
73
126
|
* Callback function for sending messages. Receives the user's message and
|
|
74
127
|
* current conversation history. Must return a Response with a streaming SSE body.
|
|
128
|
+
*
|
|
129
|
+
* Optional — when not set, the chatbot uses its built-in default that streams
|
|
130
|
+
* from the Kodaris Bedrock conversation endpoints. Set this to override.
|
|
75
131
|
*/
|
|
76
132
|
send: KRChatbotSend | null;
|
|
77
133
|
/**
|
|
78
134
|
* Callback function called when the user clears the conversation.
|
|
79
135
|
* Must return a Promise — messages are only cleared if it resolves.
|
|
136
|
+
*
|
|
137
|
+
* Optional — when not set, the chatbot uses its built-in default that clears
|
|
138
|
+
* the Kodaris Bedrock conversation state. Set this to override.
|
|
80
139
|
*/
|
|
81
140
|
clear: (() => Promise<unknown>) | null;
|
|
82
141
|
/**
|
|
83
142
|
* Callback function called on init to load existing conversation messages.
|
|
84
143
|
* Must return a Promise that resolves with an array of KRChatbotMessage.
|
|
144
|
+
*
|
|
145
|
+
* Optional — when not set, the chatbot uses its built-in default that loads
|
|
146
|
+
* existing messages from the Kodaris Bedrock conversation. Set this to override.
|
|
85
147
|
*/
|
|
86
148
|
load: (() => Promise<KRChatbotMessage[]>) | null;
|
|
87
149
|
/**
|
|
@@ -90,13 +152,9 @@ export declare class KRChatbot extends LitElement {
|
|
|
90
152
|
*/
|
|
91
153
|
messages: KRChatbotMessage[];
|
|
92
154
|
/**
|
|
93
|
-
* Header
|
|
155
|
+
* Header label text.
|
|
94
156
|
*/
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Header subtitle text (shown below title with a green status dot).
|
|
98
|
-
*/
|
|
99
|
-
subtitle: string;
|
|
157
|
+
label: string;
|
|
100
158
|
/**
|
|
101
159
|
* Input placeholder text.
|
|
102
160
|
*/
|
|
@@ -105,13 +163,34 @@ export declare class KRChatbot extends LitElement {
|
|
|
105
163
|
* Whether the chat panel is open. Only relevant in floating mode.
|
|
106
164
|
*/
|
|
107
165
|
opened: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Hide the built-in floating toggle button. Use this when an external
|
|
168
|
+
* control (e.g. the site-editor bar) owns opening the chat — the panel is
|
|
169
|
+
* then driven via the `open()` / `close()` / `toggle()` methods.
|
|
170
|
+
*/
|
|
171
|
+
hideToggle: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Layout mode.
|
|
174
|
+
* - `'floating'` (default): the chatbot is a fixed bottom-right widget with a
|
|
175
|
+
* toggle button, and the panel can be dragged and resized. This is the
|
|
176
|
+
* traditional chat-widget appearance.
|
|
177
|
+
* - `'inline'`: the chatbot drops its fixed positioning and fills its parent
|
|
178
|
+
* container (100% width/height, no border radius/shadow, no toggle, no
|
|
179
|
+
* drag/resize). The panel is always open. Use this to embed the chat as a
|
|
180
|
+
* full page or panel region.
|
|
181
|
+
*/
|
|
182
|
+
variant: 'floating' | 'inline';
|
|
108
183
|
private _inputValue;
|
|
109
184
|
private _isStreaming;
|
|
110
|
-
private _statusText;
|
|
111
185
|
private _error;
|
|
186
|
+
/** Images staged in the composer, before the message is sent. */
|
|
187
|
+
private _pendingInternalFiles;
|
|
188
|
+
/** True while a file is being dragged over the panel (shows the drop overlay). */
|
|
189
|
+
private _isDraggingFile;
|
|
112
190
|
private _panelEl;
|
|
113
191
|
private _messagesEl;
|
|
114
192
|
private _inputEl;
|
|
193
|
+
private _fileInputEl;
|
|
115
194
|
connectedCallback(): void;
|
|
116
195
|
disconnectedCallback(): void;
|
|
117
196
|
updated(changed: Map<string, unknown>): void;
|
|
@@ -119,6 +198,12 @@ export declare class KRChatbot extends LitElement {
|
|
|
119
198
|
* Stops the current stream without clearing the conversation.
|
|
120
199
|
*/
|
|
121
200
|
stop(): void;
|
|
201
|
+
/** Open the chat panel. */
|
|
202
|
+
open(): void;
|
|
203
|
+
/** Close the chat panel. */
|
|
204
|
+
close(): void;
|
|
205
|
+
/** Toggle the chat panel open/closed. */
|
|
206
|
+
toggle(): void;
|
|
122
207
|
/**
|
|
123
208
|
* Shows a full-viewport transparent overlay during drag/resize operations.
|
|
124
209
|
*
|
|
@@ -150,6 +235,22 @@ export declare class KRChatbot extends LitElement {
|
|
|
150
235
|
private _applyStoredLayout;
|
|
151
236
|
private _handleInputChange;
|
|
152
237
|
private _handleKeyDown;
|
|
238
|
+
private _openFilePicker;
|
|
239
|
+
private _handleFileInputChange;
|
|
240
|
+
private _handlePaste;
|
|
241
|
+
private _handleDragEnter;
|
|
242
|
+
private _handleDragOver;
|
|
243
|
+
private _handleDragLeave;
|
|
244
|
+
private _handleDrop;
|
|
245
|
+
private _hasFiles;
|
|
246
|
+
/** Stage a set of image files in the composer (held locally until send). */
|
|
247
|
+
private _addFiles;
|
|
248
|
+
private _removePending;
|
|
249
|
+
private _clearPending;
|
|
250
|
+
/** Open the shared full-screen previewer for a message image. */
|
|
251
|
+
private _openImage;
|
|
252
|
+
/** Whether the send button is active: needs text or at least one image. */
|
|
253
|
+
private _canSend;
|
|
153
254
|
private _handleSubmit;
|
|
154
255
|
private _handleStop;
|
|
155
256
|
private _handleClear;
|
package/dist/chatbot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../src/chatbot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../src/chatbot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,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