Skip to content

Commit

Permalink
2.0.0 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel authored Mar 27, 2024
2 parents fe0fba5 + d1d2f13 commit e0013bd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 27 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Changelog

## [1.1.1a1](https://github.com/NeonGeckoCom/skill-fallback_unknown/tree/1.1.1a1) (2023-12-20)
## [2.0.0](https://github.com/NeonGeckoCom/skill-fallback_unknown/tree/2.0.0) (2024-03-27)

[Full Changelog](https://github.com/NeonGeckoCom/skill-fallback_unknown/compare/1.1.0...1.1.1a1)
[Full Changelog](https://github.com/NeonGeckoCom/skill-fallback_unknown/compare/1.2.1a1...2.0.0)

**Implemented enhancements:**

- Refactor `neon_must_respond` [\#7](https://github.com/NeonGeckoCom/skill-fallback_unknown/issues/7)

## [1.2.1a1](https://github.com/NeonGeckoCom/skill-fallback_unknown/tree/1.2.1a1) (2024-03-02)

[Full Changelog](https://github.com/NeonGeckoCom/skill-fallback_unknown/compare/1.2.0...1.2.1a1)

**Merged pull requests:**

- Update init and Unknown response handling [\#48](https://github.com/NeonGeckoCom/skill-fallback_unknown/pull/48) ([NeonDaniel](https://github.com/NeonDaniel))
- Extend FallbackSkill from ovos-workshop [\#50](https://github.com/NeonGeckoCom/skill-fallback_unknown/pull/50) ([NeonDaniel](https://github.com/NeonDaniel))



Expand Down
31 changes: 14 additions & 17 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from neon_utils.skills.neon_fallback_skill import NeonFallbackSkill
from neon_utils.message_utils import neon_must_respond, request_for_neon
from ovos_workshop.decorators import fallback_handler
from ovos_workshop.skills.fallback import FallbackSkill
from neon_utils.message_utils import request_for_neon
from ovos_bus_client import Message
from ovos_utils import classproperty
from ovos_utils.log import LOG
from ovos_utils.process_utils import RuntimeRequirements


class UnknownSkill(NeonFallbackSkill):
def __init__(self, *args, **kwargs):
NeonFallbackSkill.__init__(self, *args, **kwargs)
self.register_fallback(self.handle_fallback, 100)
# Set of clients that always expect a response
self._transactional_clients = {"mq_api"}
class UnknownSkill(FallbackSkill):
# Set of clients that always expect a response
_transactional_clients = {"mq_api", "klat", "mobile"}

@classproperty
def runtime_requirements(self):
Expand All @@ -76,6 +74,7 @@ def _read_voc_lines(self, name) -> filter:
with open(self.find_resource(name + '.voc', 'vocab')) as f:
return filter(bool, map(str.strip, f.read().split('\n')))

@fallback_handler(priority=100)
def handle_fallback(self, message: Message):
LOG.info("Unknown Fallback Checking for Neon!!!")
utterance = message.data['utterance']
Expand All @@ -84,7 +83,6 @@ def handle_fallback(self, message: Message):
True)
# This checks if we're pretty sure this was a request intended for Neon
if not any((request_for_neon(message, "neon", self.voc_match, ww_state),
neon_must_respond(message),
client in self._transactional_clients)):
LOG.info("Ignoring streaming STT or public conversation input")
return True
Expand All @@ -103,15 +101,14 @@ def handle_fallback(self, message: Message):
# Show utterance that failed to match an intent
if self.settings.get('show_utterances'):
self.gui['utterance'] = utterance
self.gui.show_page("UnknownIntent.qml")
self.gui.show_page("UnknownIntent")

# Report an intent failure
self.bus.emit(Message("neon.metric", {"name": "failed-intent",
'utterance': utterance,
'client': client
}))

try:
# Report an intent failure
self.report_metric('failed-intent',
{'utterance': utterance,
'device': self.config_core.get("dev_type")})
except Exception as e:
LOG.exception(e)
LOG.debug(f"Checking if neon must respond: {message.data}")

# Determine what kind of question this is to reply appropriately
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
neon-utils~=1.5
ovos_utils~=0.0.28
ovos_utils~=0.0.28
ovos-workshop~=0.0.15
1 change: 1 addition & 0 deletions skill.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"requirements": {
"python": [
"neon-utils~=1.5",
"ovos-workshop~=0.0.15",
"ovos_utils~=0.0.28"
],
"system": {},
Expand Down
5 changes: 0 additions & 5 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@


class TestSkill(SkillTestCase):
def test_00_skill_init(self):
from neon_utils.skills.neon_skill import NeonSkill
self.assertIsInstance(self.skill, NeonSkill)
self.assertIsInstance(self.skill, NeonFallbackSkill)

def test_read_voc_lines(self):
valid_vocab = ('question', 'who.is', 'why.is')
for v in valid_vocab:
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = "1.2.0"
__version__ = "2.0.0"

0 comments on commit e0013bd

Please sign in to comment.