@@ -142,10 +142,10 @@ export class AvatarSession {
142142 this . agentImageUrl = options . agentImageUrl ?? null ;
143143
144144 if ( ! this . agentId && ! this . agentImageUrl ) {
145- throw new LemonSliceException ( 'Missing agent_id or agent_image_url ' ) ;
145+ throw new LemonSliceException ( 'Missing agentId or agentImageUrl ' ) ;
146146 }
147147 if ( this . agentId && this . agentImageUrl ) {
148- throw new LemonSliceException ( 'Only one of agent_id or agent_image_url can be provided' ) ;
148+ throw new LemonSliceException ( 'Only one of agentId or agentImageUrl can be provided' ) ;
149149 }
150150
151151 this . agentPrompt = options . agentPrompt ?? null ;
@@ -198,7 +198,7 @@ export class AvatarSession {
198198 let localParticipantIdentity : string ;
199199 try {
200200 const jobCtx = getJobContext ( ) ;
201- localParticipantIdentity = jobCtx . job . participant ?. identity || '' ;
201+ localParticipantIdentity = jobCtx . agent ?. identity || '' ;
202202 if ( ! localParticipantIdentity && room . localParticipant ) {
203203 localParticipantIdentity = room . localParticipant . identity ;
204204 }
@@ -243,7 +243,7 @@ export class AvatarSession {
243243 }
244244
245245 private async startAgent ( livekitUrl : string , livekitToken : string ) : Promise < void > {
246- for ( let i = 0 ; i < this . connOptions . maxRetry ; i ++ ) {
246+ for ( let i = 0 ; i <= this . connOptions . maxRetry ; i ++ ) {
247247 try {
248248 const payload : Record < string , any > = {
249249 transport_type : 'livekit' ,
@@ -297,7 +297,7 @@ export class AvatarSession {
297297 this . #logger. error ( { error : e } , 'failed to call lemonslice api' ) ;
298298 }
299299
300- if ( i < this . connOptions . maxRetry - 1 ) {
300+ if ( i <= this . connOptions . maxRetry - 1 ) {
301301 await new Promise ( ( resolve ) =>
302302 setTimeout ( resolve , intervalForRetry ( this . connOptions , i ) ) ,
303303 ) ;
0 commit comments