@trillet-ai/web-sdk 1.5.1 → 1.5.2

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 +4 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -236,24 +236,22 @@ export class TrilletAgent extends EventEmitter {
236
236
  return this.currentTranscript;
237
237
  }
238
238
  sendTextMessage(text) {
239
- var _a, _b;
240
239
  if (this.config.mode !== 'text') {
241
240
  console.warn('Cannot send text message in voice mode.');
242
241
  return;
243
242
  }
244
- if (!this.sdk.getRoom() || !this.sdk.isConnected) {
243
+ const room = this.sdk.getRoom();
244
+ if (!room || !this.sdk.isConnected) {
245
245
  this.emit('error', new Error('Not connected. Cannot send message.'));
246
246
  return;
247
247
  }
248
- const payload = { type: 'user_message', message: text };
249
- const encoder = new TextEncoder();
250
- (_a = this.sdk.getRoom()) === null || _a === void 0 ? void 0 : _a.localParticipant.publishData(encoder.encode(JSON.stringify(payload)), { reliable: true });
248
+ room.localParticipant.sendText(text);
251
249
  this.transcripts.push({
252
250
  role: 'user',
253
251
  text,
254
252
  isFinal: true,
255
253
  timestamp: new Date(),
256
- participantId: (_b = this.sdk.getRoom()) === null || _b === void 0 ? void 0 : _b.localParticipant.identity,
254
+ participantId: room.localParticipant.identity,
257
255
  });
258
256
  this.emit('transcriptUpdate', this.transcripts);
259
257
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trillet-ai/web-sdk",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Trillet Web SDK for real-time audio communication with AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",