Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(voice): recognize "ändere/setze/stell <provider>" and "halt" to cancel

Ruben Lütke2d615995ec17
diff --git a/jarvis/brain/voice_command_gate.py b/jarvis/brain/voice_command_gate.py
index f7514a280d..6e5edbb6a3 100644
--- a/jarvis/brain/voice_command_gate.py
+++ b/jarvis/brain/voice_command_gate.py
@@ -42,7 +42,8 @@ _PROVIDER_ALIASES = (
# provider alias with a word boundary, so harmless sentences never match.
# The German imperative paradigm needs two stems: "wechsel" and "wechsle".
_PROVIDER_PATTERN = re.compile(
- r"\b(?:wechsel[n]?|wechsle|switch(?:\s+to)?|benutze?|nutze|use|nimm)"
+ r"\b(?:wechsel[n]?|wechsle|änder\w*|aender\w*|setz\w*|stell\w*"
+ r"|switch(?:\s+to)?|benutze?|nutze|use|nimm)"
r"(?:\s+(?:den|die|das|der|the|deinen|deine|dein|meinen|meine|mein|my))?"
r"(?:\s+(?:brain[-\s]*provider|provider|anbieter|sprach[-\s]*modell|modell|model))?"
# Optional "von/from <source>" so "switch FROM gemini TO openai" targets the
@@ -57,7 +58,7 @@ _PROVIDER_PATTERN = re.compile(
# sentence start OR preceded by "jarvis", to avoid catching harmless phrases
# like "stopp doch mal kurz".
_CANCEL_PATTERN = re.compile(
- r"^(?:jarvis[,\s]+)?(?:stopp?|abbruch|abbrechen|cancel|stop\s+sub)\b",
+ r"^(?:jarvis[,\s]+)?(?:stopp?|abbruch|abbrechen|cancel|stop\s+sub|halt)\b",
re.IGNORECASE,
)
diff --git a/tests/unit/brain/test_voice_command_gate.py b/tests/unit/brain/test_voice_command_gate.py
index a0d9930bc2..026dd40f29 100644
--- a/tests/unit/brain/test_voice_command_gate.py
+++ b/tests/unit/brain/test_voice_command_gate.py
@@ -147,6 +147,31 @@ def test_main_provider_switch_recognizes_anthropic_alias() -> None:
assert m.target == "anthropic"
+ "text,target",
+ [
+ ("ändere den Provider auf gemini", "gemini"), # i18n-allow: German voice fixture
+ ("setze den Brain-Provider auf openai", "openai"), # i18n-allow: German voice fixture
+ ("stell den Provider auf claude", "claude"), # i18n-allow: German voice fixture
+ ],
+)
+def test_provider_switch_extra_verbs(text: str, target: str) -> None:
+ m = match_voice_command(text)
+ assert m is not None and m.kind == "provider_switch", f"no match for {text!r}"
+ assert m.target == target
+
+
+def test_cancel_recognizes_halt() -> None:
+ m = match_voice_command("halt")
+ assert m is not None and m.kind == "cancel"
+
+
+def test_halt_midsentence_is_not_cancel() -> None:
+ # "das ist halt so" must NOT cancel — halt only at sentence start / after jarvis
+ m = match_voice_command("das ist halt so")
+ assert m is None or m.kind != "cancel"
+
+
def test_language_switch_picks_first_language_in_text_not_dict_order() -> None:
# "deutsch" appears before "englisch" in the sentence, so the reply language
# must be German — not English just because "englisch" sits earlier in the