diff --git a/apps/web/src/components/settings/VoiceSettingsPanel.browser.test.tsx b/apps/web/src/components/settings/VoiceSettingsPanel.browser.test.tsx index ab1c0187c2806..d06ed8af0cf01 100644 --- a/apps/web/src/components/settings/VoiceSettingsPanel.browser.test.tsx +++ b/apps/web/src/components/settings/VoiceSettingsPanel.browser.test.tsx @@ -1,4 +1,8 @@ -import { PrimaryConnectionTarget } from "@t3tools/client-runtime/connection"; +import { + RelayConnectionTarget, + PrimaryConnectionTarget, + type PreparedConnection, +} from "@t3tools/client-runtime/connection"; import { EnvironmentId, type EnvironmentSpeechModel, @@ -317,3 +321,42 @@ it("keeps punctuation in a saved dictionary term and its alias", async () => { { term: "O'Reilly", aliases: ['"Oh Really"'] }, ]); }); + +it("uses the connection authorizer when loading models from a relay destination", async () => { + const target = new RelayConnectionTarget({ + environmentId: EnvironmentId.make("voice-settings-relay"), + label: "Relay speech host", + }); + const prepared: PreparedConnection = { + target, + environmentId: target.environmentId, + label: target.label, + httpBaseUrl: "https://speech.example.test", + socketUrl: "wss://speech.example.test/ws", + httpAuthorization: { _tag: "Dpop", accessToken: "expired", expiresAtEpochMs: 0 }, + }; + using notify = vi.spyOn(toastManager, "add"); + await vi.mocked(useVoiceTranscriptionDestination).withImplementation( + () => ({ + environmentId: target.environmentId, + label: target.label, + grantId: "relay-test", + prepared, + }), + async () => { + await using _screen = await render( + {}}> + + , + ); + await vi.waitFor(() => + expect(notify).toHaveBeenCalledWith( + expect.objectContaining({ + title: "Could not load transcription models", + description: "Could not authorize the environment request.", + }), + ), + ); + }, + ); +}); diff --git a/apps/web/src/components/settings/VoiceSettingsPanel.tsx b/apps/web/src/components/settings/VoiceSettingsPanel.tsx index 596e3ea295ad7..ac5f20fd7feb1 100644 --- a/apps/web/src/components/settings/VoiceSettingsPanel.tsx +++ b/apps/web/src/components/settings/VoiceSettingsPanel.tsx @@ -44,7 +44,7 @@ import { useCleanupGrant, } from "../../speech/voiceConsent"; import { updateClientSettings, useClientSettings } from "../../hooks/useSettings"; -import { runtime } from "../../lib/runtime"; +import { speechRuntime as runtime } from "../../speech/runtime"; import { getCustomModelOptionsByInstance, resolveAppModelSelectionState,