File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,27 @@ export default class AnamClient {
448448 this . sendDataMessage ( body ) ;
449449 }
450450
451+ public interruptPersona ( ) : void {
452+ if ( ! this . _isStreaming ) {
453+ throw new Error (
454+ 'Failed to send interrupt command: not currently streaming' ,
455+ ) ;
456+ }
457+
458+ const sessionId = this . getActiveSessionId ( ) ;
459+ if ( ! sessionId ) {
460+ throw new Error ( 'Failed to send interrupt command: no active session' ) ;
461+ }
462+
463+ const body = JSON . stringify ( {
464+ message_type : 'interrupt' ,
465+ session_id : sessionId ,
466+ timestamp : new Date ( ) . toISOString ( ) , // removing Z not needed
467+ } ) ;
468+
469+ this . sendDataMessage ( body ) ;
470+ }
471+
451472 public async stopStreaming ( ) : Promise < void > {
452473 if ( this . streamingClient ) {
453474 this . publicEventEmitter . emit (
You can’t perform that action at this time.
0 commit comments