@@ -228,36 +228,6 @@ def get_skill_name(self, skill_id):
228
228
"""
229
229
return self .skill_names .get (skill_id , skill_id )
230
230
231
- # converse handling
232
- @property
233
- def active_skills (self ):
234
- log_deprecation ("self.active_skills is deprecated! use Session instead" , "0.0.9" )
235
- session = SessionManager .get ()
236
- return session .active_skills
237
-
238
- @active_skills .setter
239
- def active_skills (self , val ):
240
- log_deprecation ("self.active_skills is deprecated! use Session instead" , "0.0.9" )
241
- session = SessionManager .get ()
242
- session .active_skills = []
243
- for skill_id , ts in val :
244
- session .activate_skill (skill_id )
245
-
246
- @deprecated ("handle_activate_skill_request moved to ConverseService, overriding this method has no effect, "
247
- "it has been disconnected from the bus event" , "0.0.8" )
248
- def handle_activate_skill_request (self , message ):
249
- self .converse .handle_activate_skill_request (message )
250
-
251
- @deprecated ("handle_deactivate_skill_request moved to ConverseService, overriding this method has no effect, "
252
- "it has been disconnected from the bus event" , "0.0.8" )
253
- def handle_deactivate_skill_request (self , message ):
254
- self .converse .handle_deactivate_skill_request (message )
255
-
256
- @deprecated ("reset_converse moved to ConverseService, overriding this method has no effect, "
257
- "it has been disconnected from the bus event" , "0.0.8" )
258
- def reset_converse (self , message ):
259
- self .converse .reset_converse (message )
260
-
261
231
def _handle_transformers (self , message ):
262
232
"""
263
233
Pipe utterance through transformer plugins to get more metadata.
@@ -381,35 +351,32 @@ def _emit_match_message(self, match: Union[IntentHandlerMatch, PipelineMatch], m
381
351
match (IntentHandlerMatch): The matched utterance object.
382
352
message (Message): The messagebus data.
383
353
"""
354
+ reply = None
384
355
message .data ["utterance" ] = match .utterance
385
356
357
+ sess = SessionManager .get (message )
386
358
if match .skill_id :
387
359
# ensure skill_id is present in message.context
388
360
message .context ["skill_id" ] = match .skill_id
361
+ if not sess .is_active (match .skill_id ):
362
+ # ensure skill_id is in active skills list
363
+ sess .activate_skill (match .skill_id )
364
+ # emit event for skills callback -> self.handle_activate
365
+ self .bus .emit (message .reply (f"{ match .skill_id } .activate" ))
389
366
390
367
if isinstance (match , PipelineMatch ) and match .handled :
391
368
# utterance fully handled
392
369
reply = message .reply ("ovos.utterance.handled" ,
393
370
{"skill_id" : match .skill_id })
394
- self .bus .emit (reply )
395
371
# Launch skill if not handled by the match function
396
372
elif isinstance (match , IntentHandlerMatch ) and match .match_type :
397
373
# keep all original message.data and update with intent match
398
374
data = dict (message .data )
399
375
data .update (match .match_data )
400
-
401
- # NOTE: message.reply to ensure correct message destination
402
376
reply = message .reply (match .match_type , data )
403
377
404
- # let's activate the skill BEFORE the intent is triggered
405
- # to ensure an accurate Session
406
- # NOTE: this was previously done async by the skill,
407
- # but then the skill was missing from Session.active_skills
408
- sess = self .converse .activate_skill (message = reply ,
409
- skill_id = match .skill_id )
410
- if sess :
411
- reply .context ["session" ] = sess .serialize ()
412
-
378
+ if reply is not None :
379
+ reply .context ["session" ] = sess .serialize () # updated active skill list
413
380
self .bus .emit (reply )
414
381
415
382
def send_cancel_event (self , message ):
@@ -641,16 +608,6 @@ def handle_get_skills(self, message):
641
608
self .bus .emit (message .reply ("intent.service.skills.reply" ,
642
609
{"skills" : self .skill_names }))
643
610
644
- @deprecated ("handle_get_active_skills moved to ConverseService, overriding this method has no effect, "
645
- "it has been disconnected from the bus event" , "0.0.8" )
646
- def handle_get_active_skills (self , message ):
647
- """Send active skills to caller.
648
-
649
- Argument:
650
- message: query message to reply to.
651
- """
652
- self .converse .handle_get_active_skills (message )
653
-
654
611
def handle_get_adapt (self , message : Message ):
655
612
"""handler getting the adapt response for an utterance.
656
613
0 commit comments