Skip to content

Commit 839cc88

Browse files
Merge annotation ownership and catalog filtering into mobile dictation
2 parents ed705a5 + 35f9dfa commit 839cc88

3 files changed

Lines changed: 8 additions & 18 deletions

File tree

‎apps/desktop/src/preview/PickPreload.ts‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,6 @@ function startAnnotation(
609609
let voicePhase: DesktopPreviewAnnotationVoiceState["phase"] = "idle";
610610
let voiceSettings = false;
611611
let voiceBusy = false;
612-
let voicePreparing = false;
613612
let voiceAvailable = false;
614613
let voiceKeyCode: string | null = null;
615614
let pendingVoiceSubmission: PreviewAnnotationSubmission | null = null;
@@ -711,12 +710,7 @@ function startAnnotation(
711710
return;
712711
}
713712
if (!voiceAvailable || (voiceBusy && voicePhase !== "recording")) return;
714-
const action = voicePhase === "recording" ? "stop" : "start";
715-
voiceBusy = true;
716-
if (action === "start") voicePreparing = true;
717-
comment.readOnly = true;
718-
updateStatus();
719-
sendVoice(action);
713+
sendVoice(voicePhase === "recording" ? "stop" : "start");
720714
});
721715
voiceFinish.addEventListener("click", (event) => {
722716
if (event.isTrusted) sendVoice("stop");
@@ -738,7 +732,6 @@ function startAnnotation(
738732
const submissionChanged = voiceBusy !== state.blocksSubmission;
739733
const previewChanged = voicePreview.textContent !== (state.preview ?? "");
740734
voicePhase = state.phase;
741-
voicePreparing = state.phase === "preparing";
742735
voiceSettings = state.errorAction === "settings";
743736
voiceBusy = state.blocksSubmission;
744737
voiceAvailable = state.available;
@@ -888,7 +881,7 @@ function startAnnotation(
888881
sendVoice("cancel");
889882
}
890883
editor.style.display = hasTargets ? "flex" : "none";
891-
submit.disabled = !hasTargets || voicePreparing || pendingCapture;
884+
submit.disabled = !hasTargets || voicePhase === "preparing" || pendingCapture;
892885
submit.style.opacity = hasTargets ? "1" : "0.45";
893886
adjust.disabled = !hasTargets;
894887
stylePanel.style.display = editorExpanded && selected.size > 0 ? "grid" : "none";
@@ -1623,12 +1616,6 @@ function startAnnotation(
16231616
event.preventDefault();
16241617
event.stopImmediatePropagation();
16251618
voiceKeyCode = event.code || event.key;
1626-
if (!event.repeat && !voiceBusy) {
1627-
voiceBusy = true;
1628-
voicePreparing = true;
1629-
comment.readOnly = true;
1630-
updateStatus();
1631-
}
16321619
sendVoice("key", event);
16331620
return;
16341621
}
@@ -1650,7 +1637,7 @@ function startAnnotation(
16501637

16511638
const submitAnnotation = (submission: PreviewAnnotationSubmission): void => {
16521639
if (submission === "send" && !sendEnabled) return;
1653-
if (voicePreparing) return;
1640+
if (voicePhase === "preparing") return;
16541641
// Submitting while dictating finishes the recording and submits once the text lands.
16551642
if (voiceBusy) {
16561643
if (pendingVoiceSubmission === null) {

‎apps/server/scripts/speech-catalog.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ it("filters roles, explicit NC licenses, future engines, unknown architectures a
4444
{ license: "cc-by-nc-4.0" },
4545
{ license: "CC-BY-NC-SA-4.0" },
4646
{ license: "cc-by-nc-nd-3.0" },
47+
{ license: "cc-by-nc" },
48+
{ license: "CC BY-NC 4.0" },
49+
{ license: "custom_NC" },
4750
{ minEngine: "0.4.2" },
4851
{ minEngine: "0.5.0" },
4952
{ family: "future_arch" },
@@ -57,7 +60,7 @@ it("filters roles, explicit NC licenses, future engines, unknown architectures a
5760
]) {
5861
expect(generate([{ ...model, ...override }]).models).toEqual([]);
5962
}
60-
for (const license of ["other", "apache-2.0", "cc-by-4.0", "cc-by-sa-4.0"]) {
63+
for (const license of ["other", "apache-2.0", "cc-by-4.0", "cc-by-sa-4.0", "unlicense"]) {
6164
expect(generate([{ ...model, license, minEngine: "0.4.1" }]).models).toHaveLength(1);
6265
}
6366
});

‎apps/server/scripts/speech-catalog.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function generateSpeechCatalog(
5050
const models = data.models.flatMap((model) => {
5151
if (
5252
model.role !== "asr" ||
53-
/^cc-by-nc(?:-sa|-nd)?-\d+\.\d+$/i.test(model.license.trim()) ||
53+
/(?:^|[^a-z0-9])nc(?:$|[^a-z0-9])/i.test(model.license) ||
5454
!ASR_FAMILIES.has(model.family) ||
5555
compareEngineVersions(model.minEngine ?? data.transcribeCpp, engineVersion) > 0
5656
)

0 commit comments

Comments
 (0)