Skip to content

Commit

Permalink
Merge pull request #12 from OpenVoiceOS/release-1.0.0a1
Browse files Browse the repository at this point in the history
Release 1.0.0a1
  • Loading branch information
JarbasAl authored Oct 16, 2024
2 parents 149d413 + 6f4ebe4 commit bbe6b41
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Changelog

## [0.1.4a1](https://github.com/OpenVoiceOS/ovos-common-query-pipeline-plugin/tree/0.1.4a1) (2024-10-16)
## [1.0.0a1](https://github.com/OpenVoiceOS/ovos-common-query-pipeline-plugin/tree/1.0.0a1) (2024-10-16)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-common-query-pipeline-plugin/compare/0.1.3...0.1.4a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-common-query-pipeline-plugin/compare/0.1.4...1.0.0a1)

**Merged pull requests:**
**Breaking changes:**

- fix:standardize\_lang [\#9](https://github.com/OpenVoiceOS/ovos-common-query-pipeline-plugin/pull/9) ([JarbasAl](https://github.com/JarbasAl))
- feat:pipeline plugin factory [\#11](https://github.com/OpenVoiceOS/ovos-common-query-pipeline-plugin/pull/11) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
28 changes: 15 additions & 13 deletions ovos_commonqa/opm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
from dataclasses import dataclass
from os.path import dirname
from threading import Event
from typing import Dict, Optional
from typing import Dict, Optional, List, Union

from ovos_bus_client.client import MessageBusClient
from ovos_bus_client.message import Message
from ovos_bus_client.session import SessionManager
from ovos_config.config import Configuration
from ovos_plugin_manager.solvers import find_multiple_choice_solver_plugins
from ovos_plugin_manager.templates.pipeline import IntentMatch, PipelinePlugin
from ovos_plugin_manager.templates.pipeline import PipelineMatch, PipelineStageMatcher
from ovos_utils import flatten_list
from ovos_utils.log import LOG
from ovos_utils.fakebus import FakeBus
from ovos_utils.lang import standardize_lang_tag
from ovos_utils.log import LOG
from ovos_workshop.app import OVOSAbstractApplication


Expand All @@ -31,12 +33,13 @@ class Query:
selected_skill: str = ""


class CommonQAService(PipelinePlugin, OVOSAbstractApplication):
def __init__(self, bus, config=None):
class CommonQAService(PipelineStageMatcher, OVOSAbstractApplication):
def __init__(self, bus: Optional[Union[MessageBusClient, FakeBus]] = None,
config: Optional[Dict] = None):
OVOSAbstractApplication.__init__(
self, bus=bus, skill_id="common_query.openvoiceos",
resources_dir=f"{dirname(__file__)}")
PipelinePlugin.__init__(self, config)
PipelineStageMatcher.__init__(self, bus, config)
self.active_queries: Dict[str, Query] = dict()

self.common_query_skills = []
Expand Down Expand Up @@ -88,7 +91,7 @@ def is_question_like(self, utterance: str, lang: str):
# require a "question word"
return self.voc_match(utterance, "QuestionWord", lang)

def match(self, utterances: str, lang: str, message: Message) -> Optional[IntentMatch]:
def match(self, utterances: List[str], lang: str, message: Message) -> Optional[PipelineMatch]:
"""
Send common query request and select best response
Expand All @@ -98,7 +101,7 @@ def match(self, utterances: str, lang: str, message: Message) -> Optional[Intent
lang (str): Language code
message: Message for session context
Returns:
IntentMatch or None
PipelineMatch or None
"""
lang = standardize_lang_tag(lang)
# we call flatten in case someone is sending the old style list of tuples
Expand All @@ -118,11 +121,10 @@ def match(self, utterances: str, lang: str, message: Message) -> Optional[Intent
message.data["utterance"] = utterance
answered, skill_id = self.handle_question(message)
if answered:
match = IntentMatch(intent_service='CommonQuery',
intent_type=True,
intent_data={},
skill_id=skill_id,
utterance=utterance)
match = PipelineMatch(handled=True,
match_data={},
skill_id=skill_id,
utterance=utterance)
break
return match

Expand Down
8 changes: 4 additions & 4 deletions ovos_commonqa/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_BUILD = 4
VERSION_ALPHA = 0
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_BUILD = 0
VERSION_ALPHA = 1
# END_VERSION_BLOCK
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ovos-workshop>=0.1.7,<2.0.0
ovos-plugin-manager
ovos-plugin-manager>=0.5.0,<1.0.0
ovos-bus-client
ovos-config
ovos-utils>=0.3.4,<1.0.0
4 changes: 2 additions & 2 deletions tests/test_common_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_init(self):
self.assertEqual(len(self.bus.ee.listeners("common_query.question")), 1)

def test_is_question_like(self):
lang = "en-us"
lang = "en-US"
self.assertTrue(self.cc.is_question_like("what is a computer", lang))
self.assertTrue(self.cc.is_question_like("tell me about computers",
lang))
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_common_query_events(self):
'data': {'utterance': 'answer 1',
'expect_response': False,
'meta': {'skill': 'wiki.test'},
'lang': 'en-us'},
'lang': 'en-US'},
'context': skill_ans_ctxt},
# handler complete event
{'type': 'mycroft.skill.handler.complete',
Expand Down

0 comments on commit bbe6b41

Please sign in to comment.