convo-ai-sdk 1.1.4 → 1.1.6

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -189,7 +189,7 @@ export class ChatClient {
189
189
  }
190
190
  const widgetMessage = {
191
191
  id: `widget-${Date.now()}`,
192
- data: { widgetType: widgetType, content: widgetData },
192
+ data: { widgetType: widgetType, widgetData: widgetData },
193
193
  from: 'widget',
194
194
  timestamp: Date.now(),
195
195
  };
@@ -239,6 +239,9 @@ export class ChatClient {
239
239
  input.toolCallId = message.data.toolCallId;
240
240
  input.toolName = message.data.toolCallName;
241
241
  }
242
+ if (message.from === 'widget') {
243
+ input.content = JSON.stringify(message.data);
244
+ }
242
245
  const response = await fetch(this.config.streamApiEndpoint + 'conversation', {
243
246
  method: 'POST',
244
247
  headers: {
@@ -279,10 +282,10 @@ export class ChatClient {
279
282
  }
280
283
  const data = JSON.parse(line.substring(7));
281
284
  currentMessage = {
282
- id: data.messageId,
283
- data: { content: '' },
284
- from: 'assistant',
285
- timestamp: data.timestamp || Date.now(),
285
+ id: data.message.messageId,
286
+ data: { content: data.message?.data?.content || '' },
287
+ from: data.message.senderType,
288
+ timestamp: data.message.timestamp || Date.now(),
286
289
  };
287
290
  this._emit('messageStart', currentMessage);
288
291
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "convo-ai-sdk",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",