@kodaris/krubble-app-components 1.0.85 → 1.0.87

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. */
@@ -317,16 +323,32 @@ let KRChatbot = class KRChatbot extends LitElement {
317
323
  // --- Lifecycle ---
318
324
  connectedCallback() {
319
325
  super.connectedCallback();
320
- // Default to loading existing messages from the Kodaris Bedrock conversation
321
- // when the consumer hasn't provided their own `load`. The endpoint returns
322
- // messages already in KRChatbotMessage shape ({ type, content, images }), so
323
- // they pass straight through.
326
+ // Default to loading a specific conversation's messages when the consumer
327
+ // hasn't provided their own `load`. With `conversationId` set we rebuild that
328
+ // conversation from `/conversation/{id}/messages`; with none set there's
329
+ // nothing to resume, so start empty. Rows already match KRChatbotMessage
330
+ // ({ type, content }); we only parse each row's `conversationFileIDs` (a JSON
331
+ // array string of ids) into the `conversationFiles` the render iterates.
324
332
  if (!this.load) {
325
- this.load = () => KRHttp.fetch({
326
- url: '/api/system/integration/aws/bedrock/getConversationMessages',
327
- })
328
- .then((r) => r.json())
329
- .then((res) => res.data || []);
333
+ this.load = () => {
334
+ if (this.conversationId == null) {
335
+ return Promise.resolve([]);
336
+ }
337
+ return KRHttp.fetch({
338
+ url: `/api/system/conversation/${this.conversationId}/messages`,
339
+ })
340
+ .then((r) => r.json())
341
+ .then((res) => (res?.data || []).map((msg) => {
342
+ try {
343
+ const ids = JSON.parse(msg.conversationFileIDs || '[]');
344
+ if (ids.length) {
345
+ msg.conversationFiles = ids.map((id) => ({ conversationFileID: id }));
346
+ }
347
+ }
348
+ catch { /* no/invalid attachments — leave empty */ }
349
+ return msg;
350
+ }));
351
+ };
330
352
  }
331
353
  this.load().then((messages) => {
332
354
  if (messages && messages.length) {
@@ -361,7 +383,7 @@ let KRChatbot = class KRChatbot extends LitElement {
361
383
  document.removeEventListener('mousemove', this._handleMouseMove);
362
384
  document.removeEventListener('mouseup', this._handleMouseUp);
363
385
  // Release any object URLs still held by staged attachments.
364
- this._pendingInternalFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
386
+ this._pendingConversationFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
365
387
  }
366
388
  updated(changed) {
367
389
  if (changed.has('messages')) {
@@ -694,7 +716,7 @@ let KRChatbot = class KRChatbot extends LitElement {
694
716
  this._skillMenuOpened = false;
695
717
  this._send({
696
718
  message: '/test-context-warning',
697
- internalFiles: [],
719
+ conversationFiles: [],
698
720
  });
699
721
  return;
700
722
  }
@@ -702,7 +724,7 @@ let KRChatbot = class KRChatbot extends LitElement {
702
724
  this._skillMenuOpened = false;
703
725
  this._send({
704
726
  message: '/test-context-limit',
705
- internalFiles: [],
727
+ conversationFiles: [],
706
728
  });
707
729
  return;
708
730
  }
@@ -1019,6 +1041,10 @@ let KRChatbot = class KRChatbot extends LitElement {
1019
1041
  }
1020
1042
  // --- Attachments ---
1021
1043
  _openFilePicker() {
1044
+ // Close the skill/attachment menu — opening the OS file picker is the end of
1045
+ // the menu interaction, and the picker is a separate window so the menu would
1046
+ // otherwise linger open behind it (and after a file is chosen).
1047
+ this._skillMenuOpened = false;
1022
1048
  this._fileInputEl?.click();
1023
1049
  }
1024
1050
  _handleFileInputChange(e) {
@@ -1100,49 +1126,49 @@ let KRChatbot = class KRChatbot extends LitElement {
1100
1126
  name: file.name,
1101
1127
  previewUrl: URL.createObjectURL(file),
1102
1128
  };
1103
- this._pendingInternalFiles = [...this._pendingInternalFiles, pending];
1129
+ this._pendingConversationFiles = [...this._pendingConversationFiles, pending];
1104
1130
  });
1105
1131
  }
1106
1132
  _removePending(localId) {
1107
- const target = this._pendingInternalFiles.find((p) => p.localId === localId);
1133
+ const target = this._pendingConversationFiles.find((p) => p.localId === localId);
1108
1134
  if (target) {
1109
1135
  URL.revokeObjectURL(target.previewUrl);
1110
1136
  }
1111
- this._pendingInternalFiles = this._pendingInternalFiles.filter((p) => p.localId !== localId);
1137
+ this._pendingConversationFiles = this._pendingConversationFiles.filter((p) => p.localId !== localId);
1112
1138
  }
1113
1139
  _clearPending() {
1114
- this._pendingInternalFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
1115
- this._pendingInternalFiles = [];
1140
+ this._pendingConversationFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
1141
+ this._pendingConversationFiles = [];
1116
1142
  }
1117
1143
  /** Open the shared full-screen previewer for a message image. */
1118
1144
  _openImage(img) {
1119
1145
  KRFilePreview.open({
1120
- src: `/api/system/integration/aws/bedrock/conversationImage/${img.internalFileID}/view`,
1146
+ src: `/api/system/conversationFile/${img.conversationFileID}/view`,
1121
1147
  name: img.niceName || 'image',
1122
1148
  });
1123
1149
  }
1124
1150
  /** Whether the send button is active: needs text or at least one image. */
1125
1151
  _canSend() {
1126
- return Boolean(this._inputValue.trim()) || this._pendingInternalFiles.length > 0;
1152
+ return Boolean(this._inputValue.trim()) || this._pendingConversationFiles.length > 0;
1127
1153
  }
1128
1154
  _handleSubmit() {
1129
1155
  if (this._isStreaming) {
1130
1156
  return;
1131
1157
  }
1132
1158
  const messageText = this._inputValue.trim();
1133
- const pending = this._pendingInternalFiles;
1159
+ const pending = this._pendingConversationFiles;
1134
1160
  // Allow sending an image with no text, but require at least one of them.
1135
1161
  if (!messageText && !pending.length) {
1136
1162
  return;
1137
1163
  }
1138
1164
  // 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
1165
+ // conversation reloads and they come back as stored conversation files; the
1140
1166
  // just-sent message itself carries text only.
1141
- const internalFiles = pending.map((p) => p.file);
1167
+ const conversationFiles = pending.map((p) => p.file);
1142
1168
  const submitEvent = new CustomEvent('message-submit', {
1143
1169
  detail: {
1144
1170
  message: messageText,
1145
- internalFiles,
1171
+ conversationFiles,
1146
1172
  },
1147
1173
  bubbles: true,
1148
1174
  composed: true,
@@ -1154,7 +1180,7 @@ let KRChatbot = class KRChatbot extends LitElement {
1154
1180
  }
1155
1181
  this._send({
1156
1182
  message: messageText,
1157
- internalFiles
1183
+ conversationFiles
1158
1184
  });
1159
1185
  }
1160
1186
  /**
@@ -1174,8 +1200,8 @@ let KRChatbot = class KRChatbot extends LitElement {
1174
1200
  this._error = '';
1175
1201
  this._userHasScrolledUp = false;
1176
1202
  // Clear the composer and release its preview object URLs.
1177
- this._pendingInternalFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
1178
- this._pendingInternalFiles = [];
1203
+ this._pendingConversationFiles.forEach((p) => URL.revokeObjectURL(p.previewUrl));
1204
+ this._pendingConversationFiles = [];
1179
1205
  // Reset textarea height
1180
1206
  if (this._inputEl) {
1181
1207
  this._inputEl.style.height = 'auto';
@@ -1211,30 +1237,74 @@ let KRChatbot = class KRChatbot extends LitElement {
1211
1237
  // the consumer hasn't provided their own `send`.
1212
1238
  if (!this.send) {
1213
1239
  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));
1240
+ // Images are upload-first: each file is stored as a conversation file
1241
+ // (type LIBRARY — the format lives in mimeType), then the resulting
1242
+ // conversationFileIDs are attached to the message via `fileIds` on the
1243
+ // normal JSON stream call. There is no multipart chat endpoint. With no
1244
+ // images the upload resolves to an empty list immediately; a failed
1245
+ // upload is dropped so an undefined id never reaches `fileIds`.
1246
+ let uploaded = Promise.resolve([]);
1247
+ if (params.conversationFiles.length) {
1248
+ uploaded = Promise.all(params.conversationFiles.map((file) => {
1249
+ const form = new FormData();
1250
+ form.append('file', file);
1251
+ form.append('type', 'LIBRARY');
1252
+ form.append('niceName', file.name);
1253
+ return KRHttp.fetch({
1254
+ url: '/api/system/conversationFile/upload',
1255
+ method: 'POST',
1256
+ body: form,
1257
+ })
1258
+ .then((r) => r.json())
1259
+ .then((res) => res?.data?.conversationFileID);
1260
+ })).then((ids) => ids.filter((id) => typeof id === 'number'));
1261
+ }
1262
+ return uploaded.then((fileIds) => {
1263
+ // Conversation targeting: continue `conversationId` when set, else
1264
+ // start a fresh conversation (createNew) for this turn. The pin below
1265
+ // means createNew only fires on the very first untargeted turn.
1266
+ const body = {
1267
+ userText: params.message,
1268
+ fileIds,
1269
+ };
1270
+ if (this.conversationId != null) {
1271
+ body.conversationID = this.conversationId;
1272
+ }
1273
+ else {
1274
+ body.createNew = true;
1275
+ }
1219
1276
  return KRHttp.fetch({
1220
- url: '/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithImages',
1277
+ url: '/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState',
1221
1278
  method: 'POST',
1222
1279
  headers: { Accept: 'text/event-stream' },
1223
- body: form,
1280
+ body,
1281
+ }).then((response) => {
1282
+ // Pin the session to the conversation this turn used. The stream
1283
+ // doesn't echo the resolved id, so when we let the server create one
1284
+ // (no conversationId set) we resolve it via `/last` and keep it, so
1285
+ // subsequent turns continue this conversation instead of each sending
1286
+ // createNew and spawning a new one. Best-effort, fire-and-forget: a
1287
+ // failure leaves it unpinned and the next turn resolves server-side.
1288
+ if (this.conversationId == null) {
1289
+ KRHttp.fetch({ url: '/api/system/conversation/last' })
1290
+ .then((r) => r.json())
1291
+ .then((res) => {
1292
+ const id = res?.data?.conversationID;
1293
+ if (typeof id === 'number') {
1294
+ this.conversationId = id;
1295
+ }
1296
+ })
1297
+ .catch(() => { });
1298
+ }
1299
+ return response;
1224
1300
  });
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
1301
  });
1232
1302
  };
1233
1303
  }
1234
1304
  this.send({
1235
1305
  message: params.message,
1236
1306
  messages: this.messages.slice(0, -1),
1237
- internalFiles: params.internalFiles,
1307
+ conversationFiles: params.conversationFiles,
1238
1308
  }).then((response) => {
1239
1309
  if (!response.ok) {
1240
1310
  this._handleStreamError('Request failed: ' + response.status);
@@ -1261,35 +1331,6 @@ let KRChatbot = class KRChatbot extends LitElement {
1261
1331
  }
1262
1332
  this._isStreaming = false;
1263
1333
  }
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
1334
  _handleMessagesScroll(e) {
1294
1335
  const container = e.target;
1295
1336
  const distanceFromBottom = container.scrollHeight - container.scrollTop - container.clientHeight;
@@ -1899,28 +1940,6 @@ let KRChatbot = class KRChatbot extends LitElement {
1899
1940
  </svg>
1900
1941
  </button>
1901
1942
  ` : 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
1943
  ${this.variant === 'inline' ? nothing : html `
1925
1944
  <button
1926
1945
  class="header-action"
@@ -1965,9 +1984,9 @@ let KRChatbot = class KRChatbot extends LitElement {
1965
1984
  <div class="reasoning-content">${msg.reasoning}</div>
1966
1985
  </details>
1967
1986
  ` : nothing}
1968
- ${msg.internalFiles && msg.internalFiles.length ? html `
1987
+ ${msg.conversationFiles && msg.conversationFiles.length ? html `
1969
1988
  <div class="attachments">
1970
- ${msg.internalFiles.map((img) => html `
1989
+ ${msg.conversationFiles.map((img) => html `
1971
1990
  <button
1972
1991
  class="attachment"
1973
1992
  type="button"
@@ -1975,7 +1994,7 @@ let KRChatbot = class KRChatbot extends LitElement {
1975
1994
  @click=${() => this._openImage(img)}
1976
1995
  >
1977
1996
  <img
1978
- src="/api/system/integration/aws/bedrock/conversationImage/${img.internalFileID}/view"
1997
+ src="/api/system/conversationFile/${img.conversationFileID}/view"
1979
1998
  alt=${img.niceName || ''}
1980
1999
  />
1981
2000
  </button>
@@ -2093,9 +2112,9 @@ let KRChatbot = class KRChatbot extends LitElement {
2093
2112
  ` : nothing}
2094
2113
 
2095
2114
  <div class="footer">
2096
- ${this._pendingInternalFiles.length ? html `
2115
+ ${this._pendingConversationFiles.length ? html `
2097
2116
  <div class="composer-attachments">
2098
- ${repeat(this._pendingInternalFiles, (p) => p.localId, (p) => html `
2117
+ ${repeat(this._pendingConversationFiles, (p) => p.localId, (p) => html `
2099
2118
  <div class="chip">
2100
2119
  <img src=${p.previewUrl} alt=${p.name} />
2101
2120
  <button
@@ -3385,9 +3404,6 @@ KRChatbot.styles = css `
3385
3404
  __decorate([
3386
3405
  property({ attribute: false })
3387
3406
  ], KRChatbot.prototype, "send", void 0);
3388
- __decorate([
3389
- property({ attribute: false })
3390
- ], KRChatbot.prototype, "clear", void 0);
3391
3407
  __decorate([
3392
3408
  property({ attribute: false })
3393
3409
  ], KRChatbot.prototype, "load", void 0);
@@ -3419,6 +3435,13 @@ __decorate([
3419
3435
  reflect: true
3420
3436
  })
3421
3437
  ], KRChatbot.prototype, "variant", void 0);
3438
+ __decorate([
3439
+ property({
3440
+ type: Number,
3441
+ attribute: 'conversation-id',
3442
+ reflect: true
3443
+ })
3444
+ ], KRChatbot.prototype, "conversationId", void 0);
3422
3445
  __decorate([
3423
3446
  state()
3424
3447
  ], KRChatbot.prototype, "_inputValue", void 0);
@@ -3457,7 +3480,7 @@ __decorate([
3457
3480
  ], KRChatbot.prototype, "_isDebugResizing", void 0);
3458
3481
  __decorate([
3459
3482
  state()
3460
- ], KRChatbot.prototype, "_pendingInternalFiles", void 0);
3483
+ ], KRChatbot.prototype, "_pendingConversationFiles", void 0);
3461
3484
  __decorate([
3462
3485
  state()
3463
3486
  ], KRChatbot.prototype, "_isDraggingFile", void 0);