@kodaris/krubble-app-components 1.0.84 → 1.0.86

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 CHANGED
@@ -1,47 +1,33 @@
1
1
  import { LitElement } from 'lit';
2
2
  /**
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.
3
+ * A conversation file stored on the server (a chat attachment: image / library /
4
+ * prompt / memory). Mirrors the backend ConversationFileViewDto, so files loaded
5
+ * with a conversation pass through unchanged. The chatbot displays images by
6
+ * building a view URL from `conversationFileID` at render time.
7
7
  */
8
- export interface KRChatbotInternalFile {
9
- internalFileID: number;
10
- internalFileUUID?: string;
11
- niceName?: string;
8
+ export interface KRChatbotConversationFile {
9
+ conversationFileID: number;
10
+ administratorID?: number;
11
+ type?: string;
12
+ subType?: string;
13
+ path?: string;
14
+ folder?: string;
12
15
  mimeType?: string;
13
- lastModified?: string;
14
16
  fileType?: string;
15
- path?: string;
16
- created?: string;
17
- entityID?: number;
18
- entityType?: string;
19
- geoCoordinates?: string;
20
- imageDetectionType?: string;
17
+ niceName?: string;
21
18
  name?: string;
22
19
  description?: string;
23
- creator?: string;
24
20
  keywords?: string;
25
- subType?: string;
26
- alt?: string;
27
21
  metadata?: string;
28
- deleted?: boolean;
29
- extraText?: string;
30
- emailID?: number;
31
- aiPimSource?: string;
32
- aiPimLastParsed?: string;
33
- aiPimStatus?: string;
34
- folder?: string;
35
22
  status?: string;
36
23
  extra1?: string;
37
24
  extra2?: string;
38
25
  extra3?: string;
39
26
  extra4?: string;
40
27
  extra5?: string;
41
- parentInternalFileID?: number;
42
- isFolder?: boolean;
43
- type?: string;
44
- aiPimEnabled?: boolean;
28
+ extraText?: string;
29
+ created?: string;
30
+ lastModified?: string;
45
31
  }
46
32
  /**
47
33
  * Chat message interface. Field names mirror the backend
@@ -51,8 +37,8 @@ export interface KRChatbotMessage {
51
37
  type: 'user' | 'assistant';
52
38
  content: string;
53
39
  reasoning?: string;
54
- /** Internal files attached to this message. */
55
- internalFiles?: KRChatbotInternalFile[];
40
+ /** Conversation files attached to this message. */
41
+ conversationFiles?: KRChatbotConversationFile[];
56
42
  }
57
43
  /**
58
44
  * INTERNAL-ONLY debug telemetry carried by a `TOKEN_USAGE` SSE event's `data`.
@@ -166,7 +152,7 @@ export interface KRChatbotSkill {
166
152
  export type KRChatbotSend = (params: {
167
153
  message: string;
168
154
  messages: KRChatbotMessage[];
169
- internalFiles: File[];
155
+ conversationFiles: File[];
170
156
  }) => Promise<Response>;
171
157
  /**
172
158
  * AI chatbot component with SSE streaming.
@@ -251,14 +237,6 @@ export declare class KRChatbot extends LitElement {
251
237
  * from the Kodaris Bedrock conversation endpoints. Set this to override.
252
238
  */
253
239
  send: KRChatbotSend | null;
254
- /**
255
- * Callback function called when the user clears the conversation.
256
- * Must return a Promise — messages are only cleared if it resolves.
257
- *
258
- * Optional — when not set, the chatbot uses its built-in default that clears
259
- * the Kodaris Bedrock conversation state. Set this to override.
260
- */
261
- clear: (() => Promise<unknown>) | null;
262
240
  /**
263
241
  * Callback function called on init to load existing conversation messages.
264
242
  * Must return a Promise that resolves with an array of KRChatbotMessage.
@@ -301,6 +279,20 @@ export declare class KRChatbot extends LitElement {
301
279
  * full page or panel region.
302
280
  */
303
281
  variant: 'floating' | 'inline';
282
+ /**
283
+ * The conversation this chatbot's turns target (backend `conversationID`).
284
+ *
285
+ * - Set → every turn is sent with this `conversationID`, so the chat continues
286
+ * that specific conversation.
287
+ * - Unset → the first turn is sent with `createNew: true` (a fresh
288
+ * conversation); the component then resolves the new conversation's id (via
289
+ * `/conversation/last`) and pins it here so the rest of the session stays one
290
+ * conversation instead of spawning a new one per message.
291
+ *
292
+ * Only used by the built-in `send` default; a custom `send` owns its own
293
+ * targeting.
294
+ */
295
+ conversationId: number | null;
304
296
  private _inputValue;
305
297
  private _isStreaming;
306
298
  private _error;
@@ -338,7 +330,7 @@ export declare class KRChatbot extends LitElement {
338
330
  /** True while the user is dragging the debug drawer's resize handle. */
339
331
  private _isDebugResizing;
340
332
  /** Images staged in the composer, before the message is sent. */
341
- private _pendingInternalFiles;
333
+ private _pendingConversationFiles;
342
334
  /** True while a file is being dragged over the panel (shows the drop overlay). */
343
335
  private _isDraggingFile;
344
336
  /** Whether the `/` skill menu is open above the composer. */
@@ -514,7 +506,6 @@ export declare class KRChatbot extends LitElement {
514
506
  */
515
507
  private _send;
516
508
  private _handleStop;
517
- private _handleClear;
518
509
  private _handleMessagesScroll;
519
510
  private _handleErrorDismiss;
520
511
  private _handleContextWarningDismiss;
@@ -1 +1 @@
1
- {"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../src/chatbot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAYrD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC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points. Set this to override.
104
104
  */
105
105
  this.send = null;
106
- /**
107
- * Callback function called when the user clears the conversation.
108
- * Must return a Promise — messages are only cleared if it resolves.
109
- *
110
- * Optional — when not set, the chatbot uses its built-in default that clears
111
- * the Kodaris Bedrock conversation state. Set this to override.
112
- */
113
- this.clear = null;
114
106
  /**
115
107
  * Callback function called on init to load existing conversation messages.
116
108
  * Must return a Promise that resolves with an array of KRChatbotMessage.
@@ -153,6 +145,20 @@ let KRChatbot = class KRChatbot extends LitElement {
153
145
  * full page or panel region.
154
146
  */
155
147
  this.variant = 'floating';
148
+ /**
149
+ * The conversation this chatbot's turns target (backend `conversationID`).
150
+ *
151
+ * - Set → every turn is sent with this `conversationID`, so the chat continues
152
+ * that specific conversation.
153
+ * - Unset → the first turn is sent with `createNew: true` (a fresh
154
+ * conversation); the component then resolves the new conversation's id (via
155
+ * `/conversation/last`) and pins it here so the rest of the session stays one
156
+ * conversation instead of spawning a new one per message.
157
+ *
158
+ * Only used by the built-in `send` default; a custom `send` owns its own
159
+ * targeting.
160
+ */
161
+ this.conversationId = null;
156
162
  // --- @state (internal) ---
157
163
  this._inputValue = '';
158
164
  this._isStreaming = false;
@@ -191,7 +197,7 @@ let KRChatbot = class KRChatbot extends LitElement {
191
197
  /** True while the user is dragging the debug drawer's resize handle. */
192
198
  this._isDebugResizing = false;
193
199
  /** Images staged in the composer, before the message is sent. */
194
- this._pendingInternalFiles = [];
200
+ this._pendingConversationFiles = [];
195
201
  /** True while a file is being dragged over the panel (shows the drop overlay). */
196
202
  this._isDraggingFile = false;
197
203
  /** Whether the `/` skill menu is open above the composer. */
@@ -361,7 +367,7 @@ let KRChatbot = class KRChatbot extends LitElement {
361
367
  document.removeEventListener('mousemove', this._handleMouseMove);
362
368
  document.removeEventListener('mouseup', this._handleMouseUp);
363
369
  // Release any object URLs still held by staged attachments.
364
- this._pendingInternalFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
370
+ this._pendingConversationFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
365
371
  }
366
372
  updated(changed) {
367
373
  if (changed.has('messages')) {
@@ -694,7 +700,7 @@ let KRChatbot = class KRChatbot extends LitElement {
694
700
  this._skillMenuOpened = false;
695
701
  this._send({
696
702
  message: '/test-context-warning',
697
- internalFiles: [],
703
+ conversationFiles: [],
698
704
  });
699
705
  return;
700
706
  }
@@ -702,7 +708,7 @@ let KRChatbot = class KRChatbot extends LitElement {
702
708
  this._skillMenuOpened = false;
703
709
  this._send({
704
710
  message: '/test-context-limit',
705
- internalFiles: [],
711
+ conversationFiles: [],
706
712
  });
707
713
  return;
708
714
  }
@@ -1019,6 +1025,10 @@ let KRChatbot = class KRChatbot extends LitElement {
1019
1025
  }
1020
1026
  // --- Attachments ---
1021
1027
  _openFilePicker() {
1028
+ // Close the skill/attachment menu — opening the OS file picker is the end of
1029
+ // the menu interaction, and the picker is a separate window so the menu would
1030
+ // otherwise linger open behind it (and after a file is chosen).
1031
+ this._skillMenuOpened = false;
1022
1032
  this._fileInputEl?.click();
1023
1033
  }
1024
1034
  _handleFileInputChange(e) {
@@ -1100,49 +1110,49 @@ let KRChatbot = class KRChatbot extends LitElement {
1100
1110
  name: file.name,
1101
1111
  previewUrl: URL.createObjectURL(file),
1102
1112
  };
1103
- this._pendingInternalFiles = [...this._pendingInternalFiles, pending];
1113
+ this._pendingConversationFiles = [...this._pendingConversationFiles, pending];
1104
1114
  });
1105
1115
  }
1106
1116
  _removePending(localId) {
1107
- const target = this._pendingInternalFiles.find((p) => p.localId === localId);
1117
+ const target = this._pendingConversationFiles.find((p) => p.localId === localId);
1108
1118
  if (target) {
1109
1119
  URL.revokeObjectURL(target.previewUrl);
1110
1120
  }
1111
- this._pendingInternalFiles = this._pendingInternalFiles.filter((p) => p.localId !== localId);
1121
+ this._pendingConversationFiles = this._pendingConversationFiles.filter((p) => p.localId !== localId);
1112
1122
  }
1113
1123
  _clearPending() {
1114
- this._pendingInternalFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
1115
- this._pendingInternalFiles = [];
1124
+ this._pendingConversationFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
1125
+ this._pendingConversationFiles = [];
1116
1126
  }
1117
1127
  /** Open the shared full-screen previewer for a message image. */
1118
1128
  _openImage(img) {
1119
1129
  KRFilePreview.open({
1120
- src: `/api/system/integration/aws/bedrock/conversationImage/${img.internalFileID}/view`,
1130
+ src: `/api/system/conversationFile/${img.conversationFileID}/view`,
1121
1131
  name: img.niceName || 'image',
1122
1132
  });
1123
1133
  }
1124
1134
  /** Whether the send button is active: needs text or at least one image. */
1125
1135
  _canSend() {
1126
- return Boolean(this._inputValue.trim()) || this._pendingInternalFiles.length > 0;
1136
+ return Boolean(this._inputValue.trim()) || this._pendingConversationFiles.length > 0;
1127
1137
  }
1128
1138
  _handleSubmit() {
1129
1139
  if (this._isStreaming) {
1130
1140
  return;
1131
1141
  }
1132
1142
  const messageText = this._inputValue.trim();
1133
- const pending = this._pendingInternalFiles;
1143
+ const pending = this._pendingConversationFiles;
1134
1144
  // Allow sending an image with no text, but require at least one of them.
1135
1145
  if (!messageText && !pending.length) {
1136
1146
  return;
1137
1147
  }
1138
1148
  // The raw files sent to the backend. Sent images are shown once the
1139
- // conversation reloads and they come back as stored internal files; the
1149
+ // conversation reloads and they come back as stored conversation files; the
1140
1150
  // just-sent message itself carries text only.
1141
- const internalFiles = pending.map((p) => p.file);
1151
+ const conversationFiles = pending.map((p) => p.file);
1142
1152
  const submitEvent = new CustomEvent('message-submit', {
1143
1153
  detail: {
1144
1154
  message: messageText,
1145
- internalFiles,
1155
+ conversationFiles,
1146
1156
  },
1147
1157
  bubbles: true,
1148
1158
  composed: true,
@@ -1154,7 +1164,7 @@ let KRChatbot = class KRChatbot extends LitElement {
1154
1164
  }
1155
1165
  this._send({
1156
1166
  message: messageText,
1157
- internalFiles
1167
+ conversationFiles
1158
1168
  });
1159
1169
  }
1160
1170
  /**
@@ -1174,8 +1184,8 @@ let KRChatbot = class KRChatbot extends LitElement {
1174
1184
  this._error = '';
1175
1185
  this._userHasScrolledUp = false;
1176
1186
  // Clear the composer and release its preview object URLs.
1177
- this._pendingInternalFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
1178
- this._pendingInternalFiles = [];
1187
+ this._pendingConversationFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
1188
+ this._pendingConversationFiles = [];
1179
1189
  // Reset textarea height
1180
1190
  if (this._inputEl) {
1181
1191
  this._inputEl.style.height = 'auto';
@@ -1211,30 +1221,74 @@ let KRChatbot = class KRChatbot extends LitElement {
1211
1221
  // the consumer hasn't provided their own `send`.
1212
1222
  if (!this.send) {
1213
1223
  this.send = (params) => {
1214
- // With images, post text + files as multipart; without, post plain JSON.
1215
- if (params.internalFiles.length) {
1216
- const form = new FormData();
1217
- form.append('userText', params.message);
1218
- params.internalFiles.forEach((file) => form.append('images', file));
1224
+ // Images are upload-first: each file is stored as a conversation file
1225
+ // (type LIBRARY — the format lives in mimeType), then the resulting
1226
+ // conversationFileIDs are attached to the message via `fileIds` on the
1227
+ // normal JSON stream call. There is no multipart chat endpoint. With no
1228
+ // images the upload resolves to an empty list immediately; a failed
1229
+ // upload is dropped so an undefined id never reaches `fileIds`.
1230
+ let uploaded = Promise.resolve([]);
1231
+ if (params.conversationFiles.length) {
1232
+ uploaded = Promise.all(params.conversationFiles.map((file) => {
1233
+ const form = new FormData();
1234
+ form.append('file', file);
1235
+ form.append('type', 'LIBRARY');
1236
+ form.append('niceName', file.name);
1237
+ return KRHttp.fetch({
1238
+ url: '/api/system/conversationFile/upload',
1239
+ method: 'POST',
1240
+ body: form,
1241
+ })
1242
+ .then((r) => r.json())
1243
+ .then((res) => res?.data?.conversationFileID);
1244
+ })).then((ids) => ids.filter((id) => typeof id === 'number'));
1245
+ }
1246
+ return uploaded.then((fileIds) => {
1247
+ // Conversation targeting: continue `conversationId` when set, else
1248
+ // start a fresh conversation (createNew) for this turn. The pin below
1249
+ // means createNew only fires on the very first untargeted turn.
1250
+ const body = {
1251
+ userText: params.message,
1252
+ fileIds,
1253
+ };
1254
+ if (this.conversationId != null) {
1255
+ body.conversationID = this.conversationId;
1256
+ }
1257
+ else {
1258
+ body.createNew = true;
1259
+ }
1219
1260
  return KRHttp.fetch({
1220
- url: '/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithImages',
1261
+ url: '/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState',
1221
1262
  method: 'POST',
1222
1263
  headers: { Accept: 'text/event-stream' },
1223
- body: form,
1264
+ body,
1265
+ }).then((response) => {
1266
+ // Pin the session to the conversation this turn used. The stream
1267
+ // doesn't echo the resolved id, so when we let the server create one
1268
+ // (no conversationId set) we resolve it via `/last` and keep it, so
1269
+ // subsequent turns continue this conversation instead of each sending
1270
+ // createNew and spawning a new one. Best-effort, fire-and-forget: a
1271
+ // failure leaves it unpinned and the next turn resolves server-side.
1272
+ if (this.conversationId == null) {
1273
+ KRHttp.fetch({ url: '/api/system/conversation/last' })
1274
+ .then((r) => r.json())
1275
+ .then((res) => {
1276
+ const id = res?.data?.conversationID;
1277
+ if (typeof id === 'number') {
1278
+ this.conversationId = id;
1279
+ }
1280
+ })
1281
+ .catch(() => { });
1282
+ }
1283
+ return response;
1224
1284
  });
1225
- }
1226
- return KRHttp.fetch({
1227
- url: '/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState',
1228
- method: 'POST',
1229
- headers: { Accept: 'text/event-stream' },
1230
- body: { userText: params.message },
1231
1285
  });
1232
1286
  };
1233
1287
  }
1234
1288
  this.send({
1235
1289
  message: params.message,
1236
1290
  messages: this.messages.slice(0, -1),
1237
- internalFiles: params.internalFiles,
1291
+ conversationFiles: params.conversationFiles,
1238
1292
  }).then((response) => {
1239
1293
  if (!response.ok) {
1240
1294
  this._handleStreamError('Request failed: ' + response.status);
@@ -1261,35 +1315,6 @@ let KRChatbot = class KRChatbot extends LitElement {
1261
1315
  }
1262
1316
  this._isStreaming = false;
1263
1317
  }
1264
- _handleClear() {
1265
- // Default to clearing the Kodaris Bedrock conversation state when the consumer
1266
- // hasn't provided their own `clear`.
1267
- if (!this.clear) {
1268
- this.clear = () => KRHttp.fetch({
1269
- url: '/api/system/integration/aws/bedrock/clearConversationWithState',
1270
- method: 'POST',
1271
- });
1272
- }
1273
- this.clear().then(() => {
1274
- if (this._reader) {
1275
- this._reader.cancel();
1276
- this._reader = null;
1277
- }
1278
- this.messages = [];
1279
- this._isStreaming = false;
1280
- this._error = '';
1281
- this._inputValue = '';
1282
- this._userHasScrolledUp = false;
1283
- // Reset conversation-scoped context + telemetry state for the new convo.
1284
- this._contextWarning = '';
1285
- this._contextLimitReached = false;
1286
- this._contextLimitMessage = '';
1287
- this._telemetry = null;
1288
- this._iterationLog = [];
1289
- this._cacheCheckpoints = {};
1290
- this._saveState();
1291
- });
1292
- }
1293
1318
  _handleMessagesScroll(e) {
1294
1319
  const container = e.target;
1295
1320
  const distanceFromBottom = container.scrollHeight - container.scrollTop - container.clientHeight;
@@ -1899,28 +1924,6 @@ let KRChatbot = class KRChatbot extends LitElement {
1899
1924
  </svg>
1900
1925
  </button>
1901
1926
  ` : nothing}
1902
- ${this.messages.length > 0 ? html `
1903
- <button
1904
- class="header-action"
1905
- @click=${this._handleClear}
1906
- title="Clear conversation"
1907
- >
1908
- <svg
1909
- xmlns="http://www.w3.org/2000/svg"
1910
- fill="none"
1911
- viewBox="0 0 24 24"
1912
- stroke-width="1.5"
1913
- stroke="currentColor"
1914
- class="header-action-icon"
1915
- >
1916
- <path
1917
- stroke-linecap="round"
1918
- stroke-linejoin="round"
1919
- d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"
1920
- />
1921
- </svg>
1922
- </button>
1923
- ` : nothing}
1924
1927
  ${this.variant === 'inline' ? nothing : html `
1925
1928
  <button
1926
1929
  class="header-action"
@@ -1965,9 +1968,9 @@ let KRChatbot = class KRChatbot extends LitElement {
1965
1968
  <div class="reasoning-content">${msg.reasoning}</div>
1966
1969
  </details>
1967
1970
  ` : nothing}
1968
- ${msg.internalFiles && msg.internalFiles.length ? html `
1971
+ ${msg.conversationFiles && msg.conversationFiles.length ? html `
1969
1972
  <div class="attachments">
1970
- ${msg.internalFiles.map((img) => html `
1973
+ ${msg.conversationFiles.map((img) => html `
1971
1974
  <button
1972
1975
  class="attachment"
1973
1976
  type="button"
@@ -1975,7 +1978,7 @@ let KRChatbot = class KRChatbot extends LitElement {
1975
1978
  @click=${() => this._openImage(img)}
1976
1979
  >
1977
1980
  <img
1978
- src="/api/system/integration/aws/bedrock/conversationImage/${img.internalFileID}/view"
1981
+ src="/api/system/conversationFile/${img.conversationFileID}/view"
1979
1982
  alt=${img.niceName || ''}
1980
1983
  />
1981
1984
  </button>
@@ -2093,9 +2096,9 @@ let KRChatbot = class KRChatbot extends LitElement {
2093
2096
  ` : nothing}
2094
2097
 
2095
2098
  <div class="footer">
2096
- ${this._pendingInternalFiles.length ? html `
2099
+ ${this._pendingConversationFiles.length ? html `
2097
2100
  <div class="composer-attachments">
2098
- ${repeat(this._pendingInternalFiles, (p) => p.localId, (p) => html `
2101
+ ${repeat(this._pendingConversationFiles, (p) => p.localId, (p) => html `
2099
2102
  <div class="chip">
2100
2103
  <img src=${p.previewUrl} alt=${p.name} />
2101
2104
  <button
@@ -3385,9 +3388,6 @@ KRChatbot.styles = css `
3385
3388
  __decorate([
3386
3389
  property({ attribute: false })
3387
3390
  ], KRChatbot.prototype, "send", void 0);
3388
- __decorate([
3389
- property({ attribute: false })
3390
- ], KRChatbot.prototype, "clear", void 0);
3391
3391
  __decorate([
3392
3392
  property({ attribute: false })
3393
3393
  ], KRChatbot.prototype, "load", void 0);
@@ -3419,6 +3419,13 @@ __decorate([
3419
3419
  reflect: true
3420
3420
  })
3421
3421
  ], KRChatbot.prototype, "variant", void 0);
3422
+ __decorate([
3423
+ property({
3424
+ type: Number,
3425
+ attribute: 'conversation-id',
3426
+ reflect: true
3427
+ })
3428
+ ], KRChatbot.prototype, "conversationId", void 0);
3422
3429
  __decorate([
3423
3430
  state()
3424
3431
  ], KRChatbot.prototype, "_inputValue", void 0);
@@ -3457,7 +3464,7 @@ __decorate([
3457
3464
  ], KRChatbot.prototype, "_isDebugResizing", void 0);
3458
3465
  __decorate([
3459
3466
  state()
3460
- ], KRChatbot.prototype, "_pendingInternalFiles", void 0);
3467
+ ], KRChatbot.prototype, "_pendingConversationFiles", void 0);
3461
3468
  __decorate([
3462
3469
  state()
3463
3470
  ], KRChatbot.prototype, "_isDraggingFile", void 0);