@trillet-ai/web-sdk 1.5.5 → 1.5.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -42,5 +42,5 @@ export declare class TrilletAgent extends EventEmitter {
|
|
|
42
42
|
* @param responseTimeout - Timeout in milliseconds (default: 30000)
|
|
43
43
|
*/
|
|
44
44
|
sendRpcMessage(method: string, payload: any, responseTimeout?: number): Promise<any>;
|
|
45
|
-
sendTextMessage(text: string): void
|
|
45
|
+
sendTextMessage(text: string): Promise<void>;
|
|
46
46
|
}
|
package/dist/index.js
CHANGED
|
@@ -276,7 +276,7 @@ export class TrilletAgent extends EventEmitter {
|
|
|
276
276
|
throw error;
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
sendTextMessage(text) {
|
|
279
|
+
async sendTextMessage(text) {
|
|
280
280
|
if (this.config.mode !== 'text') {
|
|
281
281
|
console.warn('Cannot send text message in voice mode.');
|
|
282
282
|
return;
|
|
@@ -289,13 +289,9 @@ 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 the
|
|
293
|
-
// is designed to receive this and process it as user input.
|
|
292
|
+
// Send the text message using LiveKit's sendText API with topic 'lk.chat'.
|
|
294
293
|
try {
|
|
295
|
-
|
|
296
|
-
const data = encoder.encode(text);
|
|
297
|
-
// We use publishData directly, which is what `sendText` wraps.
|
|
298
|
-
room.localParticipant.publishData(data, { reliable: true });
|
|
294
|
+
await room.localParticipant.sendText(text, { topic: 'lk.chat' });
|
|
299
295
|
console.log('Text message sent to agent:', text);
|
|
300
296
|
}
|
|
301
297
|
catch (error) {
|