@adea-ai/app-framework 0.46.12 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/app/application.d.ts +2 -1
- package/dist/app/application.js +27 -16
- package/dist/app/create-application.js +6 -3
- package/dist/appearance/appearance-host.d.ts +2 -1
- package/dist/appearance/appearance-host.js +28 -21
- package/dist/appearance/editor.js +21 -3
- package/dist/framework-source.json +1 -1
- package/dist/shell/app-shell.d.ts +1 -1
- package/dist/shell/app-shell.js +97 -87
- package/dist/shell/app-utilities.d.ts +1 -1
- package/dist/shell/app-utilities.js +42 -23
- package/dist/shell/media-query.js +12 -10
- package/dist/shell/navigation-drawer.d.ts +1 -1
- package/dist/shell/navigation-drawer.js +6 -4
- package/dist/shell/poll.js +9 -11
- package/dist/shell/settings-sections.d.ts +1 -1
- package/dist/views/app-about.d.ts +1 -1
- package/dist/views/app-about.js +1 -1
- package/dist/views/app-appearance.d.ts +2 -1
- package/dist/views/app-appearance.js +4 -4
- package/dist/views/app-help.d.ts +1 -1
- package/dist/views/app-help.js +1 -1
- package/dist/views/app-settings.d.ts +2 -1
- package/dist/views/app-settings.js +15 -10
- package/dist/views/appearance-surface.d.ts +1 -1
- package/dist/views/appearance-surface.js +116 -91
- package/dist/views/update-surface.d.ts +1 -1
- package/dist/views/update-surface.js +1 -1
- package/dist/voice/voice-build.d.ts +62 -0
- package/dist/voice/voice-build.js +247 -0
- package/dist/voice/voice-client.d.ts +130 -0
- package/dist/voice/voice-client.js +405 -0
- package/dist/voice/voice-controls.d.ts +43 -0
- package/dist/voice/voice-controls.js +313 -0
- package/dist/voice/voice-host.d.ts +29 -0
- package/dist/voice/voice-host.js +248 -0
- package/dist/voice/voice-protocol.d.ts +127 -0
- package/dist/voice/voice-protocol.js +120 -0
- package/dist/voice/voice-settings.d.ts +15 -0
- package/dist/voice/voice-settings.js +1095 -0
- package/dist/voice/voice.d.ts +5 -0
- package/dist/voice/voice.js +5 -0
- package/package.json +32 -14
- package/src/app/application.tsx +28 -32
- package/src/appearance/appearance-host.tsx +30 -19
- package/src/appearance/editor.ts +25 -3
- package/src/shell/app-shell.tsx +46 -37
- package/src/shell/app-utilities.tsx +38 -40
- package/src/shell/media-query.ts +15 -10
- package/src/shell/navigation-drawer.tsx +1 -1
- package/src/shell/poll.ts +9 -10
- package/src/shell/settings-sections.ts +1 -1
- package/src/views/app-appearance.tsx +4 -3
- package/src/views/app-settings.tsx +2 -1
- package/src/views/appearance-surface.tsx +46 -35
- package/src/voice/voice-client.ts +579 -0
- package/src/voice/voice-controls.tsx +354 -0
- package/src/voice/voice-protocol.ts +189 -0
- package/src/voice/voice-settings.tsx +879 -0
- package/src/voice/voice.ts +13 -0
- package/templates/application/AGENTS.md +29 -0
- package/templates/application/src/web/main.tsx +2 -2
- package/templates/application/tsconfig.json +1 -1
- package/templates/application/vite.config.ts +1 -1
|
@@ -0,0 +1,879 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared Voice settings section (voice#32): one place for the dictation and read-aloud
|
|
3
|
+
* engines, their languages and models, language downloads, the person's own model folders,
|
|
4
|
+
* privacy switches and microphone access. Every choice goes through the client's per-device
|
|
5
|
+
* settings store; capabilities are re-read after each change so the page shows what will run.
|
|
6
|
+
*/
|
|
7
|
+
import { ActionButton } from '@adea-ai/ui/components/composites/action-button'
|
|
8
|
+
import { SettingsRow, SettingsSection } from '@adea-ai/ui/components/composites/settings'
|
|
9
|
+
import { Alert, AlertDescription } from '@adea-ai/ui/components/ui/alert'
|
|
10
|
+
import { NativeSelect, type NativeSelectProps } from '@adea-ai/ui/components/ui/native-select'
|
|
11
|
+
import { Progress } from '@adea-ai/ui/components/ui/progress'
|
|
12
|
+
import { Slider } from '@adea-ai/ui/components/ui/slider'
|
|
13
|
+
import { StatusChip, type StatusTone } from '@adea-ai/ui/components/ui/status-chip'
|
|
14
|
+
import { Switch } from '@adea-ai/ui/components/ui/switch'
|
|
15
|
+
import { Text } from '@adea-ai/ui/components/ui/typography'
|
|
16
|
+
import { VoiceError, type VoiceRoutingDecision } from '@adea-ai/voice/contract'
|
|
17
|
+
import type { VoiceSettings, VoiceSettingsPatch } from '@adea-ai/voice/settings'
|
|
18
|
+
import { AudioLines, Download, FolderPlus, Play, RotateCcw, Square, Trash2, X } from '@lucide/solid'
|
|
19
|
+
import type { JSX } from '@solidjs/web'
|
|
20
|
+
import { createEffect, createMemo, createSignal, For, onCleanup, Show } from 'solid-js'
|
|
21
|
+
import type { ApplicationSettingsSection } from '../shell/settings-sections'
|
|
22
|
+
import type {
|
|
23
|
+
InstallHandle,
|
|
24
|
+
LocaleAssetView,
|
|
25
|
+
SpeechHandle,
|
|
26
|
+
VoiceCapabilitiesView,
|
|
27
|
+
VoiceClient,
|
|
28
|
+
VoiceInfo,
|
|
29
|
+
VoicePermission,
|
|
30
|
+
VoiceProviderStatus,
|
|
31
|
+
} from './voice-client'
|
|
32
|
+
|
|
33
|
+
/** Languages offered everywhere, besides the system default and the device's own list. */
|
|
34
|
+
export const VOICE_COMMON_LOCALES = [
|
|
35
|
+
'en-US',
|
|
36
|
+
'es-419',
|
|
37
|
+
'es-ES',
|
|
38
|
+
'fr-FR',
|
|
39
|
+
'de-DE',
|
|
40
|
+
'pt-BR',
|
|
41
|
+
'it-IT',
|
|
42
|
+
'ja-JP',
|
|
43
|
+
'zh-CN',
|
|
44
|
+
] as const
|
|
45
|
+
|
|
46
|
+
/** Apple's SpeechAnalyzer provider, whose model a locale may borrow from an equivalent one. */
|
|
47
|
+
const APPLE_ANALYZER = 'apple.analyzer'
|
|
48
|
+
const SAMPLE_TEXT = 'This is how read aloud sounds.'
|
|
49
|
+
/** Settle a burst of changes (a slider drag, several switches) into one capabilities read. */
|
|
50
|
+
const REFRESH_DEBOUNCE_MS = 150
|
|
51
|
+
|
|
52
|
+
const APPLE_MODELS: NativeSelectProps['options'] = [
|
|
53
|
+
{ value: '', label: 'Automatic' },
|
|
54
|
+
{ value: 'analyzer', label: 'Modern' },
|
|
55
|
+
{ value: 'legacy', label: 'Compatibility' },
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
const ASSET_STATUS: Record<string, { label: string; tone: StatusTone }> = {
|
|
59
|
+
installed: { label: 'Installed', tone: 'success' },
|
|
60
|
+
notInstalled: { label: 'Not installed', tone: 'neutral' },
|
|
61
|
+
downloading: { label: 'Downloading', tone: 'pending' },
|
|
62
|
+
unsupported: { label: 'Unsupported', tone: 'unknown' },
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const PERMISSION_STATUS: Record<VoicePermission['state'], { label: string; tone: StatusTone }> = {
|
|
66
|
+
granted: { label: 'Allowed', tone: 'success' },
|
|
67
|
+
denied: { label: 'Denied', tone: 'danger' },
|
|
68
|
+
prompt: { label: 'Not asked yet', tone: 'neutral' },
|
|
69
|
+
unavailable: { label: 'Unavailable', tone: 'unknown' },
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function languageOf(locale: string): string {
|
|
73
|
+
return locale.split(/[-_]/)[0]!.toLowerCase()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The install state the analyzer reports for a locale (its equivalent model's state), or
|
|
78
|
+
* undefined when it says nothing about the download.
|
|
79
|
+
*/
|
|
80
|
+
function analyzerAssetStatus(view: VoiceCapabilitiesView): string | undefined {
|
|
81
|
+
const analyzer = view.providers.find((provider) => provider.id === APPLE_ANALYZER)
|
|
82
|
+
if (!analyzer) return undefined
|
|
83
|
+
if (analyzer.availability.status === 'available') return 'installed'
|
|
84
|
+
const reason = analyzer.availability.unavailable.reason
|
|
85
|
+
return reason === 'modelNotInstalled' || reason === 'modelDownloadDisabled'
|
|
86
|
+
? 'notInstalled'
|
|
87
|
+
: undefined
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function languageName(locale: string): string {
|
|
91
|
+
try {
|
|
92
|
+
return new Intl.DisplayNames(undefined, { type: 'language' }).of(locale) ?? locale
|
|
93
|
+
} catch {
|
|
94
|
+
return locale
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function errorText(error: unknown): string {
|
|
99
|
+
return VoiceError.wrapping(error).message
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function unavailableText(provider: VoiceProviderStatus): string | undefined {
|
|
103
|
+
if (provider.availability.status === 'available') return undefined
|
|
104
|
+
const { message, remedy } = provider.availability.unavailable
|
|
105
|
+
return remedy?.detail ? `${message} ${remedy.detail}` : message
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Where the routed engine runs, as a chip for the group's header. */
|
|
109
|
+
function RouteStatus(props: { decision?: VoiceRoutingDecision }) {
|
|
110
|
+
const status = () => {
|
|
111
|
+
const decision = props.decision
|
|
112
|
+
if (!decision) return { label: 'Checking', tone: 'pending' as StatusTone }
|
|
113
|
+
if (!decision.route || decision.availability.status !== 'available')
|
|
114
|
+
return {
|
|
115
|
+
label: 'Unavailable',
|
|
116
|
+
tone: 'warning' as StatusTone,
|
|
117
|
+
detail:
|
|
118
|
+
decision.availability.status === 'unavailable'
|
|
119
|
+
? decision.availability.unavailable.message
|
|
120
|
+
: undefined,
|
|
121
|
+
}
|
|
122
|
+
return decision.route.descriptor.execution === 'network'
|
|
123
|
+
? {
|
|
124
|
+
label: 'Uses network',
|
|
125
|
+
tone: 'info' as StatusTone,
|
|
126
|
+
detail: decision.route.descriptor.displayName,
|
|
127
|
+
}
|
|
128
|
+
: {
|
|
129
|
+
label: 'On this device',
|
|
130
|
+
tone: 'success' as StatusTone,
|
|
131
|
+
detail: decision.route.descriptor.displayName,
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return (
|
|
135
|
+
<StatusChip
|
|
136
|
+
data-voice-route={props.decision?.kind}
|
|
137
|
+
label={status().label}
|
|
138
|
+
tone={status().tone}
|
|
139
|
+
detail={status().detail}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Unavailable engines of one kind, each with its reason and remedy. Never hidden. */
|
|
145
|
+
function UnavailableEngines(props: { providers: readonly VoiceProviderStatus[] }) {
|
|
146
|
+
const unavailable = () =>
|
|
147
|
+
props.providers.filter((provider) => provider.availability.status === 'unavailable')
|
|
148
|
+
return (
|
|
149
|
+
<Show when={unavailable().length > 0}>
|
|
150
|
+
<div class="flex flex-col gap-1">
|
|
151
|
+
<For each={unavailable()}>
|
|
152
|
+
{(provider) => (
|
|
153
|
+
<Text variant="caption" tone="muted" data-voice-unavailable={provider.id}>
|
|
154
|
+
{provider.displayName}: {unavailableText(provider)}
|
|
155
|
+
</Text>
|
|
156
|
+
)}
|
|
157
|
+
</For>
|
|
158
|
+
</div>
|
|
159
|
+
</Show>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
type InstallState =
|
|
164
|
+
| { state: 'installing'; fraction: number | null }
|
|
165
|
+
| { state: 'failed'; message: string }
|
|
166
|
+
|
|
167
|
+
export type VoiceSettingsPanelProps = { client: VoiceClient }
|
|
168
|
+
|
|
169
|
+
/** The Voice settings section's content. */
|
|
170
|
+
export function VoiceSettingsPanel(props: VoiceSettingsPanelProps) {
|
|
171
|
+
const client = () => props.client
|
|
172
|
+
const [settings, setSettings] = createSignal<VoiceSettings>(client().settings.read().settings)
|
|
173
|
+
const [capabilities, setCapabilities] = createSignal<VoiceCapabilitiesView>()
|
|
174
|
+
const [voices, setVoices] = createSignal<readonly VoiceInfo[]>([])
|
|
175
|
+
const [locales, setLocales] = createSignal<readonly LocaleAssetView[]>([])
|
|
176
|
+
const [permission, setPermission] = createSignal<VoicePermission>()
|
|
177
|
+
const [installs, setInstalls] = createSignal<Readonly<Record<string, InstallState>>>({})
|
|
178
|
+
const [error, setError] = createSignal<string>()
|
|
179
|
+
const [testing, setTesting] = createSignal<SpeechHandle | 'starting'>()
|
|
180
|
+
const [rate, setRate] = createSignal(settings().tts.rate ?? 1)
|
|
181
|
+
const installHandles = new Map<string, InstallHandle>()
|
|
182
|
+
/** Model removals: asking to confirm, then running. */
|
|
183
|
+
const [removals, setRemovals] = createSignal<Readonly<Record<string, 'confirm' | 'removing'>>>({})
|
|
184
|
+
let alive = true
|
|
185
|
+
|
|
186
|
+
const unsubscribe = client().settings.subscribe((next) => setSettings(next))
|
|
187
|
+
onCleanup(() => {
|
|
188
|
+
alive = false
|
|
189
|
+
unsubscribe()
|
|
190
|
+
})
|
|
191
|
+
createEffect(
|
|
192
|
+
() => settings().tts.rate,
|
|
193
|
+
(value) => {
|
|
194
|
+
setRate(value ?? 1)
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
const update = (patch: VoiceSettingsPatch) => {
|
|
199
|
+
try {
|
|
200
|
+
client().settings.update(patch)
|
|
201
|
+
} catch (failure) {
|
|
202
|
+
setError(errorText(failure))
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Capabilities and voices follow the settings. A newer request wins: an older answer that
|
|
207
|
+
// arrives late is dropped, and nothing lands after the panel closes.
|
|
208
|
+
let generation = 0
|
|
209
|
+
const refresh = () => {
|
|
210
|
+
const mine = ++generation
|
|
211
|
+
const current = settings()
|
|
212
|
+
const fresh = () => alive && mine === generation
|
|
213
|
+
client()
|
|
214
|
+
.capabilities(current.stt.locale)
|
|
215
|
+
.then(
|
|
216
|
+
(view) => {
|
|
217
|
+
if (!fresh()) return
|
|
218
|
+
setCapabilities(view)
|
|
219
|
+
setPermission(view.permission)
|
|
220
|
+
},
|
|
221
|
+
(failure: unknown) => fresh() && setError(errorText(failure))
|
|
222
|
+
)
|
|
223
|
+
client()
|
|
224
|
+
.voices(current.tts.locale)
|
|
225
|
+
.then(
|
|
226
|
+
(list) => fresh() && setVoices(list),
|
|
227
|
+
(failure: unknown) => fresh() && setError(errorText(failure))
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
231
|
+
createEffect(settings, (_, previous) => {
|
|
232
|
+
if (previous === undefined) return refresh()
|
|
233
|
+
clearTimeout(timer)
|
|
234
|
+
timer = setTimeout(refresh, REFRESH_DEBOUNCE_MS)
|
|
235
|
+
})
|
|
236
|
+
onCleanup(() => clearTimeout(timer))
|
|
237
|
+
|
|
238
|
+
// A dictation language the device does not list on its own (es-419) can run on another
|
|
239
|
+
// locale's analyzer model (es_MX): the helper resolves that equivalence in its status. Asking
|
|
240
|
+
// for the analyzer's state at the tag itself marks it like the model it would use.
|
|
241
|
+
const [equivalentStatus, setEquivalentStatus] = createSignal<Readonly<Record<string, string>>>({})
|
|
242
|
+
const loadEquivalents = (list: readonly LocaleAssetView[]) => {
|
|
243
|
+
if (client().platform !== 'desktop') return
|
|
244
|
+
const listed = new Set(list.map((asset) => asset.locale))
|
|
245
|
+
const languages = new Set(list.map((asset) => languageOf(asset.locale)))
|
|
246
|
+
for (const tag of VOICE_COMMON_LOCALES) {
|
|
247
|
+
if (listed.has(tag) || !languages.has(languageOf(tag))) continue
|
|
248
|
+
client()
|
|
249
|
+
.capabilities(tag)
|
|
250
|
+
.then(
|
|
251
|
+
(view) => {
|
|
252
|
+
if (!alive) return
|
|
253
|
+
const status = analyzerAssetStatus(view)
|
|
254
|
+
setEquivalentStatus((current) => {
|
|
255
|
+
const { [tag]: _previous, ...rest } = current
|
|
256
|
+
return status ? { ...rest, [tag]: status } : rest
|
|
257
|
+
})
|
|
258
|
+
},
|
|
259
|
+
() => undefined
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const loadLocales = () => {
|
|
264
|
+
client()
|
|
265
|
+
.locales()
|
|
266
|
+
.then(
|
|
267
|
+
(list) => {
|
|
268
|
+
if (!alive) return
|
|
269
|
+
setLocales(list)
|
|
270
|
+
loadEquivalents(list)
|
|
271
|
+
},
|
|
272
|
+
(failure: unknown) => alive && setError(errorText(failure))
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
loadLocales()
|
|
276
|
+
|
|
277
|
+
const desktop = () => client().platform === 'desktop'
|
|
278
|
+
const offline = () => settings().privacy.offlineOnly
|
|
279
|
+
const providersOf = (kind: VoiceProviderStatus['kind']) =>
|
|
280
|
+
capabilities()?.providers.filter((provider) => provider.kind === kind) ?? []
|
|
281
|
+
|
|
282
|
+
const engineOptions = (kind: VoiceProviderStatus['kind']) => [
|
|
283
|
+
{ value: '', label: 'Automatic' },
|
|
284
|
+
...providersOf(kind).map((provider) => ({
|
|
285
|
+
value: provider.id,
|
|
286
|
+
label:
|
|
287
|
+
provider.availability.status === 'available'
|
|
288
|
+
? provider.displayName
|
|
289
|
+
: `${provider.displayName} (unavailable)`,
|
|
290
|
+
disabled: provider.availability.status !== 'available',
|
|
291
|
+
})),
|
|
292
|
+
]
|
|
293
|
+
|
|
294
|
+
const localeOptions = (selected: string | undefined) => {
|
|
295
|
+
const assets = new Map(locales().map((asset) => [asset.locale, asset.status]))
|
|
296
|
+
const tags = [...new Set([...VOICE_COMMON_LOCALES, ...assets.keys()])]
|
|
297
|
+
if (selected && !tags.includes(selected)) tags.push(selected)
|
|
298
|
+
return [
|
|
299
|
+
{ value: '', label: 'System default' },
|
|
300
|
+
...tags.map((tag) => {
|
|
301
|
+
const status = assets.get(tag) ?? equivalentStatus()[tag]
|
|
302
|
+
const suffix =
|
|
303
|
+
status && status !== 'installed'
|
|
304
|
+
? ` (${ASSET_STATUS[status]?.label.toLowerCase() ?? status})`
|
|
305
|
+
: ''
|
|
306
|
+
return { value: tag, label: `${languageName(tag)}${suffix}` }
|
|
307
|
+
}),
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const sttEngine = () =>
|
|
312
|
+
settings().stt.provider ?? capabilities()?.speechToText.route?.descriptor.id
|
|
313
|
+
const sttLocale = () => capabilities()?.speechToText.locale ?? settings().stt.locale
|
|
314
|
+
const transcribeModels = createMemo(() => {
|
|
315
|
+
const locale = sttLocale()
|
|
316
|
+
const language = locale?.split('-')[0]
|
|
317
|
+
return (capabilities()?.localModels ?? []).filter(
|
|
318
|
+
(model) =>
|
|
319
|
+
model.languages.length === 0 ||
|
|
320
|
+
model.languages.some(
|
|
321
|
+
(tag) => tag === locale || tag === language || tag.split('-')[0] === language
|
|
322
|
+
)
|
|
323
|
+
)
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
const voiceOptions = () => [
|
|
327
|
+
{ value: '', label: 'Automatic' },
|
|
328
|
+
...voices().map((voice) => ({ value: voice.id, label: voice.name })),
|
|
329
|
+
]
|
|
330
|
+
|
|
331
|
+
const testVoice = async () => {
|
|
332
|
+
const running = testing()
|
|
333
|
+
if (running) {
|
|
334
|
+
if (running !== 'starting') await running.cancel().catch(() => undefined)
|
|
335
|
+
setTesting(undefined)
|
|
336
|
+
return
|
|
337
|
+
}
|
|
338
|
+
setTesting('starting')
|
|
339
|
+
try {
|
|
340
|
+
const handle = await client().speak(
|
|
341
|
+
SAMPLE_TEXT,
|
|
342
|
+
settings().tts.locale ? { locale: settings().tts.locale } : {}
|
|
343
|
+
)
|
|
344
|
+
if (testing() !== 'starting') return void handle.cancel().catch(() => undefined)
|
|
345
|
+
setTesting(handle)
|
|
346
|
+
await handle.done
|
|
347
|
+
} catch (failure) {
|
|
348
|
+
const typed = VoiceError.wrapping(failure)
|
|
349
|
+
if (typed.code !== 'cancelled') setError(typed.message)
|
|
350
|
+
} finally {
|
|
351
|
+
if (alive) setTesting(undefined)
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
onCleanup(() => {
|
|
355
|
+
const running = testing()
|
|
356
|
+
if (running && running !== 'starting') void running.cancel().catch(() => undefined)
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
const setInstall = (locale: string, state: InstallState | undefined) =>
|
|
360
|
+
setInstalls((current) => {
|
|
361
|
+
const next = { ...current }
|
|
362
|
+
if (state) next[locale] = state
|
|
363
|
+
else delete next[locale]
|
|
364
|
+
return next
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
const install = async (locale: string) => {
|
|
368
|
+
if (offline()) return
|
|
369
|
+
setInstall(locale, { state: 'installing', fraction: null })
|
|
370
|
+
try {
|
|
371
|
+
const handle = await client().installAssets(locale, (fraction) => {
|
|
372
|
+
if (alive) setInstall(locale, { state: 'installing', fraction })
|
|
373
|
+
})
|
|
374
|
+
installHandles.set(locale, handle)
|
|
375
|
+
await handle.done
|
|
376
|
+
if (!alive) return
|
|
377
|
+
setInstall(locale, undefined)
|
|
378
|
+
loadLocales()
|
|
379
|
+
refresh()
|
|
380
|
+
} catch (failure) {
|
|
381
|
+
if (!alive) return
|
|
382
|
+
const typed = VoiceError.wrapping(failure)
|
|
383
|
+
setInstall(
|
|
384
|
+
locale,
|
|
385
|
+
typed.code === 'cancelled' ? undefined : { state: 'failed', message: typed.message }
|
|
386
|
+
)
|
|
387
|
+
} finally {
|
|
388
|
+
installHandles.delete(locale)
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
const setRemoval = (locale: string, state: 'confirm' | 'removing' | undefined) =>
|
|
392
|
+
setRemovals((current) => {
|
|
393
|
+
const next = { ...current }
|
|
394
|
+
if (state) next[locale] = state
|
|
395
|
+
else delete next[locale]
|
|
396
|
+
return next
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
/** Releases this app's claim on the language's model; the OS may then delete it. */
|
|
400
|
+
const remove = async (locale: string) => {
|
|
401
|
+
setRemoval(locale, 'removing')
|
|
402
|
+
try {
|
|
403
|
+
await client().releaseAssets(locale)
|
|
404
|
+
if (!alive) return
|
|
405
|
+
loadLocales()
|
|
406
|
+
refresh()
|
|
407
|
+
} catch (failure) {
|
|
408
|
+
if (alive) setError(errorText(failure))
|
|
409
|
+
} finally {
|
|
410
|
+
if (alive) setRemoval(locale, undefined)
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
const cancelInstall = (locale: string) => {
|
|
415
|
+
const handle = installHandles.get(locale)
|
|
416
|
+
if (!handle) return
|
|
417
|
+
handle.cancel().catch((failure: unknown) => setError(errorText(failure)))
|
|
418
|
+
}
|
|
419
|
+
onCleanup(() => {
|
|
420
|
+
for (const handle of installHandles.values()) void handle.cancel().catch(() => undefined)
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
const checkMicrophone = async () => {
|
|
424
|
+
try {
|
|
425
|
+
const result = await client().permission(true)
|
|
426
|
+
if (alive) setPermission(result)
|
|
427
|
+
} catch (failure) {
|
|
428
|
+
if (alive) setError(errorText(failure))
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
const addFolder = async () => {
|
|
433
|
+
const pick = client().pickFolder
|
|
434
|
+
if (!pick) return
|
|
435
|
+
try {
|
|
436
|
+
const folder = await pick()
|
|
437
|
+
if (!folder) return
|
|
438
|
+
const folders = settings().models.folders
|
|
439
|
+
if (!folders.includes(folder)) update({ models: { folders: [...folders, folder] } })
|
|
440
|
+
} catch (failure) {
|
|
441
|
+
setError(errorText(failure))
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const permissionState = () => permission()?.state ?? 'unavailable'
|
|
446
|
+
|
|
447
|
+
return (
|
|
448
|
+
<div class="flex min-w-0 flex-col gap-2" data-voice-settings>
|
|
449
|
+
<Show when={error()}>
|
|
450
|
+
{(message) => (
|
|
451
|
+
<Alert variant="destructive" data-voice-error>
|
|
452
|
+
<AlertDescription>{message()}</AlertDescription>
|
|
453
|
+
</Alert>
|
|
454
|
+
)}
|
|
455
|
+
</Show>
|
|
456
|
+
|
|
457
|
+
<SettingsSection
|
|
458
|
+
title="Dictation"
|
|
459
|
+
action={<RouteStatus decision={capabilities()?.speechToText} />}
|
|
460
|
+
>
|
|
461
|
+
<SettingsRow label="Engine" orientation="vertical">
|
|
462
|
+
<div class="flex flex-col gap-2">
|
|
463
|
+
<NativeSelect
|
|
464
|
+
data-voice-select="stt-engine"
|
|
465
|
+
options={engineOptions('speechToText')}
|
|
466
|
+
value={settings().stt.provider ?? ''}
|
|
467
|
+
onChange={(event) =>
|
|
468
|
+
update({
|
|
469
|
+
stt: { provider: event.currentTarget.value || undefined, model: undefined },
|
|
470
|
+
})
|
|
471
|
+
}
|
|
472
|
+
/>
|
|
473
|
+
<UnavailableEngines providers={providersOf('speechToText')} />
|
|
474
|
+
</div>
|
|
475
|
+
</SettingsRow>
|
|
476
|
+
<Show when={desktop() && sttEngine()?.startsWith('apple.')}>
|
|
477
|
+
<SettingsRow label="Model">
|
|
478
|
+
<NativeSelect
|
|
479
|
+
data-voice-select="stt-model"
|
|
480
|
+
options={APPLE_MODELS}
|
|
481
|
+
value={settings().stt.model ?? ''}
|
|
482
|
+
onChange={(event) =>
|
|
483
|
+
update({ stt: { model: event.currentTarget.value || undefined } })
|
|
484
|
+
}
|
|
485
|
+
/>
|
|
486
|
+
</SettingsRow>
|
|
487
|
+
</Show>
|
|
488
|
+
<Show when={sttEngine() === 'transcribe.cpp'}>
|
|
489
|
+
<SettingsRow label="Model">
|
|
490
|
+
<NativeSelect
|
|
491
|
+
data-voice-select="stt-model"
|
|
492
|
+
options={[
|
|
493
|
+
{ value: '', label: 'Automatic' },
|
|
494
|
+
...transcribeModels().map((model) => ({
|
|
495
|
+
value: model.path,
|
|
496
|
+
label: `${model.architecture} ${model.variant}`,
|
|
497
|
+
})),
|
|
498
|
+
]}
|
|
499
|
+
value={settings().stt.model ?? ''}
|
|
500
|
+
onChange={(event) =>
|
|
501
|
+
update({ stt: { model: event.currentTarget.value || undefined } })
|
|
502
|
+
}
|
|
503
|
+
/>
|
|
504
|
+
</SettingsRow>
|
|
505
|
+
</Show>
|
|
506
|
+
<SettingsRow label="Language">
|
|
507
|
+
<NativeSelect
|
|
508
|
+
data-voice-select="stt-locale"
|
|
509
|
+
options={localeOptions(settings().stt.locale)}
|
|
510
|
+
value={settings().stt.locale ?? ''}
|
|
511
|
+
onChange={(event) =>
|
|
512
|
+
update({ stt: { locale: event.currentTarget.value || undefined } })
|
|
513
|
+
}
|
|
514
|
+
/>
|
|
515
|
+
</SettingsRow>
|
|
516
|
+
<SettingsRow label="Send after dictating">
|
|
517
|
+
<Switch
|
|
518
|
+
data-voice-switch="auto-send"
|
|
519
|
+
checked={settings().dictation.autoSend}
|
|
520
|
+
onChange={(checked: boolean) => update({ dictation: { autoSend: checked } })}
|
|
521
|
+
/>
|
|
522
|
+
</SettingsRow>
|
|
523
|
+
</SettingsSection>
|
|
524
|
+
|
|
525
|
+
<SettingsSection
|
|
526
|
+
title="Read aloud"
|
|
527
|
+
action={<RouteStatus decision={capabilities()?.textToSpeech} />}
|
|
528
|
+
>
|
|
529
|
+
<SettingsRow label="Engine" orientation="vertical">
|
|
530
|
+
<div class="flex flex-col gap-2">
|
|
531
|
+
<NativeSelect
|
|
532
|
+
data-voice-select="tts-engine"
|
|
533
|
+
options={engineOptions('textToSpeech')}
|
|
534
|
+
value={settings().tts.provider ?? ''}
|
|
535
|
+
onChange={(event) =>
|
|
536
|
+
update({
|
|
537
|
+
tts: { provider: event.currentTarget.value || undefined, voice: undefined },
|
|
538
|
+
})
|
|
539
|
+
}
|
|
540
|
+
/>
|
|
541
|
+
<UnavailableEngines providers={providersOf('textToSpeech')} />
|
|
542
|
+
</div>
|
|
543
|
+
</SettingsRow>
|
|
544
|
+
<SettingsRow label="Language">
|
|
545
|
+
<NativeSelect
|
|
546
|
+
data-voice-select="tts-locale"
|
|
547
|
+
options={localeOptions(settings().tts.locale)}
|
|
548
|
+
value={settings().tts.locale ?? ''}
|
|
549
|
+
onChange={(event) =>
|
|
550
|
+
update({ tts: { locale: event.currentTarget.value || undefined, voice: undefined } })
|
|
551
|
+
}
|
|
552
|
+
/>
|
|
553
|
+
</SettingsRow>
|
|
554
|
+
<SettingsRow label="Voice">
|
|
555
|
+
<NativeSelect
|
|
556
|
+
data-voice-select="tts-voice"
|
|
557
|
+
options={voiceOptions()}
|
|
558
|
+
value={settings().tts.voice ?? ''}
|
|
559
|
+
onChange={(event) => update({ tts: { voice: event.currentTarget.value || undefined } })}
|
|
560
|
+
/>
|
|
561
|
+
</SettingsRow>
|
|
562
|
+
<SettingsRow label="Speaking rate">
|
|
563
|
+
<Slider
|
|
564
|
+
class="w-48"
|
|
565
|
+
aria-label="Speaking rate"
|
|
566
|
+
minValue={0.5}
|
|
567
|
+
maxValue={2}
|
|
568
|
+
step={0.1}
|
|
569
|
+
value={[rate()]}
|
|
570
|
+
format={(value) => `${value.toFixed(1)}×`}
|
|
571
|
+
onChange={(value) => setRate(value[0] ?? 1)}
|
|
572
|
+
onChangeEnd={(value) => update({ tts: { rate: value[0] } })}
|
|
573
|
+
/>
|
|
574
|
+
</SettingsRow>
|
|
575
|
+
<SettingsRow label="Test voice">
|
|
576
|
+
<ActionButton
|
|
577
|
+
type="button"
|
|
578
|
+
variant="outline"
|
|
579
|
+
size="sm"
|
|
580
|
+
data-voice-action="test-voice"
|
|
581
|
+
tooltip={testing() ? 'Stop the sample' : 'Play a short sample'}
|
|
582
|
+
aria-pressed={testing() ? 'true' : 'false'}
|
|
583
|
+
disabled={
|
|
584
|
+
!testing() && capabilities()?.textToSpeech.availability.status !== 'available'
|
|
585
|
+
}
|
|
586
|
+
onClick={() => void testVoice()}
|
|
587
|
+
>
|
|
588
|
+
<Show when={testing()} fallback={<Play aria-hidden="true" />}>
|
|
589
|
+
<Square aria-hidden="true" />
|
|
590
|
+
</Show>
|
|
591
|
+
{testing() ? 'Stop' : 'Test voice'}
|
|
592
|
+
</ActionButton>
|
|
593
|
+
</SettingsRow>
|
|
594
|
+
</SettingsSection>
|
|
595
|
+
|
|
596
|
+
<Show when={locales().length > 0}>
|
|
597
|
+
<SettingsSection
|
|
598
|
+
title="Language downloads"
|
|
599
|
+
description={offline() ? 'Downloads are off while Offline only is on.' : undefined}
|
|
600
|
+
>
|
|
601
|
+
<For each={locales()}>
|
|
602
|
+
{(asset) => {
|
|
603
|
+
const progress = () => installs()[asset.locale]
|
|
604
|
+
const installing = () => {
|
|
605
|
+
const current = progress()
|
|
606
|
+
return current?.state === 'installing' ? current : undefined
|
|
607
|
+
}
|
|
608
|
+
const failed = () => {
|
|
609
|
+
const current = progress()
|
|
610
|
+
return current?.state === 'failed' ? current : undefined
|
|
611
|
+
}
|
|
612
|
+
const status = () =>
|
|
613
|
+
ASSET_STATUS[asset.status] ?? { label: asset.status, tone: 'unknown' as StatusTone }
|
|
614
|
+
return (
|
|
615
|
+
<SettingsRow label={languageName(asset.locale)} data-voice-locale={asset.locale}>
|
|
616
|
+
<div class="flex items-center gap-2">
|
|
617
|
+
<Show when={!progress()}>
|
|
618
|
+
<StatusChip label={status().label} tone={status().tone} />
|
|
619
|
+
<Show when={asset.canInstall && asset.status === 'notInstalled'}>
|
|
620
|
+
<ActionButton
|
|
621
|
+
type="button"
|
|
622
|
+
variant="outline"
|
|
623
|
+
size="sm"
|
|
624
|
+
data-voice-action="download"
|
|
625
|
+
tooltip={
|
|
626
|
+
offline() ? 'Offline only is on' : 'Download for on-device dictation'
|
|
627
|
+
}
|
|
628
|
+
disabled={offline()}
|
|
629
|
+
onClick={() => void install(asset.locale)}
|
|
630
|
+
>
|
|
631
|
+
<Download aria-hidden="true" />
|
|
632
|
+
Download
|
|
633
|
+
</ActionButton>
|
|
634
|
+
</Show>
|
|
635
|
+
<Show when={asset.status === 'installed'}>
|
|
636
|
+
<Show
|
|
637
|
+
when={removals()[asset.locale]}
|
|
638
|
+
fallback={
|
|
639
|
+
<ActionButton
|
|
640
|
+
type="button"
|
|
641
|
+
variant="ghost"
|
|
642
|
+
size="icon-sm"
|
|
643
|
+
aria-label={`Remove ${languageName(asset.locale)}`}
|
|
644
|
+
data-voice-action="remove-model"
|
|
645
|
+
tooltip="Remove this language's model. macOS may delete it from this Mac."
|
|
646
|
+
onClick={() => setRemoval(asset.locale, 'confirm')}
|
|
647
|
+
>
|
|
648
|
+
<Trash2 aria-hidden="true" />
|
|
649
|
+
</ActionButton>
|
|
650
|
+
}
|
|
651
|
+
>
|
|
652
|
+
{(removal) => (
|
|
653
|
+
<>
|
|
654
|
+
<ActionButton
|
|
655
|
+
type="button"
|
|
656
|
+
variant="destructive"
|
|
657
|
+
size="sm"
|
|
658
|
+
data-voice-action="confirm-remove-model"
|
|
659
|
+
tooltip="macOS may delete the model; download it again to dictate in this language"
|
|
660
|
+
disabled={removal() === 'removing'}
|
|
661
|
+
onClick={() => void remove(asset.locale)}
|
|
662
|
+
>
|
|
663
|
+
<Trash2 aria-hidden="true" />
|
|
664
|
+
{removal() === 'removing' ? 'Removing…' : 'Remove'}
|
|
665
|
+
</ActionButton>
|
|
666
|
+
<ActionButton
|
|
667
|
+
type="button"
|
|
668
|
+
variant="ghost"
|
|
669
|
+
size="icon-sm"
|
|
670
|
+
aria-label="Keep the model"
|
|
671
|
+
data-voice-action="cancel-remove-model"
|
|
672
|
+
tooltip="Keep the model"
|
|
673
|
+
disabled={removal() === 'removing'}
|
|
674
|
+
onClick={() => setRemoval(asset.locale, undefined)}
|
|
675
|
+
>
|
|
676
|
+
<X aria-hidden="true" />
|
|
677
|
+
</ActionButton>
|
|
678
|
+
</>
|
|
679
|
+
)}
|
|
680
|
+
</Show>
|
|
681
|
+
</Show>
|
|
682
|
+
</Show>
|
|
683
|
+
<Show when={installing()}>
|
|
684
|
+
{(running) => (
|
|
685
|
+
<>
|
|
686
|
+
<Progress
|
|
687
|
+
class="w-40"
|
|
688
|
+
aria-label={`Downloading ${languageName(asset.locale)}`}
|
|
689
|
+
value={(running().fraction ?? 0) * 100}
|
|
690
|
+
indeterminate={running().fraction === null}
|
|
691
|
+
hideValue
|
|
692
|
+
/>
|
|
693
|
+
<ActionButton
|
|
694
|
+
type="button"
|
|
695
|
+
variant="ghost"
|
|
696
|
+
size="icon-sm"
|
|
697
|
+
aria-label="Cancel download"
|
|
698
|
+
data-voice-action="cancel-download"
|
|
699
|
+
tooltip="Cancel download"
|
|
700
|
+
onClick={() => cancelInstall(asset.locale)}
|
|
701
|
+
>
|
|
702
|
+
<X aria-hidden="true" />
|
|
703
|
+
</ActionButton>
|
|
704
|
+
</>
|
|
705
|
+
)}
|
|
706
|
+
</Show>
|
|
707
|
+
<Show when={failed()}>
|
|
708
|
+
{(failure) => (
|
|
709
|
+
<>
|
|
710
|
+
<StatusChip
|
|
711
|
+
label="Failed"
|
|
712
|
+
tone="danger"
|
|
713
|
+
detail={failure().message}
|
|
714
|
+
data-voice-install-error={failure().message}
|
|
715
|
+
/>
|
|
716
|
+
<ActionButton
|
|
717
|
+
type="button"
|
|
718
|
+
variant="outline"
|
|
719
|
+
size="sm"
|
|
720
|
+
data-voice-action="retry"
|
|
721
|
+
tooltip="Try the download again"
|
|
722
|
+
disabled={offline()}
|
|
723
|
+
onClick={() => void install(asset.locale)}
|
|
724
|
+
>
|
|
725
|
+
<RotateCcw aria-hidden="true" />
|
|
726
|
+
Retry
|
|
727
|
+
</ActionButton>
|
|
728
|
+
</>
|
|
729
|
+
)}
|
|
730
|
+
</Show>
|
|
731
|
+
</div>
|
|
732
|
+
</SettingsRow>
|
|
733
|
+
)
|
|
734
|
+
}}
|
|
735
|
+
</For>
|
|
736
|
+
</SettingsSection>
|
|
737
|
+
</Show>
|
|
738
|
+
|
|
739
|
+
<Show when={desktop()}>
|
|
740
|
+
<SettingsSection
|
|
741
|
+
title="Your models"
|
|
742
|
+
action={
|
|
743
|
+
<Show when={client().pickFolder}>
|
|
744
|
+
<ActionButton
|
|
745
|
+
type="button"
|
|
746
|
+
variant="outline"
|
|
747
|
+
size="sm"
|
|
748
|
+
data-voice-action="add-folder"
|
|
749
|
+
tooltip="Add a folder of speech models"
|
|
750
|
+
onClick={() => void addFolder()}
|
|
751
|
+
>
|
|
752
|
+
<FolderPlus aria-hidden="true" />
|
|
753
|
+
Add folder
|
|
754
|
+
</ActionButton>
|
|
755
|
+
</Show>
|
|
756
|
+
}
|
|
757
|
+
>
|
|
758
|
+
<For each={settings().models.folders}>
|
|
759
|
+
{(folder) => (
|
|
760
|
+
<SettingsRow label={folder} data-voice-folder={folder}>
|
|
761
|
+
<ActionButton
|
|
762
|
+
type="button"
|
|
763
|
+
variant="ghost"
|
|
764
|
+
size="icon-sm"
|
|
765
|
+
aria-label={`Remove ${folder}`}
|
|
766
|
+
data-voice-action="remove-folder"
|
|
767
|
+
tooltip="Remove from the list. Files stay on disk."
|
|
768
|
+
onClick={() =>
|
|
769
|
+
update({
|
|
770
|
+
models: {
|
|
771
|
+
folders: settings().models.folders.filter((entry) => entry !== folder),
|
|
772
|
+
},
|
|
773
|
+
})
|
|
774
|
+
}
|
|
775
|
+
>
|
|
776
|
+
<Trash2 aria-hidden="true" />
|
|
777
|
+
</ActionButton>
|
|
778
|
+
</SettingsRow>
|
|
779
|
+
)}
|
|
780
|
+
</For>
|
|
781
|
+
<Show
|
|
782
|
+
when={(capabilities()?.localModels.length ?? 0) > 0}
|
|
783
|
+
fallback={
|
|
784
|
+
<SettingsRow label="No models found" data-voice-models-empty>
|
|
785
|
+
{null}
|
|
786
|
+
</SettingsRow>
|
|
787
|
+
}
|
|
788
|
+
>
|
|
789
|
+
<For each={capabilities()?.localModels ?? []}>
|
|
790
|
+
{(model) => (
|
|
791
|
+
<SettingsRow
|
|
792
|
+
label={`${model.architecture} ${model.variant}`}
|
|
793
|
+
description={
|
|
794
|
+
model.languages.length > 0 ? model.languages.join(', ') : 'Multilingual'
|
|
795
|
+
}
|
|
796
|
+
data-voice-model={model.path}
|
|
797
|
+
>
|
|
798
|
+
{null}
|
|
799
|
+
</SettingsRow>
|
|
800
|
+
)}
|
|
801
|
+
</For>
|
|
802
|
+
</Show>
|
|
803
|
+
</SettingsSection>
|
|
804
|
+
</Show>
|
|
805
|
+
|
|
806
|
+
<SettingsSection title="Privacy">
|
|
807
|
+
<SettingsRow label="Offline only">
|
|
808
|
+
<Switch
|
|
809
|
+
data-voice-switch="offline-only"
|
|
810
|
+
checked={offline()}
|
|
811
|
+
onChange={(checked: boolean) => update({ privacy: { offlineOnly: checked } })}
|
|
812
|
+
/>
|
|
813
|
+
</SettingsRow>
|
|
814
|
+
<Show when={!desktop()}>
|
|
815
|
+
<SettingsRow label="Allow network dictation">
|
|
816
|
+
<Switch
|
|
817
|
+
data-voice-switch="network-dictation"
|
|
818
|
+
checked={!offline() && settings().stt.networkConsent}
|
|
819
|
+
disabled={offline()}
|
|
820
|
+
onChange={(checked: boolean) => update({ stt: { networkConsent: checked } })}
|
|
821
|
+
/>
|
|
822
|
+
</SettingsRow>
|
|
823
|
+
</Show>
|
|
824
|
+
<SettingsRow label="Allow downloads">
|
|
825
|
+
<Switch
|
|
826
|
+
data-voice-switch="allow-downloads"
|
|
827
|
+
checked={!offline() && settings().models.allowDownload}
|
|
828
|
+
disabled={offline()}
|
|
829
|
+
onChange={(checked: boolean) => update({ models: { allowDownload: checked } })}
|
|
830
|
+
/>
|
|
831
|
+
</SettingsRow>
|
|
832
|
+
</SettingsSection>
|
|
833
|
+
|
|
834
|
+
<SettingsSection title="Microphone">
|
|
835
|
+
<SettingsRow
|
|
836
|
+
label="Access"
|
|
837
|
+
description={
|
|
838
|
+
permissionState() === 'denied' && desktop()
|
|
839
|
+
? 'Allow access in System Settings › Privacy & Security'
|
|
840
|
+
: undefined
|
|
841
|
+
}
|
|
842
|
+
>
|
|
843
|
+
<div class="flex items-center gap-2">
|
|
844
|
+
<StatusChip
|
|
845
|
+
data-voice-permission={permissionState()}
|
|
846
|
+
label={PERMISSION_STATUS[permissionState()].label}
|
|
847
|
+
tone={PERMISSION_STATUS[permissionState()].tone}
|
|
848
|
+
/>
|
|
849
|
+
<ActionButton
|
|
850
|
+
type="button"
|
|
851
|
+
variant="outline"
|
|
852
|
+
size="sm"
|
|
853
|
+
data-voice-action="check-microphone"
|
|
854
|
+
tooltip="Ask for microphone access"
|
|
855
|
+
onClick={() => void checkMicrophone()}
|
|
856
|
+
>
|
|
857
|
+
Check microphone
|
|
858
|
+
</ActionButton>
|
|
859
|
+
</div>
|
|
860
|
+
</SettingsRow>
|
|
861
|
+
</SettingsSection>
|
|
862
|
+
</div>
|
|
863
|
+
)
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/** The Voice section for the shared settings dialog. */
|
|
867
|
+
export function voiceSettingsSection(options: {
|
|
868
|
+
client: VoiceClient
|
|
869
|
+
group?: string
|
|
870
|
+
}): ApplicationSettingsSection {
|
|
871
|
+
return {
|
|
872
|
+
id: 'voice',
|
|
873
|
+
label: 'Voice',
|
|
874
|
+
group: options.group ?? 'Application',
|
|
875
|
+
icon: (<AudioLines aria-hidden="true" />) as JSX.Element,
|
|
876
|
+
description: 'Dictation, read aloud and speech models.',
|
|
877
|
+
render: () => <VoiceSettingsPanel client={options.client} />,
|
|
878
|
+
}
|
|
879
|
+
}
|