Skip to content

Commit a77b317

Browse files
StiensWoutclaude
andcommitted
fix: address dictation review findings
- Drop a dictated sentence's final period whenever the draft continues in lowercase, including at a sentence start. - Prefer the longer skill name when spoken spans tie ("fix bug" over "bug"). - Keep each environment's own active model out of "Other downloaded models". Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 05a7252 commit a77b317

5 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎apps/web/src/components/settings/DictationSettings.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,12 @@ function InactiveDictationModels(props: {
288288
const [removing, setRemoving] = useState<DictationModel["id"] | null>(null);
289289
if (!state?.supported) return null;
290290
const inactive = state.models.filter(
291-
(model) => model.install._tag === "installed" && model.id !== props.selectedModel,
291+
// The environment keeps its own active model even when another environment's
292+
// selection is shown; removing it would be a no-op on the server.
293+
(model) =>
294+
model.install._tag === "installed" &&
295+
model.id !== props.selectedModel &&
296+
model.id !== state.settings.localModel,
292297
);
293298
if (inactive.length === 0) return null;
294299

‎packages/client-runtime/src/voice-input/controller.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ describe("resolveTranscriptCommit", () => {
159159
expect(resolveTranscriptCommit(empty, empty, "ok then", "<|en|>")).toMatchObject({
160160
text: "Ok then",
161161
});
162+
const beforeLowercase = at("before release", 0);
163+
expect(
164+
resolveTranscriptCommit(beforeLowercase, beforeLowercase, "Fix the bug.", "en-US"),
165+
).toMatchObject({ text: "Fix the bug before release" });
162166
const continuing = at("Fix the bug before release.", 11);
163167
expect(
164168
resolveTranscriptCommit(continuing, continuing, "And check the tests.", "en-US"),

‎packages/client-runtime/src/voice-input/controller.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function resolveTranscriptCommit(
119119
// Models transcribe each recording as its own sentence. Fit that sentence to
120120
// where it lands: capitalize at the start of the draft, a line, or a
121121
// sentence; mid-sentence, drop the leading capital (English only, where
122-
// nouns are not capitalized) and a final period when the sentence goes on.
122+
// nouns are not capitalized). Drop a final period when the sentence goes on.
123123
// A first word with other capitals ("iOS") or "I" is kept as spoken.
124124
const atSentenceStart = /(^|[.!?]\s*|\n\s*)$/.test(
125125
captured.text.slice(0, captured.selection.start),
@@ -133,9 +133,9 @@ export function resolveTranscriptCommit(
133133
if (usesEnglishSpacing && plainCapitalized) {
134134
insertion = withFirstLetterCase(insertion, locale, false);
135135
}
136-
if (/^\s*\p{Ll}/u.test(captured.text.slice(captured.selection.end))) {
137-
insertion = insertion.replace(/[.!?]$/u, "");
138-
}
136+
}
137+
if (/^\s*\p{Ll}/u.test(captured.text.slice(captured.selection.end))) {
138+
insertion = insertion.replace(/[.!?]$/u, "");
139139
}
140140
if (isEmptySelection && usesEnglishSpacing) {
141141
const left = captured.text[captured.selection.start - 1];

‎packages/shared/src/inlineSkills.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ describe("replaceSpokenSkills", () => {
2525
"run $postplan-read on it",
2626
);
2727
expect(replaceSpokenSkills("dollar review please", skills)).toBe("$review please");
28+
const overlapping = [
29+
{ name: "bug", displayName: undefined },
30+
{ name: "fix-bug", displayName: undefined },
31+
];
32+
expect(replaceSpokenSkills("use the fix bug skill", overlapping)).toBe("use $fix-bug");
33+
expect(replaceSpokenSkills("use the bug skill", overlapping)).toBe("use $bug");
2834
});
2935

3036
it("leaves unanchored words and unknown skills alone", () => {

‎packages/shared/src/inlineSkills.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ export function replaceSpokenSkills(text: string, skills: readonly InlineSkill[]
105105
if (!word || word.start < consumedUntil || word.letters.length === 0) break;
106106
spoken = step === 1 ? spoken + word.letters : word.letters + spoken;
107107
const match = closestSpokenSkill(spoken, skills);
108-
if (match && (best === null || match.distance < best.distance)) {
108+
// Spans grow word by word, so on a tie the longer name wins ("fix bug" over "bug").
109+
if (match && (best === null || match.distance <= best.distance)) {
109110
best = {
110111
...match,
111112
first: step === 1 ? from : index,

0 commit comments

Comments
 (0)