Skip to content

Commit

Permalink
feat/skip_skills_in_dialog_transform
Browse files Browse the repository at this point in the history
allow some skills to explicitly skip the dialog transformers

by default jokes skill is blacklisted

```
"dialog_transformers": {
    "blacklisted_skills": ["skill-ovos-icanhazdadjokes.openvoiceos"]
}
```
  • Loading branch information
JarbasAl committed Oct 9, 2023
1 parent fe869e3 commit 6233ec7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ovos_audio/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,11 @@ def handle_speak(self, message):
utterance = message.data['utterance']

# allow dialog transformers to rewrite speech
utt2, message.context = self.dialog_transform.transform(dialog=utterance,
context=message.context,
sess=sess)
skill_id = message.data.get("meta", {}).get("skill") or message.context.get("skill_id")
if skill_id and skill_id not in self.dialog_transform.blacklisted_skills:
utt2, message.context = self.dialog_transform.transform(dialog=utterance,
context=message.context,
sess=sess)
if utterance != utt2:
LOG.debug(f"original dialog: {utterance}")
LOG.info(f"dialog transformed to: {utt2}")
Expand Down
7 changes: 7 additions & 0 deletions ovos_audio/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ def __init__(self, bus, config=None):
self.config = config or Configuration().get("dialog_transformers", {})
self.load_plugins()

@property
def blacklisted_skills(self):
# dialog should NEVER be rewritten if it comes from these skills
return self.config.get("blacklisted_skills",
["skill-ovos-icanhazdadjokes.openvoiceos"] # blacklist jokes by default
)

def load_plugins(self):
for plug_name, plug in find_dialog_transformer_plugins().items():
if plug_name in self.config:
Expand Down

0 comments on commit 6233ec7

Please sign in to comment.