Skip to content

Commit 285bc21

Browse files
Release 0.2.17a1 (#50)
* Merge pull request #45 from OpenVoiceOS/gitlocalize-33720 gl/translate * Increment Version to 0.2.16a1 * Update Changelog * Fix/session (#47) * fix: session support * fix: session support * Increment Version to 0.2.16a2 * Update Changelog * fix: automations (#49) * Update translations * Increment Version to 0.2.17a1 * Update Changelog --------- Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: JarbasAl <JarbasAl@users.noreply.github.com> Co-authored-by: JarbasAI <33701864+JarbasAl@users.noreply.github.com>
2 parents 3bb9357 + 75380f5 commit 285bc21

File tree

13 files changed

+696
-214
lines changed

13 files changed

+696
-214
lines changed

.github/workflows/release_workflow.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
with:
2222
python-version: "3.11"
2323

24+
- name: Install Tools
25+
run: |
26+
python -m pip install ovos-utils
27+
2428
- name: Sync translations by gitlocalize-app[bot]
2529
run: |
2630
python scripts/sync_translations.py

CHANGELOG.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
# Changelog
22

3-
## [0.2.15a1](https://github.com/OpenVoiceOS/ovos-skill-dictation/tree/0.2.15a1) (2025-05-06)
3+
## [0.2.17a1](https://github.com/OpenVoiceOS/ovos-skill-dictation/tree/0.2.17a1) (2025-06-07)
44

5-
[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-dictation/compare/V0.2.14...0.2.15a1)
5+
[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-dictation/compare/0.2.16a2...0.2.17a1)
66

77
**Merged pull requests:**
88

9-
- fix: error in translations [\#43](https://github.com/OpenVoiceOS/ovos-skill-dictation/pull/43) ([JarbasAl](https://github.com/JarbasAl))
9+
- fix: automations [\#49](https://github.com/OpenVoiceOS/ovos-skill-dictation/pull/49) ([JarbasAl](https://github.com/JarbasAl))
1010

11-
## [V0.2.14](https://github.com/OpenVoiceOS/ovos-skill-dictation/tree/V0.2.14) (2025-03-16)
11+
## [0.2.16a2](https://github.com/OpenVoiceOS/ovos-skill-dictation/tree/0.2.16a2) (2025-06-07)
1212

13-
[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-dictation/compare/0.2.14...V0.2.14)
13+
[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-dictation/compare/0.2.16a1...0.2.16a2)
14+
15+
**Merged pull requests:**
16+
17+
- Fix/session [\#47](https://github.com/OpenVoiceOS/ovos-skill-dictation/pull/47) ([JarbasAl](https://github.com/JarbasAl))
18+
19+
## [0.2.16a1](https://github.com/OpenVoiceOS/ovos-skill-dictation/tree/0.2.16a1) (2025-06-05)
20+
21+
[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-dictation/compare/V0.2.15...0.2.16a1)
22+
23+
**Merged pull requests:**
24+
25+
- gl/translate [\#45](https://github.com/OpenVoiceOS/ovos-skill-dictation/pull/45) ([gitlocalize-app[bot]](https://github.com/apps/gitlocalize-app))
26+
27+
## [V0.2.15](https://github.com/OpenVoiceOS/ovos-skill-dictation/tree/V0.2.15) (2025-05-06)
28+
29+
[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-dictation/compare/0.2.15...V0.2.15)
1430

1531

1632

__init__.py

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
import time
33

44
from ovos_bus_client.message import Message
5+
from ovos_bus_client.session import SessionManager, Session
56
from ovos_config import Configuration
67
from ovos_utils import classproperty
78
from ovos_utils.process_utils import RuntimeRequirements
89
from ovos_workshop.decorators import intent_handler, adds_context, removes_context
9-
from ovos_workshop.skills import OVOSSkill
10+
from ovos_workshop.skills.converse import ConversationalSkill
1011

1112

12-
class DictationSkill(OVOSSkill):
13+
class DictationSkill(ConversationalSkill):
1314
"""
1415
- start dictation
1516
- enable continuous conversation mode
@@ -37,9 +38,7 @@ def runtime_requirements(self):
3738
)
3839

3940
def initialize(self):
40-
self.file_name = None
41-
self.dictating = False
42-
self.dictation_stack = []
41+
self.dictation_sessions = {}
4342

4443
@property
4544
def default_listen_mode(self):
@@ -54,54 +53,88 @@ def default_listen_mode(self):
5453
@adds_context("DictationKeyword", "dictation")
5554
def start_dictation(self, message=None):
5655
message = message or Message("")
57-
self.dictation_stack = []
58-
self.dictating = True
59-
self.file_name = message.data.get("name", str(time.time()))
56+
sess = SessionManager.get(message)
57+
self.dictation_sessions[sess.session_id] = dict(
58+
file_name=message.data.get("name", str(time.time())),
59+
dictating=True,
60+
dictation_stack=[]
61+
)
6062
self.bus.emit(message.forward("recognizer_loop:state.set",
6163
{"mode": "continuous"}))
6264

6365
@removes_context("DictationKeyword")
6466
def stop_dictation(self, message=None):
6567
message = message or Message("")
66-
self.dictating = False
68+
sess = SessionManager.get(message)
6769
self.bus.emit(message.forward("recognizer_loop:state.set",
6870
{"mode": self.default_listen_mode}))
71+
6972
path = f"{os.path.expanduser('~')}/Documents/dictations"
7073
os.makedirs(path, exist_ok=True)
71-
name = self.file_name or time.time()
74+
name = self.dictation_sessions[sess.session_id]["file_name"] or time.time()
7275
with open(f"{path}/{name}.txt", "w") as f:
73-
f.write("\n".join(self.dictation_stack))
76+
f.write("\n".join(self.dictation_sessions[sess.session_id]["dictation_stack"]))
7477
self.gui.show_text(f"saved to {path}/{name}.txt")
7578

79+
self.dictation_sessions[sess.session_id]["dictating"] = False
80+
7681
@intent_handler("start_dictation.intent")
7782
def handle_start_dictation_intent(self, message):
7883
if not self.dictating:
7984
self.speak_dialog("start", wait=True)
8085
else:
8186
self.speak_dialog("already_dictating", wait=True)
82-
self.start_dictation() # enable continuous listening, no wake word needed
87+
self.start_dictation(message) # enable continuous listening, no wake word needed
8388

8489
@intent_handler("stop_dictation.intent")
8590
def handle_stop_dictation_intent(self, message):
8691
if self.dictating:
8792
self.speak_dialog("stop")
8893
else:
8994
self.speak_dialog("not_dictating")
90-
self.stop_dictation()
95+
self.stop_dictation(message)
9196

92-
def stop(self):
93-
if self.dictating:
97+
def stop_session(self, session: Session):
98+
if session.session_id in self.dictation_sessions and \
99+
self.dictation_sessions[session.session_id]["dictating"]:
100+
self.dictation_sessions[session.session_id]["dictating"] = False
94101
self.stop_dictation()
95102
return True
103+
return False
104+
105+
def stop(self):
106+
sess = SessionManager.get()
107+
if sess.session_id in self.dictation_sessions and \
108+
self.dictation_sessions[sess.session_id]["dictating"]:
109+
self.stop_session(sess)
110+
return True
111+
return False
112+
113+
def can_answer(self, message: Message) -> bool:
114+
"""
115+
Determines if the skill can handle the given utterances in the specified language in the converse method.
116+
117+
Override this method to implement custom logic for assessing whether the skill is capable of answering a query.
118+
119+
Returns:
120+
True if the skill can handle the query during converse; otherwise, False.
121+
"""
122+
sess = SessionManager.get(message)
123+
if sess.session_id in self.dictation_sessions and \
124+
self.dictation_sessions[sess.session_id]["dictating"]:
125+
return True
126+
return False
96127

97128
def converse(self, message):
98129
utterance = message.data["utterances"][0]
99-
if self.dictating:
130+
sess = SessionManager.get(message)
131+
if sess.session_id in self.dictation_sessions and \
132+
self.dictation_sessions[sess.session_id]["dictating"]:
100133
if self.voc_match(utterance, "StopKeyword"):
101134
self.handle_stop_dictation_intent(message)
102135
else:
103136
self.gui.show_text(utterance)
104-
self.dictation_stack.append(utterance)
137+
self.dictation_sessions[sess.session_id]["dictation_stack"].append(utterance)
105138
return True
106139
return False
107140

@@ -129,4 +162,4 @@ def spk(utt, *args, **kwargs):
129162
# dictation stopped
130163
s.converse(Message("", {"utterances": ["test"]}))
131164

132-
assert s.dictation_stack == ['test', 'test', 'test']
165+
assert s.dictation_stack == ['test', 'test', 'test']

0 commit comments

Comments
 (0)