Skip to content

Commit 8e92637

Browse files
feat(stt): add loading and unreachable state banners for local STT
1 parent f140090 commit 8e92637

File tree

2 files changed

+69
-2
lines changed

2 files changed

+69
-2
lines changed

apps/desktop/src/components/main/sidebar/banner/registry.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,53 @@ export function createBannerRegistry({
3434
}: BannerRegistryParams): BannerRegistryEntry[] {
3535
// order matters
3636
return [
37+
{
38+
banner: {
39+
id: "stt-loading",
40+
description: (
41+
<>
42+
Transcription model is
43+
<strong className="font-mono animate-ping text-amber-500">
44+
loading
45+
</strong>
46+
. This may take a moment.
47+
</>
48+
),
49+
primaryAction: {
50+
label: "View status",
51+
onClick: onOpenSTTSettings,
52+
},
53+
dismissible: false,
54+
},
55+
condition: () =>
56+
isLocalSttModel &&
57+
sttServerStatus === "loading" &&
58+
!hasSttConfigured &&
59+
!isAiTranscriptionTabActive,
60+
},
61+
{
62+
banner: {
63+
id: "stt-unreachable",
64+
variant: "error",
65+
description: (
66+
<>
67+
Transcription model{" "}
68+
<strong className="font-mono text-red-500">failed to start</strong>.
69+
Please try again.
70+
</>
71+
),
72+
primaryAction: {
73+
label: "Configure transcription",
74+
onClick: onOpenSTTSettings,
75+
},
76+
dismissible: false,
77+
},
78+
condition: () =>
79+
isLocalSttModel &&
80+
sttServerStatus === "unreachable" &&
81+
!hasSttConfigured &&
82+
!isAiTranscriptionTabActive,
83+
},
3784
{
3885
banner: {
3986
id: "missing-stt",

apps/desktop/src/components/settings/ai/stt/select.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { cn } from "@hypr/utils";
1515

1616
import { useBillingAccess } from "../../../../billing";
1717
import { useConfigValues } from "../../../../config/use-config";
18+
import { useSTTConnection } from "../../../../hooks/useSTTConnection";
1819
import * as settings from "../../../../store/tinybase/settings";
1920
import { getProviderSelectionBlockers, requiresEntitlement } from "../shared/eligibility";
2021
import { HealthCheckForConnection } from "./health";
@@ -27,6 +28,16 @@ export function SelectProviderAndModel() {
2728
] as const);
2829
const billing = useBillingAccess();
2930
const configuredProviders = useConfiguredMapping();
31+
const { local: sttLocal } = useSTTConnection();
32+
const sttServerStatus = sttLocal.data?.status;
33+
34+
const isLocalSttModel =
35+
current_stt_provider === "hyprnote" &&
36+
!!current_stt_model &&
37+
current_stt_model !== "cloud";
38+
39+
const isUnreachable = isLocalSttModel && sttServerStatus === "unreachable";
40+
const isNotConfigured = !current_stt_provider || !current_stt_model;
3041

3142
const handleSelectProvider = settings.UI.useSetValueCallback(
3243
"current_stt_provider",
@@ -72,7 +83,7 @@ export function SelectProviderAndModel() {
7283
className={cn([
7384
"flex flex-col gap-4",
7485
"p-4 rounded-xl border border-neutral-200",
75-
!!current_stt_provider && !!current_stt_model ? "bg-neutral-50" : "bg-red-50",
86+
isNotConfigured || isUnreachable ? "bg-red-50" : "bg-neutral-50",
7687
])}
7788
>
7889
<div className="flex flex-row items-center gap-4">
@@ -184,14 +195,23 @@ export function SelectProviderAndModel() {
184195
{current_stt_provider && current_stt_model && <HealthCheckForConnection />}
185196
</div>
186197

187-
{(!current_stt_provider || !current_stt_model) && (
198+
{isNotConfigured && (
188199
<div className="flex items-center gap-2 pt-2 border-t border-red-200">
189200
<span className="text-sm text-red-600">
190201
<strong className="font-medium">Transcription model</strong> is needed to make
191202
Hyprnote listen to your conversations.
192203
</span>
193204
</div>
194205
)}
206+
207+
{isUnreachable && (
208+
<div className="flex items-center gap-2 pt-2 border-t border-red-200">
209+
<span className="text-sm text-red-600">
210+
<strong className="font-medium">Transcription model</strong>{" "}
211+
failed to start. Please try again.
212+
</span>
213+
</div>
214+
)}
195215
</div>
196216
</div>
197217
);

0 commit comments

Comments
 (0)