@@ -232,6 +232,8 @@ export class PipecatClient extends RTVIEventEmitter {
232232 private _uiSnapshotStreamer : A11ySnapshotStreamer | undefined ;
233233 private _pendingUISnapshot : A11ySnapshot | undefined ;
234234
235+ private _botVersion : number [ ] = [ 0 , 0 , 0 ] ;
236+
235237 private _botTranscriptionWarned = false ;
236238 private _llmFunctionCallWarned = false ;
237239
@@ -1167,6 +1169,14 @@ export class PipecatClient extends RTVIEventEmitter {
11671169 content : string ,
11681170 options : SendFileOptions = { }
11691171 ) {
1172+ if (
1173+ this . _botVersion [ 0 ] < 1 ||
1174+ ( this . _botVersion [ 0 ] === 1 && this . _botVersion [ 1 ] < 3 )
1175+ ) {
1176+ throw new RTVIErrors . RTVIError (
1177+ "sendFile() is not supported for bot versions less than 1.3.0"
1178+ ) ;
1179+ }
11701180 let rtvi_file = file instanceof File ? ( { } as RTVIFile ) : file ;
11711181 let mimeType : string =
11721182 file instanceof File ? file . type : rtvi_file . format . toLowerCase ( ) ;
@@ -1346,12 +1356,12 @@ export class PipecatClient extends RTVIEventEmitter {
13461356 switch ( ev . type ) {
13471357 case RTVIMessageType . BOT_READY : {
13481358 const data = ev . data as BotReadyData ;
1349- const botVersion = data . version
1350- ? data . version . split ( "." ) . map ( Number )
1359+ this . _botVersion = data . version
1360+ ? ( data . version . split ( "." ) . map ( Number ) as number [ ] )
13511361 : [ 0 , 0 , 0 ] ;
13521362 this . _botVersion = botVersion ;
13531363 logger . debug ( `[Pipecat Client] Bot is ready. Version: ${ data . version } ` ) ;
1354- if ( botVersion [ 0 ] < 2 ) {
1364+ if ( this . _botVersion [ 0 ] < 2 ) {
13551365 logger . warn (
13561366 `[Pipecat Client] Bot protocol version ${ data . version } is older than this client (${ RTVI_PROTOCOL_VERSION } ). Compatibility issues may occur.`
13571367 ) ;
0 commit comments