Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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(
<SettingsScopeProvider search={{}} onChange={() => {}}>
<VoiceSettingsPanel />
</SettingsScopeProvider>,
);
await vi.waitFor(() =>
expect(notify).toHaveBeenCalledWith(
expect.objectContaining({
title: "Could not load transcription models",
description: "Could not authorize the environment request.",
}),
),
);
},
);
});
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/VoiceSettingsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading