@@ -25,10 +25,10 @@ import { useEnvironmentScope } from "~/state/session";
2525import { useAtomCommand } from "~/state/use-atom-command" ;
2626import { Button } from "../ui/button" ;
2727import { Select , SelectItem , SelectPopup , SelectTrigger , SelectValue } from "../ui/select" ;
28+ import { Switch } from "../ui/switch" ;
2829import { toastManager } from "../ui/toast" ;
2930import { EnvironmentRow , environmentTransportLabel } from "./EnvironmentRow" ;
3031import { FoldedSettingsSection } from "./FoldedSettingsSection" ;
31- import { ScopedSwitch } from "./ScopedSwitch" ;
3232import { useSettingsScope } from "./SettingsScopeContext" ;
3333import { SettingsRow , SettingsSection } from "./settingsLayout" ;
3434import { searchableSetting } from "./settingsSearch" ;
@@ -84,7 +84,7 @@ const modelDetail = (model: DictationModel) =>
8484
8585// Scope model installation to each selected environment.
8686export function DictationSettingsSection ( ) {
87- const { scope, environment, connectedEnvironments } = useSettingsScope ( ) ;
87+ const { scope, environment, connectedEnvironments, targets } = useSettingsScope ( ) ;
8888 const environmentId =
8989 environment ?. connection . phase === "connected" && environment . serverConfig !== null
9090 ? environment . environmentId
@@ -93,6 +93,9 @@ export function DictationSettingsSection() {
9393 // A server from before dictation has no dictation methods, so its subscription fails outright.
9494 const outdated = environmentId !== null && state === null && error !== null ;
9595 const settings = useScopedSettings ( ( unified ) => unified . dictation ) ;
96+ const engineMixed = targets . some (
97+ ( target ) => target . settings . dictation . engine !== settings . engine ,
98+ ) ;
9699 const updateSettings = useUpdateScopedSettings ( ) ;
97100 const canConfigure = useEnvironmentScope ( environmentId , AuthSettingsWriteScope ) ;
98101 const projectScope = scope . kind === "project" || scope . kind === "checkout" ;
@@ -116,9 +119,9 @@ export function DictationSettingsSection() {
116119 : "Transcribe dictation on this environment with a local speech model. Audio is not sent to any other service."
117120 }
118121 control = {
119- < ScopedSwitch
120- settingKeys = { [ "dictation" ] }
121- checked = { settings . engine === "local" }
122+ < Switch
123+ mixed = { engineMixed }
124+ checked = { ! engineMixed && settings . engine === "local" }
122125 disabled = { locked }
123126 aria-label = "Dictation"
124127 onCheckedChange = { ( checked ) =>
@@ -277,12 +280,10 @@ function InactiveDictationModels(props: {
277280 const [ removing , setRemoving ] = useState < DictationModel [ "id" ] | null > ( null ) ;
278281 if ( ! state ?. supported ) return null ;
279282 const inactive = state . models . filter (
280- // The environment keeps its own active model even when another environment's
281- // selection is shown; removing it would be a no-op on the server.
282283 ( model ) =>
283284 model . install . _tag === "installed" &&
284- model . id !== props . selectedModel &&
285- model . id !== state . settings . localModel ,
285+ ( state . settings . engine === "off" ||
286+ ( model . id !== props . selectedModel && model . id !== state . settings . localModel ) ) ,
286287 ) ;
287288 if ( inactive . length === 0 ) return null ;
288289
0 commit comments