@trillet-ai/web-sdk 1.5.3 → 1.5.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/index.d.ts +1 -1
- package/dist/index.js +14 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
|
-
import { TrilletWebSDK } from './TrilletWebSDK';
|
|
3
|
-
import { TranscriptManager } from './TranscriptManager';
|
|
2
|
+
import { TrilletWebSDK } from './TrilletWebSDK.js';
|
|
3
|
+
import { TranscriptManager } from './TranscriptManager.js';
|
|
4
4
|
const TRILLET_API_URL = {
|
|
5
5
|
CONNECT: 'https://api.trillet.ai/v1/api/web-call',
|
|
6
6
|
PUBLIC_CONNECT: 'https://api.trillet.ai/v1/api/web-call/public',
|
|
@@ -289,15 +289,18 @@ export class TrilletAgent extends EventEmitter {
|
|
|
289
289
|
// Add user message to transcripts immediately
|
|
290
290
|
this.transcriptManager.addMessage('user', text, room.localParticipant.identity);
|
|
291
291
|
this.emit('transcriptUpdate', this.getTranscripts());
|
|
292
|
-
// Send
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
.
|
|
299
|
-
console.
|
|
292
|
+
// Send the raw text string over the data channel. The LiveKit agent framework
|
|
293
|
+
// is designed to receive this and process it as user input.
|
|
294
|
+
try {
|
|
295
|
+
const encoder = new TextEncoder();
|
|
296
|
+
const data = encoder.encode(text);
|
|
297
|
+
// We use publishData directly, which is what `sendText` wraps.
|
|
298
|
+
room.localParticipant.publishData(data, { reliable: true });
|
|
299
|
+
console.log('Text message sent to agent:', text);
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
console.error('Failed to send text message:', error);
|
|
300
303
|
this.emit('error', new Error(`Failed to send message: ${error instanceof Error ? error.message : String(error)}`));
|
|
301
|
-
}
|
|
304
|
+
}
|
|
302
305
|
}
|
|
303
306
|
}
|