@widgetic/chat 0.1.4 → 0.1.5

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/config.js CHANGED
@@ -27,7 +27,7 @@ if (!env.PUBLIC_PRODUCTION_URL) {
27
27
  throw new Error('PUBLIC_PRODUCTION_URL environment variable is not set');
28
28
  }
29
29
  // Create and export the config object with proper typing
30
- export var config = {
30
+ export const config = {
31
31
  API_URL: env.PUBLIC_API_URL,
32
32
  API_VERSION: env.PUBLIC_API_VERSION,
33
33
  INTERNAL_KEY: env.PUBLIC_INTERNAL_KEY,
@@ -43,23 +43,23 @@ export var config = {
43
43
  */
44
44
  export function createSdkConfig(options) {
45
45
  return new Configuration({
46
- apiKey: function (name) { return (options === null || options === void 0 ? void 0 : options.apiKey) || config.API_KEY || config.INTERNAL_KEY || ''; },
47
- basePath: (options === null || options === void 0 ? void 0 : options.basePath) || getApiUrl()
46
+ apiKey: (name) => options?.apiKey || config.API_KEY || config.INTERNAL_KEY || '',
47
+ basePath: options?.basePath || getApiUrl()
48
48
  });
49
49
  }
50
50
  /**
51
51
  * Gets the full API URL for the current environment
52
52
  */
53
53
  export function getApiUrl() {
54
- var baseUrl = config.NODE_ENV === 'production'
54
+ const baseUrl = config.NODE_ENV === 'production'
55
55
  ? config.PRODUCTION_URL
56
56
  : config.API_URL;
57
- return "".concat(baseUrl).concat(config.API_VERSION);
57
+ return `${baseUrl}${config.API_VERSION}`;
58
58
  }
59
59
  /**
60
60
  * Environment-specific settings
61
61
  */
62
- export var environment = {
62
+ export const environment = {
63
63
  isProduction: config.NODE_ENV === 'production',
64
64
  apiUrl: getApiUrl(),
65
65
  // Use API_KEY if available, fall back to INTERNAL_KEY
@@ -2,7 +2,7 @@
2
2
  * Message background colors for different states
3
3
  * These can be easily modified to change the appearance of messages
4
4
  */
5
- export var MESSAGE_COLORS = {
5
+ export const MESSAGE_COLORS = {
6
6
  /** Background color for user messages in completed chats */
7
7
  USER_COMPLETED: '#C6FFD3', // Light green
8
8
  /** Background color for user messages in active (non-completed) chats */
@@ -1,57 +1,12 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import { chatLog } from '../utils/logger.js';
49
- import { ConversationsApi, MessagesApi } from '@widgetic/api-sdk';
1
+ import { chatLog, chatWarn } from '../utils/logger.js';
2
+ import { ConversationsApi, MessagesApi, Configuration } from '@widgetic/api-sdk';
50
3
  /**
51
4
  * Chat service implementation using Widgetic API SDK
52
5
  */
53
- var WidgeticChatService = /** @class */ (function () {
54
- function WidgeticChatService(configuration) {
6
+ export class WidgeticChatService {
7
+ conversationsApi;
8
+ messagesApi;
9
+ constructor(configuration) {
55
10
  this.conversationsApi = new ConversationsApi(configuration);
56
11
  this.messagesApi = new MessagesApi(configuration);
57
12
  chatLog('ChatService initialized (mock mode)');
@@ -59,159 +14,116 @@ var WidgeticChatService = /** @class */ (function () {
59
14
  /**
60
15
  * Get all conversations for a given context (canvas + component)
61
16
  */
62
- WidgeticChatService.prototype.getConversations = function (contextId) {
63
- return __awaiter(this, void 0, Promise, function () {
64
- var _a, canvasId, componentId;
65
- return __generator(this, function (_b) {
66
- _a = this.parseContextId(contextId), canvasId = _a[0], componentId = _a[1];
67
- try {
68
- // Mock implementation for now
69
- chatLog('Getting conversations for:', { canvasId: canvasId, componentId: componentId });
70
- return [2 /*return*/, []];
71
- }
72
- catch (error) {
73
- console.error('Failed to get conversations:', error);
74
- throw new Error('Failed to load conversations');
75
- }
76
- return [2 /*return*/];
77
- });
78
- });
79
- };
17
+ async getConversations(contextId) {
18
+ const [canvasId, componentId] = this.parseContextId(contextId);
19
+ try {
20
+ // Mock implementation for now
21
+ chatLog('Getting conversations for:', { canvasId, componentId });
22
+ return [];
23
+ }
24
+ catch (error) {
25
+ console.error('Failed to get conversations:', error);
26
+ throw new Error('Failed to load conversations');
27
+ }
28
+ }
80
29
  /**
81
30
  * Create a new conversation
82
31
  */
83
- WidgeticChatService.prototype.createConversation = function (contextId, data) {
84
- return __awaiter(this, void 0, Promise, function () {
85
- var _a, canvasId, componentId, request, mockConversation;
86
- return __generator(this, function (_b) {
87
- _a = this.parseContextId(contextId), canvasId = _a[0], componentId = _a[1];
88
- request = {
89
- title: data.title || 'New Chat',
90
- completed: false
91
- };
92
- try {
93
- chatLog('Creating conversation:', { canvasId: canvasId, componentId: componentId, request: request });
94
- mockConversation = {
95
- id: "conv_".concat(Date.now()),
96
- title: request.title,
97
- completed: request.completed,
98
- createdAt: new Date(),
99
- updatedAt: new Date(),
100
- _unreadCount: 0,
101
- _lastActivity: new Date(),
102
- _isActive: false
103
- };
104
- return [2 /*return*/, mockConversation];
105
- }
106
- catch (error) {
107
- console.error('Failed to create conversation:', error);
108
- throw new Error('Failed to create conversation');
109
- }
110
- return [2 /*return*/];
111
- });
112
- });
113
- };
32
+ async createConversation(contextId, data) {
33
+ const [canvasId, componentId] = this.parseContextId(contextId);
34
+ const request = {
35
+ title: data.title || 'New Chat',
36
+ completed: false
37
+ };
38
+ try {
39
+ chatLog('Creating conversation:', { canvasId, componentId, request });
40
+ // Mock response
41
+ const mockConversation = {
42
+ id: `conv_${Date.now()}`,
43
+ title: request.title,
44
+ completed: request.completed,
45
+ createdAt: new Date(),
46
+ updatedAt: new Date(),
47
+ _unreadCount: 0,
48
+ _lastActivity: new Date(),
49
+ _isActive: false
50
+ };
51
+ return mockConversation;
52
+ }
53
+ catch (error) {
54
+ console.error('Failed to create conversation:', error);
55
+ throw new Error('Failed to create conversation');
56
+ }
57
+ }
114
58
  /**
115
59
  * Update an existing conversation
116
60
  */
117
- WidgeticChatService.prototype.updateConversation = function (conversationId, updates) {
118
- return __awaiter(this, void 0, Promise, function () {
119
- return __generator(this, function (_a) {
120
- // We need to extract canvas and component IDs from the conversation
121
- // This would typically be stored in the client state or passed differently
122
- throw new Error('Update conversation not yet implemented - need context IDs');
123
- });
124
- });
125
- };
61
+ async updateConversation(conversationId, updates) {
62
+ // We need to extract canvas and component IDs from the conversation
63
+ // This would typically be stored in the client state or passed differently
64
+ throw new Error('Update conversation not yet implemented - need context IDs');
65
+ }
126
66
  /**
127
67
  * Delete a conversation
128
68
  */
129
- WidgeticChatService.prototype.deleteConversation = function (conversationId) {
130
- return __awaiter(this, void 0, Promise, function () {
131
- return __generator(this, function (_a) {
132
- // Similar issue - need canvas and component IDs
133
- throw new Error('Delete conversation not yet implemented - need context IDs');
134
- });
135
- });
136
- };
69
+ async deleteConversation(conversationId) {
70
+ // Similar issue - need canvas and component IDs
71
+ throw new Error('Delete conversation not yet implemented - need context IDs');
72
+ }
137
73
  /**
138
74
  * Get all messages for a conversation
139
75
  */
140
- WidgeticChatService.prototype.getMessages = function (conversationId) {
141
- return __awaiter(this, void 0, Promise, function () {
142
- return __generator(this, function (_a) {
143
- try {
144
- chatLog('Getting messages for conversation:', conversationId);
145
- return [2 /*return*/, []];
146
- }
147
- catch (error) {
148
- console.error('Failed to get messages:', error);
149
- return [2 /*return*/, []];
150
- }
151
- return [2 /*return*/];
152
- });
153
- });
154
- };
76
+ async getMessages(conversationId) {
77
+ try {
78
+ chatLog('Getting messages for conversation:', conversationId);
79
+ return [];
80
+ }
81
+ catch (error) {
82
+ console.error('Failed to get messages:', error);
83
+ return [];
84
+ }
85
+ }
155
86
  /**
156
87
  * Send a new message
157
88
  */
158
- WidgeticChatService.prototype.sendMessage = function (conversationId, data) {
159
- return __awaiter(this, void 0, Promise, function () {
160
- var processedAttachments, i, attachment, input, stableUrl, url, _a, _b, url, request, mockMessage, error_1;
161
- var _c, _d, _e, _f;
162
- return __generator(this, function (_g) {
163
- switch (_g.label) {
164
- case 0:
165
- _g.trys.push([0, 11, , 12]);
166
- processedAttachments = [];
167
- if (!(data.attachments && data.attachments.length > 0)) return [3 /*break*/, 10];
168
- chatLog('Processing attachments:', data.attachments.length);
169
- i = 0;
170
- _g.label = 1;
171
- case 1:
172
- if (!(i < data.attachments.length)) return [3 /*break*/, 10];
173
- attachment = data.attachments[i];
174
- if (!(attachment && typeof attachment === 'object' && 'file' in attachment)) return [3 /*break*/, 6];
175
- input = attachment;
176
- stableUrl = input.uploadedUrl;
177
- _a = stableUrl;
178
- if (_a) return [3 /*break*/, 5];
179
- if (!input.file) return [3 /*break*/, 3];
180
- return [4 /*yield*/, this.fileToDataUrl(input.file)];
181
- case 2:
182
- _b = _g.sent();
183
- return [3 /*break*/, 4];
184
- case 3:
185
- _b = '';
186
- _g.label = 4;
187
- case 4:
188
- _a = (_b);
189
- _g.label = 5;
190
- case 5:
191
- url = _a;
89
+ async sendMessage(conversationId, data) {
90
+ try {
91
+ let processedAttachments = [];
92
+ if (data.attachments && data.attachments.length > 0) {
93
+ chatLog('Processing attachments:', data.attachments.length);
94
+ for (let i = 0; i < data.attachments.length; i++) {
95
+ const attachment = data.attachments[i];
96
+ if (attachment && typeof attachment === 'object' && 'file' in attachment) {
97
+ const input = attachment;
98
+ const isImage = (input.file?.type || '').startsWith('image/');
99
+ const stableUrl = input.uploadedUrl || (isImage ? input.preview : '') || (input.file && !isImage
100
+ ? URL.createObjectURL(input.file)
101
+ : (input.preview || ''));
102
+ const url = stableUrl || (input.file && isImage ? await this.fileToDataUrl(input.file) : '');
192
103
  processedAttachments.push({
193
- id: "att_".concat(Date.now(), "_").concat(i, "_").concat(Math.random().toString(36).substr(2, 9)),
194
- url: url,
195
- file_type: ((_c = input.file) === null || _c === void 0 ? void 0 : _c.type) || 'image/png',
196
- file_name: ((_d = input.file) === null || _d === void 0 ? void 0 : _d.name) || 'attachment',
197
- file_size: (_e = input.file) === null || _e === void 0 ? void 0 : _e.size,
104
+ id: `att_${Date.now()}_${i}_${Math.random().toString(36).substr(2, 9)}`,
105
+ url,
106
+ file_type: input.file?.type || 'image/png',
107
+ file_name: input.file?.name || 'attachment',
108
+ file_size: input.file?.size,
198
109
  metadata: {
199
- originalName: (_f = input.file) === null || _f === void 0 ? void 0 : _f.name,
110
+ originalName: input.file?.name,
200
111
  uploadedAt: new Date().toISOString(),
201
112
  storage: stableUrl ? 'upload-service' : 'inline-data-url',
202
113
  },
203
114
  created_at: new Date().toISOString(),
204
115
  display_order: i + 1,
205
116
  });
206
- return [3 /*break*/, 9];
207
- case 6:
208
- if (!(attachment instanceof File)) return [3 /*break*/, 8];
209
- return [4 /*yield*/, this.fileToDataUrl(attachment)];
210
- case 7:
211
- url = _g.sent();
117
+ continue;
118
+ }
119
+ if (attachment instanceof File) {
120
+ const isImage = attachment.type.startsWith('image/');
121
+ const url = isImage
122
+ ? await this.fileToDataUrl(attachment)
123
+ : URL.createObjectURL(attachment);
212
124
  processedAttachments.push({
213
- id: "att_".concat(Date.now(), "_").concat(i, "_").concat(Math.random().toString(36).substr(2, 9)),
214
- url: url,
125
+ id: `att_${Date.now()}_${i}_${Math.random().toString(36).substr(2, 9)}`,
126
+ url,
215
127
  file_type: attachment.type,
216
128
  file_name: attachment.name,
217
129
  file_size: attachment.size,
@@ -223,130 +135,107 @@ var WidgeticChatService = /** @class */ (function () {
223
135
  created_at: new Date().toISOString(),
224
136
  display_order: i + 1,
225
137
  });
226
- return [3 /*break*/, 9];
227
- case 8:
138
+ }
139
+ else {
228
140
  processedAttachments.push(attachment);
229
- _g.label = 9;
230
- case 9:
231
- i++;
232
- return [3 /*break*/, 1];
233
- case 10:
234
- request = {
235
- messageContent: data.messageContent,
236
- messageType: 'user',
237
- attachments: processedAttachments
238
- };
239
- chatLog('Sending message:', { conversationId: conversationId, request: request });
240
- mockMessage = {
241
- id: "msg_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9)),
242
- conversationId: conversationId,
243
- messageContent: data.messageContent,
244
- messageType: 'user',
245
- attachments: processedAttachments,
246
- isCommit: false,
247
- userId: 'test_user',
248
- createdAt: new Date(),
249
- updatedAt: new Date(),
250
- _optimistic: false,
251
- _failed: false,
252
- _retryCount: 0
253
- };
254
- chatLog('Mock message created:', mockMessage);
255
- return [2 /*return*/, mockMessage];
256
- case 11:
257
- error_1 = _g.sent();
258
- console.error('Failed to send message:', error_1);
259
- throw new Error('Failed to send message');
260
- case 12: return [2 /*return*/];
141
+ }
261
142
  }
262
- });
263
- });
264
- };
143
+ }
144
+ const request = {
145
+ messageContent: data.messageContent,
146
+ messageType: 'user',
147
+ attachments: processedAttachments
148
+ };
149
+ chatLog('Sending message:', { conversationId, request });
150
+ // Mock response
151
+ const mockMessage = {
152
+ id: `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
153
+ conversationId,
154
+ messageContent: data.messageContent,
155
+ messageType: 'user',
156
+ attachments: processedAttachments,
157
+ isCommit: false,
158
+ userId: 'test_user',
159
+ createdAt: new Date(),
160
+ updatedAt: new Date(),
161
+ _optimistic: false,
162
+ _failed: false,
163
+ _retryCount: 0
164
+ };
165
+ chatLog('Mock message created:', mockMessage);
166
+ return mockMessage;
167
+ }
168
+ catch (error) {
169
+ console.error('Failed to send message:', error);
170
+ throw new Error('Failed to send message');
171
+ }
172
+ }
265
173
  /**
266
174
  * Update a message
267
175
  */
268
- WidgeticChatService.prototype.updateMessage = function (messageId, updates) {
269
- return __awaiter(this, void 0, Promise, function () {
270
- return __generator(this, function (_a) {
271
- chatLog('Update message not yet implemented:', messageId, updates);
272
- throw new Error('Update message not yet implemented');
273
- });
274
- });
275
- };
176
+ async updateMessage(messageId, updates) {
177
+ chatLog('Update message not yet implemented:', messageId, updates);
178
+ throw new Error('Update message not yet implemented');
179
+ }
276
180
  /**
277
181
  * Delete a message
278
182
  */
279
- WidgeticChatService.prototype.deleteMessage = function (messageId) {
280
- return __awaiter(this, void 0, Promise, function () {
281
- return __generator(this, function (_a) {
282
- chatLog('Delete message not yet implemented:', messageId);
283
- throw new Error('Delete message not yet implemented');
284
- });
285
- });
286
- };
183
+ async deleteMessage(messageId) {
184
+ chatLog('Delete message not yet implemented:', messageId);
185
+ throw new Error('Delete message not yet implemented');
186
+ }
287
187
  /**
288
188
  * Read a file as a data URL (persistable in DB until upload service exists).
289
189
  */
290
- WidgeticChatService.prototype.fileToDataUrl = function (file) {
291
- return __awaiter(this, void 0, Promise, function () {
292
- return __generator(this, function (_a) {
293
- chatLog('Reading attachment as data URL:', file.name);
294
- return [2 /*return*/, new Promise(function (resolve, reject) {
295
- var reader = new FileReader();
296
- reader.onload = function () { return resolve(String(reader.result)); };
297
- reader.onerror = function () { return reject(reader.error); };
298
- reader.readAsDataURL(file);
299
- })];
300
- });
190
+ async fileToDataUrl(file) {
191
+ chatLog('Reading attachment as data URL:', file.name);
192
+ return new Promise((resolve, reject) => {
193
+ const reader = new FileReader();
194
+ reader.onload = () => resolve(String(reader.result));
195
+ reader.onerror = () => reject(reader.error);
196
+ reader.readAsDataURL(file);
301
197
  });
302
- };
198
+ }
303
199
  /** @deprecated Use fileToDataUrl — blob URLs are not reload-safe */
304
- WidgeticChatService.prototype.uploadFile = function (file) {
305
- return __awaiter(this, void 0, Promise, function () {
306
- return __generator(this, function (_a) {
307
- return [2 /*return*/, this.fileToDataUrl(file)];
308
- });
309
- });
310
- };
200
+ async uploadFile(file) {
201
+ return this.fileToDataUrl(file);
202
+ }
311
203
  /**
312
204
  * Process AI response (placeholder for LLM integration)
313
205
  */
314
- WidgeticChatService.prototype.processAIResponse = function (conversationId, message) {
315
- return __awaiter(this, void 0, Promise, function () {
316
- var aiResponse;
317
- return __generator(this, function (_a) {
318
- switch (_a.label) {
319
- case 0:
320
- // This would integrate with the AI service to generate responses
321
- // For now, return a mock response
322
- // Add a small delay to ensure unique timestamp
323
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 10); })];
324
- case 1:
325
- // This would integrate with the AI service to generate responses
326
- // For now, return a mock response
327
- // Add a small delay to ensure unique timestamp
328
- _a.sent();
329
- aiResponse = __assign(__assign({}, message), { id: "ai_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9)), messageType: 'assistant', messageContent: "AI response to: ".concat(message.messageContent || '[attachment only]'), createdAt: new Date(), updatedAt: new Date(), userId: 'ai_assistant', attachments: [], _optimistic: false, _failed: false, _retryCount: 0 });
330
- chatLog('AI response generated:', aiResponse);
331
- return [2 /*return*/, aiResponse];
332
- }
333
- });
334
- });
335
- };
206
+ async processAIResponse(conversationId, message) {
207
+ // This would integrate with the AI service to generate responses
208
+ // For now, return a mock response
209
+ // Add a small delay to ensure unique timestamp
210
+ await new Promise(resolve => setTimeout(resolve, 10));
211
+ const aiResponse = {
212
+ ...message,
213
+ id: `ai_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
214
+ messageType: 'assistant',
215
+ messageContent: `AI response to: ${message.messageContent || '[attachment only]'}`,
216
+ createdAt: new Date(),
217
+ updatedAt: new Date(),
218
+ userId: 'ai_assistant',
219
+ attachments: [], // AI response doesn't inherit user attachments
220
+ _optimistic: false,
221
+ _failed: false,
222
+ _retryCount: 0
223
+ };
224
+ chatLog('AI response generated:', aiResponse);
225
+ return aiResponse;
226
+ }
336
227
  /**
337
228
  * Parse context ID to extract canvas and component IDs.
338
229
  * Supports "canvas_id:component_id" format or a single ID (used as both).
339
230
  */
340
- WidgeticChatService.prototype.parseContextId = function (contextId) {
341
- var parts = contextId.split(':');
231
+ parseContextId(contextId) {
232
+ const parts = contextId.split(':');
342
233
  if (parts.length === 2) {
343
234
  return [parts[0], parts[1]];
344
235
  }
345
236
  return [contextId, contextId];
346
- };
347
- return WidgeticChatService;
348
- }());
349
- export { WidgeticChatService };
237
+ }
238
+ }
350
239
  /**
351
240
  * Create a chat service instance with the given configuration
352
241
  */
@@ -24,6 +24,7 @@ export declare const chatStore: {
24
24
  setMessages: (conversationId: string, messages: ChatMessage[]) => void;
25
25
  updateMessageId: (conversationId: string, oldId: string, newId: string) => void;
26
26
  updateMessageContent: (conversationId: string, messageId: string, messageContent: string) => void;
27
+ updateMessageAttachments: (conversationId: string, messageId: string, attachments: any[]) => void;
27
28
  };
28
29
  };
29
30
  /**