Skip to content

Commit

Permalink
Missing fields and toggle hotword on only when asr if confirmed as off
Browse files Browse the repository at this point in the history
  • Loading branch information
Psychokiller1888 committed Apr 16, 2023
1 parent 7abbc76 commit 171bb70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 8 additions & 5 deletions core/dialog/DialogManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ def onNluIntentNotRecognized(self, session: DialogSession):
}
)


def onNluError(self, session: DialogSession):
"""
NLU reported an error
Expand Down Expand Up @@ -472,16 +471,20 @@ def onSessionEnded(self, session: DialogSession):
topic=constants.TOPIC_ASR_TOGGLE_OFF
)

self.removeSession(sessionId=session.sessionId)


def onAsrToggleOff(self, deviceUid: str):
"""
Asr toggled off, hotword is allowed to capture again
"""
self.MqttManager.publish(
topic=constants.TOPIC_HOTWORD_TOGGLE_ON,
payload={
'siteId' : session.deviceUid,
'sessionId': session.sessionId
'siteId' : deviceUid
}
)

self.removeSession(sessionId=session.sessionId)


def onSessionError(self, session: DialogSession):
if self.Commons.partOfTheDay() == PartOfDay.SLEEPING.value:
Expand Down
5 changes: 3 additions & 2 deletions core/dialog/model/DialogSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ class DialogSession(object):
payload: dict = field(default_factory=dict)
intentHistory: list = field(default_factory=list)
intentFilter: list = field(default_factory=list)
textOnly: bool = False # The session doesn't use audio, but text only. Per exemple, for Telegram messages sent to Alice
textOnly: bool = False # The session doesn't use audio, but text only. Per example, for Telegram messages sent to Alice
textInput: bool = False # The session is started, user side, by a text input, not with voice capture, like dialogview on web ui
keptOpen: bool = False # The session has ended, but is kept open for a new promt
keptOpen: bool = False # The session has ended, but is kept open for a new prompt
lastWasSoundPlayOnly: bool = False # We don't use request ids for play bytes topic. Both say and playaudio use play bytes, therefor we need to track if the last play bytes was sound only or TTS
locationId: int = -1 # Where this session is taking place
init: dict = field(default_factory=dict)


def __post_init__(self): # NOSONAR
Expand Down

0 comments on commit 171bb70

Please sign in to comment.