Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/AnamClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,27 @@ export default class AnamClient {
this.sendDataMessage(body);
}

public interruptPersona(): void {
if (!this._isStreaming) {
throw new Error(
'Failed to send interrupt command: not currently streaming',
);
}

const sessionId = this.getActiveSessionId();
if (!sessionId) {
throw new Error('Failed to send interrupt command: no active session');
}

const body = JSON.stringify({
message_type: 'interrupt',
session_id: sessionId,
timestamp: new Date().toISOString(), // removing Z not needed
});

this.sendDataMessage(body);
}

public async stopStreaming(): Promise<void> {
if (this.streamingClient) {
this.publicEventEmitter.emit(
Expand Down