feat(orchestrator): speak into every text field of the hub (requirement 013)
Requirement 013 and its implementation: page-mic.js puts a microphone on every textarea and text input, records with MediaRecorder and inserts the transcript at the cursor; Escape cancels. /api/stt transcribes with the local whisper.cpp model ggml-small-q8_0 (pinned to commit 5359861c and its sha256) in a per-request temp dir, capped at 60 s and 5 MiB, and returns German or English only, retranscribing a clip detected as another language in both and keeping the surer one. Without a model the button is disabled and names the install row. Tests run once on unify/skills-20261114 after the merge (operator order 2026-11-14). 🎯 Fix: 72 % 💥 Break: 12 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 63 🚦 Gate: ⛔ fix 72 % < 90, break 12 % > 5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a2a03995cb
commit
a438a2f54e
27 files changed
+861
-149
No files matched your search
+14
-1
@@ -74,12 +74,25 @@ class TestVoiceModule(unittest.TestCase):
|
||||
|
||||
def test_the_recording_is_encoded_as_16_khz_mono_pcm(self):
|
||||
body = base64.b64decode(self.data["wav"])
|
||||
self.assertEqual(engines.wav_seconds(body), 7 / engines.STT_RATE)
|
||||
self.assertEqual(engines.wav_seconds(body, engines.STT_SECONDS), 7 / engines.STT_RATE)
|
||||
with wave.open(io.BytesIO(body)) as reader:
|
||||
self.assertEqual((reader.getnchannels(), reader.getsampwidth(), reader.getframerate(), reader.getnframes()), (1, 2, 16000, 7))
|
||||
self.assertEqual(struct.unpack("<7h", reader.readframes(7)), (0, 16383, -16384, 32767, -32768, 32767, -32768))
|
||||
self.assertEqual(self.data["frames"], [24000, 16000 * 120, 0])
|
||||
|
||||
def test_the_transcript_lands_at_the_cursor_with_one_space_on_each_side(self):
|
||||
cases = [["start end", 6, 6, "hello"], ["", 0, 0, " hello "], ["abc", 3, 3, "x"], ["ab cd", 1, 4, "X"], ["keep", 2, 2, " "], ["a\nb", 2, 2, "line"]]
|
||||
probe = "const V = require(process.argv[1]); console.log(JSON.stringify(JSON.parse(process.argv[2]).map((one) => V.spliced(...one))));"
|
||||
done = subprocess.run(["node", "-e", probe, str(VOICE), json.dumps(cases)], capture_output=True, text=True, timeout=60, check=True)
|
||||
self.assertEqual(json.loads(done.stdout), [
|
||||
{"value": "start hello end", "caret": 11},
|
||||
{"value": "hello", "caret": 5},
|
||||
{"value": "abc x", "caret": 5},
|
||||
{"value": "a X d", "caret": 3},
|
||||
{"value": "keep", "caret": 2},
|
||||
{"value": "a\nline b", "caret": 6},
|
||||
])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user