π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(voice): pass transcription settings to the host instead of reading storage there
Luis Ortiz14b8405e04cd
diff --git a/src/entrypoints/background/voice.ts b/src/entrypoints/background/voice.tsindex 166ab63..8b5f217 100644--- a/src/entrypoints/background/voice.ts+++ b/src/entrypoints/background/voice.ts@@ -168,7 +168,8 @@ export async function stopVoiceNarration(guideId: string): Promise<void> {}const steps = await getStepsForGuide(guideId);- const response = await stopVoiceCapture(guideId, stepMarks(steps));+ const settings = await readTranscriptionSettings();+ const response = await stopVoiceCapture(guideId, stepMarks(steps), settings);if (response.ok) {logger.info('voice: transcribing narration', response);diff --git a/src/lib/offscreen.ts b/src/lib/offscreen.tsindex 1060d1a..8df4fe0 100644--- a/src/lib/offscreen.ts+++ b/src/lib/offscreen.ts@@ -20,6 +20,7 @@ import {type VoiceStepMark,type VoiceStopRequest,type VoiceStopResponse,+ type VoiceTranscriptionSettings,voiceMessage,} from './voice-messages';import { isVoiceStatus } from './voice-recovery';@@ -191,9 +192,19 @@ export function startVoiceCapture(deviceId?: string): Promise<VoiceStartResponse);}-export function stopVoiceCapture(guideId: string, steps: VoiceStepMark[]): Promise<VoiceStopResponse> {+export function stopVoiceCapture(+ guideId: string,+ steps: VoiceStepMark[],+ settings: VoiceTranscriptionSettings,+): Promise<VoiceStopResponse> {return answered<VoiceStopResponse>(- voiceMessage<VoiceStopRequest>({ type: VoiceMessage.VOICE_STOP, target: VOICE_OFFSCREEN_TARGET, guideId, steps }),+ voiceMessage<VoiceStopRequest>({+ type: VoiceMessage.VOICE_STOP,+ target: VOICE_OFFSCREEN_TARGET,+ guideId,+ steps,+ settings,+ }),{ ok: false, reason: 'stream-ended', error: 'The microphone host is no longer available' },);}diff --git a/src/lib/voice-host.ts b/src/lib/voice-host.tsindex b7af3c2..0303ee2 100644--- a/src/lib/voice-host.ts+++ b/src/lib/voice-host.ts@@ -25,13 +25,7 @@ import {type VoiceStopResponse,voiceMessage,} from './voice-messages';-import {- EMPTY_NARRATION,- narrateRecording,- readTranscriptionSettings,- type TranscriptionSettings,- type VoiceRecording,-} from './voice-narration';+import { EMPTY_NARRATION, narrateRecording, type TranscriptionSettings, type VoiceRecording } from './voice-narration';export interface VoiceHost {handle(request: VoiceRequest): Promise<unknown>;@@ -178,8 +172,8 @@ export function createVoiceHost(): VoiceHost {return { ok: true, audioEpochMs, durationSeconds };}- const settings = await readTranscriptionSettings();- if (!settings.apiKey) {+ const settings = request.settings;+ if (!settings?.apiKey) {return { ok: false, reason: 'missing-api-key', error: 'No transcription API key is configured' };}diff --git a/src/lib/voice-messages.ts b/src/lib/voice-messages.tsindex bda26cc..a78b51d 100644--- a/src/lib/voice-messages.ts+++ b/src/lib/voice-messages.ts@@ -57,11 +57,18 @@ export interface VoiceStepMark {timestamp: number;}+export interface VoiceTranscriptionSettings {+ provider: string;+ apiKey: string;+ language?: string;+}+export interface VoiceStopRequest extends VoiceEnvelope {type: typeof VoiceMessage.VOICE_STOP;target: typeof VOICE_OFFSCREEN_TARGET;guideId: string;steps: VoiceStepMark[];+ settings: VoiceTranscriptionSettings;}export type VoiceStopResponse =