@@ -261,14 +261,17 @@ def get_context(self, max_frames: int = None,
261
261
262
262
263
263
class Session :
264
- def __init__ (self , session_id : str = None , expiration_seconds : int = None ,
264
+ def __init__ (self , session_id : str = None ,
265
+ expiration_seconds : int = None ,
265
266
active_skills : List [List [Union [str , float ]]] = None ,
266
- utterance_states : Dict = None , lang : str = None ,
267
+ utterance_states : Dict = None ,
268
+ lang : str = None ,
267
269
context : IntentContextManager = None ,
268
270
site_id : str = "unknown" ,
269
271
pipeline : List [str ] = None ,
270
272
stt_prefs : Dict = None ,
271
- tts_prefs : Dict = None ):
273
+ tts_prefs : Dict = None ,
274
+ location_prefs : Dict = None ):
272
275
"""
273
276
Construct a session identifier
274
277
@param session_id: string UUID for the session
@@ -282,7 +285,7 @@ def __init__(self, session_id: str = None, expiration_seconds: int = None,
282
285
283
286
self .lang = lang or get_default_lang ()
284
287
285
- self .site_id = site_id or "unknown" # indoors placement info
288
+ self .site_id = site_id or Configuration (). get ( "site_id" ) or "unknown" # indoors placement info
286
289
287
290
self .active_skills = active_skills or [] # [skill_id , timestamp]# (Message , timestamp)
288
291
self .utterance_states = utterance_states or {} # {skill_id: UtteranceState}
@@ -319,6 +322,7 @@ def __init__(self, session_id: str = None, expiration_seconds: int = None,
319
322
tts_prefs = {"plugin_id" : ttsm ,
320
323
"config" : tts .get (ttsm ) or {}}
321
324
self .tts_preferences = tts_prefs
325
+ self .location_preferences = location_prefs or Configuration ().get ("location" , {})
322
326
323
327
@property
324
328
def active (self ) -> bool :
@@ -415,7 +419,8 @@ def serialize(self) -> dict:
415
419
"site_id" : self .site_id ,
416
420
"pipeline" : self .pipeline ,
417
421
"stt" : self .stt_preferences ,
418
- "tts" : self .tts_preferences
422
+ "tts" : self .tts_preferences ,
423
+ "location" : self .location_preferences
419
424
}
420
425
421
426
def update_history (self , message : Message = None ):
@@ -440,8 +445,9 @@ def deserialize(data: Dict):
440
445
context = IntentContextManager .deserialize (data .get ("context" , {}))
441
446
site_id = data .get ("site_id" , "unknown" )
442
447
pipeline = data .get ("pipeline" , [])
443
- tts = data .get ("tts_preferences" , {})
444
- stt = data .get ("stt_preferences" , {})
448
+ tts = data .get ("tts" , {})
449
+ stt = data .get ("stt" , {})
450
+ location = data .get ("location" , {})
445
451
return Session (uid ,
446
452
active_skills = active ,
447
453
utterance_states = states ,
@@ -450,7 +456,8 @@ def deserialize(data: Dict):
450
456
pipeline = pipeline ,
451
457
site_id = site_id ,
452
458
tts_prefs = tts ,
453
- stt_prefs = stt )
459
+ stt_prefs = stt ,
460
+ location_prefs = location )
454
461
455
462
@staticmethod
456
463
def from_message (message : Message = None ):
0 commit comments