Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots 📖

fix(voice): fill step descriptions from narration while the recording runs

Luis Ortizda891fb94e93
diff --git a/src/core/capture/voice/__tests__/partial-recording.test.ts b/src/core/capture/voice/__tests__/partial-recording.test.ts
new file mode 100644
index 0000000..f67a96d
--- /dev/null
+++ b/src/core/capture/voice/__tests__/partial-recording.test.ts
@@ -0,0 +1,52 @@
+import { describe, expect, it } from 'vitest';
+import { partialRecording } from '../partial-recording';
+
+const RATE = 16000;
+const EPOCH = 1_700_000_000_000;
+
+function recording(seconds: number) {
+ const pcm = new Int16Array(RATE * seconds);
+ for (let i = 0; i < pcm.length; i++) pcm[i] = i % 1000;
+ return { pcm, sampleRate: RATE, audioEpochMs: EPOCH, durationSeconds: seconds };
+}
+
+describe('partialRecording', () => {
+ it('takes only the samples inside the range', () => {
+ const part = partialRecording(recording(10), 4, 7);
+
+ expect(part?.pcm.length).toBe(RATE * 3);
+ expect(part?.durationSeconds).toBeCloseTo(3, 5);
+ });
+
+ it('moves the epoch forward to the start of the slice', () => {
+ const part = partialRecording(recording(10), 4, 7);
+
+ expect(part?.audioEpochMs).toBe(EPOCH + 4000);
+ });
+
+ it('carries the samples that were actually in the range', () => {
+ const full = recording(10);
+ const part = partialRecording(full, 4, 7);
+
+ expect(part?.pcm[0]).toBe(full.pcm[4 * RATE]);
+ });
+
+ it('clamps to the audio that exists when the range runs past the end', () => {
+ const part = partialRecording(recording(5), 3, 9);
+
+ expect(part?.pcm.length).toBe(RATE * 2);
+ expect(part?.durationSeconds).toBeCloseTo(2, 5);
+ });
+
+ it('returns nothing when the range is too short to hold speech', () => {
+ expect(partialRecording(recording(10), 4, 4.4)).toBeNull();
+ });
+
+ it('returns nothing when the range has already been consumed', () => {
+ expect(partialRecording(recording(10), 7, 4)).toBeNull();
+ });
+
+ it('returns nothing when the range starts past the end of the audio', () => {
+ expect(partialRecording(recording(5), 6, 9)).toBeNull();
+ });
+});
diff --git a/src/core/capture/voice/partial-recording.ts b/src/core/capture/voice/partial-recording.ts
new file mode 100644
index 0000000..70d3cb6
--- /dev/null
+++ b/src/core/capture/voice/partial-recording.ts
@@ -0,0 +1,26 @@
+import { MIN_SPEECH_S } from './batching';
+
+export interface RecordingSlice {
+ pcm: Int16Array;
+ sampleRate: number;
+ audioEpochMs: number;
+ durationSeconds: number;
+}
+
+export function partialRecording(
+ recording: RecordingSlice,
+ fromSeconds: number,
+ toSeconds: number,
+): RecordingSlice | null {
+ const { pcm, sampleRate, audioEpochMs } = recording;
+ const from = Math.max(0, Math.floor(fromSeconds * sampleRate));
+ const to = Math.min(pcm.length, Math.floor(toSeconds * sampleRate));
+ if (to - from < MIN_SPEECH_S * sampleRate) return null;
+
+ return {
+ pcm: pcm.slice(from, to),
+ sampleRate,
+ audioEpochMs: audioEpochMs + Math.round((from / sampleRate) * 1000),
+ durationSeconds: (to - from) / sampleRate,
+ };
+}
diff --git a/src/core/guides/__tests__/ai-pending.test.ts b/src/core/guides/__tests__/ai-pending.test.ts
index aa14ed8..d6bd524 100644
--- a/src/core/guides/__tests__/ai-pending.test.ts
+++ b/src/core/guides/__tests__/ai-pending.test.ts
@@ -223,3 +223,15 @@ describe('applyAiDescription', () => {
await expect(applyAiDescription('gone', AI_TEXT)).resolves.toBeUndefined();
});
});
+
+describe('narration clears the pending spinner', () => {
+ it('stops a narrated step from waiting on a description', async () => {
+ await db.steps.add(makeStep({ id: 's20', aiPending: true }));
+
+ await applyNarrationToSteps([{ stepId: 's20', description: 'what I said' }]);
+
+ const step = await db.steps.get('s20');
+ expect(step?.description).toBe('what I said');
+ expect(step?.aiPending).toBe(false);
+ });
+});
diff --git a/src/core/guides/service.ts b/src/core/guides/service.ts
index 725b966..13a522a 100644
--- a/src/core/guides/service.ts
+++ b/src/core/guides/service.ts
@@ -203,7 +203,7 @@ export async function applyNarrationToSteps(updates: readonly NarrationUpdate[])
if (updates.length === 0) return;
await db.transaction('rw', db.steps, async () => {
for (const { stepId, description } of updates) {
- await db.steps.update(stepId, { description, descriptionSource: 'narration' });
+ await db.steps.update(stepId, { description, descriptionSource: 'narration', aiPending: false });
}
});
notifyGuidesChanged({ type: 'mutated' });
diff --git a/src/entrypoints/background/__tests__/deferred-descriptions.test.ts b/src/entrypoints/background/__tests__/deferred-descriptions.test.ts
index 793e5bd..737aaa4 100644
--- a/src/entrypoints/background/__tests__/deferred-descriptions.test.ts
+++ b/src/entrypoints/background/__tests__/deferred-descriptions.test.ts
@@ -3,6 +3,7 @@ import type { DOMContext } from '@/core/capture/dom/context';
import {
clearDeferredDescriptions,
deferDescription,
+ discardDeferred,
shouldQueueAiDescription,
takeDeferredDescriptions,
} from '../deferred-descriptions';
@@ -80,3 +81,30 @@ describe('takeDeferredDescriptions', () => {
expect(takeDeferredDescriptions('g1', [])).toEqual([]);
});
});
+
+describe('discardDeferred', () => {
+ beforeEach(() => {
+ clearDeferredDescriptions('g1');
+ });
+
+ it('drops only the steps narration already covered', () => {
+ deferDescription('g1', 's1', ctx('one'));
+ deferDescription('g1', 's2', ctx('two'));
+
+ discardDeferred('g1', ['s1']);
+
+ expect(takeDeferredDescriptions('g1', []).map((p) => p.stepId)).toEqual(['s2']);
+ });
+
+ it('leaves the rest waiting for the end of the recording', () => {
+ deferDescription('g1', 's1', ctx('one'));
+
+ discardDeferred('g1', ['s2']);
+
+ expect(takeDeferredDescriptions('g1', []).map((p) => p.stepId)).toEqual(['s1']);
+ });
+
+ it('does nothing for a guide with nothing deferred', () => {
+ expect(() => discardDeferred('g1', ['s1'])).not.toThrow();
+ });
+});
diff --git a/src/entrypoints/background/deferred-descriptions.ts b/src/entrypoints/background/deferred-descriptions.ts
index af98748..e822497 100644
--- a/src/entrypoints/background/deferred-descriptions.ts
+++ b/src/entrypoints/background/deferred-descriptions.ts
@@ -40,6 +40,12 @@ export function takeDeferredDescriptions(guideId: string, narratedStepIds: reado
.map(([stepId, domContext]) => ({ stepId, domContext }));
}
+export function discardDeferred(guideId: string, stepIds: readonly string[]): void {
+ const forGuide = deferred.get(guideId);
+ if (!forGuide) return;
+ for (const stepId of stepIds) forGuide.delete(stepId);
+}
+
export function clearDeferredDescriptions(guideId: string): void {
deferred.delete(guideId);
}
diff --git a/src/entrypoints/background/guide-meta.ts b/src/entrypoints/background/guide-meta.ts
index 3211207..b03eae9 100644
--- a/src/entrypoints/background/guide-meta.ts
+++ b/src/entrypoints/background/guide-meta.ts
@@ -13,6 +13,7 @@ import { localStorage } from '@/lib/browser-api';
import { logger } from '@/lib/logger';
import type { GenerateGuideDescriptionResponse, GuideDescriptionError } from '@/lib/messaging';
import { drainDescriptions } from './description-queue';
+import { whenNarrationSettled } from './voice';
type ResolveFailure = Extract<GuideDescriptionError, 'no-api-key' | 'no-steps'>;
@@ -47,6 +48,7 @@ async function applyFallbackTitle(guideId: string) {
}
export async function settlePendingDescriptions(guideId: string) {
+ await whenNarrationSettled();
await drainDescriptions(guideId);
const pending = (await getStepsForGuide(guideId)).filter((s) => s.aiPending);
await Promise.all(pending.map((s) => clearStepAiPending(s.id)));
diff --git a/src/entrypoints/background/step-pipeline.ts b/src/entrypoints/background/step-pipeline.ts
index cc1c381..d89aaad 100644
--- a/src/entrypoints/background/step-pipeline.ts
+++ b/src/entrypoints/background/step-pipeline.ts
@@ -18,7 +18,7 @@ import { getActor } from './actor';
import { generateAiDescription } from './ai-description';
import { deferDescription, shouldQueueAiDescription } from './deferred-descriptions';
import { queueDescription } from './description-queue';
-import { getVoiceUpdate } from './voice';
+import { flushNarrationForStep, getVoiceUpdate } from './voice';
async function takeScreenshot(stepId: string, meta: ElementMeta): Promise<string | undefined> {
try {
@@ -87,6 +87,7 @@ export async function handleCaptureStep(data: CaptureStepData): Promise<CaptureS
narrationCapturing,
});
+ const timestamp = Date.now();
await createStep({
id: stepId,
guideId,
@@ -94,10 +95,10 @@ export async function handleCaptureStep(data: CaptureStepData): Promise<CaptureS
description: buildFallbackDescription(data.action, data.elementMeta),
action: data.action,
url: snap.context.currentUrl,
- timestamp: Date.now(),
+ timestamp,
screenshotId,
elementMeta: data.elementMeta,
- aiPending: willUseAI,
+ aiPending: willUseAI || narrationCapturing,
});
await addStepToGuide(guideId, stepId);
@@ -107,6 +108,8 @@ export async function handleCaptureStep(data: CaptureStepData): Promise<CaptureS
else if (narrationCapturing && hasAiKey) deferDescription(guideId, stepId, domContext);
}
+ if (narrationCapturing) void flushNarrationForStep(guideId, stepId, timestamp);
+
return { stepId };
}
diff --git a/src/entrypoints/background/voice.ts b/src/entrypoints/background/voice.ts
index 89bd79c..3ea52c8 100644
--- a/src/entrypoints/background/voice.ts
+++ b/src/entrypoints/background/voice.ts
@@ -8,6 +8,7 @@ import {
closeVoiceHost,
closeVoiceHostIfIdle,
ensureVoiceHost,
+ flushVoiceCapture,
hasVoiceHost,
openMicPermissionPage,
queryMicPermission,
@@ -31,6 +32,7 @@ import {
} from '@/lib/voice-messages';
import { narrateRecording, readTranscriptionSettings, type VoiceRecording } from '@/lib/voice-narration';
import { handedOffPcm, voiceStopAction } from '@/lib/voice-recovery';
+import { discardDeferred } from './deferred-descriptions';
import { describeUnnarratedSteps } from './describe-unnarrated';
const START_TIMEOUT_MS = 8000;
@@ -72,6 +74,30 @@ async function readVoiceSettings(): Promise<{ enabled: boolean; hasApiKey: boole
let orphanAudio: VoiceRecording | null = null;
let transcribingGuideId: string | null = null;
+let settleNarration: (() => void) | null = null;
+let narrationSettled: Promise<void> | null = null;
+
+const NARRATION_SETTLE_TIMEOUT_MS = 30000;
+
+export function whenNarrationSettled(): Promise<void> {
+ if (!narrationSettled) return Promise.resolve();
+ return Promise.race([
+ narrationSettled,
+ new Promise<void>((resolve) => setTimeout(resolve, NARRATION_SETTLE_TIMEOUT_MS)),
+ ]);
+}
+
+function markNarrationPending(): void {
+ narrationSettled = new Promise<void>((resolve) => {
+ settleNarration = resolve;
+ });
+}
+
+function markNarrationSettled(): void {
+ settleNarration?.();
+ settleNarration = null;
+ narrationSettled = null;
+}
function requestMicPermission(tabId?: number): void {
void openMicPermissionPage(tabId).catch((error) => logger.error('voice: mic permission page failed to open', error));
@@ -155,6 +181,18 @@ async function recoverNarration(guideId: string): Promise<void> {
await applyNarration(guideId, result);
}
+export async function flushNarrationForStep(guideId: string, stepId: string, timestamp: number): Promise<void> {
+ if (phase.phase !== 'recording') return;
+ try {
+ const settings = await readTranscriptionSettings();
+ if (!settings.apiKey) return;
+ const response = await flushVoiceCapture(guideId, { stepId, timestamp }, settings);
+ if (!response.ok) logger.warn('voice: could not narrate the step yet', response);
+ } catch (error) {
+ logger.warn('voice: narrating the step while recording failed', error);
+ }
+}
+
export async function stopVoiceNarration(guideId: string): Promise<void> {
if (!supportsVoice()) return;
try {
@@ -181,6 +219,7 @@ export async function stopVoiceNarration(guideId: string): Promise<void> {
if (response.ok) {
logger.info('voice: transcribing narration', response);
transcribingGuideId = guideId;
+ markNarrationPending();
if (phase.phase === 'recording') report({ phase: 'transcribing' });
return;
}
@@ -196,23 +235,33 @@ export async function stopVoiceNarration(guideId: string): Promise<void> {
}
async function applyNarration(guideId: string, result: VoiceResultEvent['result']): Promise<void> {
+ const final = transcribingGuideId === guideId;
try {
- transcribingGuideId = null;
+ if (final) transcribingGuideId = null;
const narrated = result.descriptions.map((entry) => entry.stepId);
const surviving = await findExistingStepIds(narrated);
const updates = narrationUpdates(result, surviving);
await applyNarrationToSteps(updates);
- logger.info('voice: narration applied', { narrated: updates.length, of: narrated.length, stats: result.stats });
- report({ phase: 'idle', narrated: updates.length });
- describeUnnarratedSteps(
- guideId,
- updates.map((update) => update.stepId),
- );
+ const narratedIds = updates.map((update) => update.stepId);
+ discardDeferred(guideId, narratedIds);
+ logger.info('voice: narration applied', {
+ narrated: updates.length,
+ of: narrated.length,
+ final,
+ stats: result.stats,
+ });
+ if (final) {
+ report({ phase: 'idle', narrated: updates.length });
+ describeUnnarratedSteps(guideId, narratedIds);
+ }
} catch (error) {
logger.error('voice: narration could not be applied', error);
- report({ phase: 'error', reason: 'unknown', error: String(error) });
+ if (final) report({ phase: 'error', reason: 'unknown', error: String(error) });
} finally {
- await closeVoiceHostIfIdle();
+ if (final) {
+ markNarrationSettled();
+ await closeVoiceHostIfIdle();
+ }
}
}
diff --git a/src/lib/mic-recorder.ts b/src/lib/mic-recorder.ts
index b2ce892..f47f48e 100644
--- a/src/lib/mic-recorder.ts
+++ b/src/lib/mic-recorder.ts
@@ -136,13 +136,17 @@ export class MicRecorder {
return { deviceId: stream.getAudioTracks()[0]?.getSettings().deviceId ?? null, usedFallbackDevice };
}
- stop(): MicRecording {
- const recording: MicRecording = {
+ snapshot(): MicRecording {
+ return {
pcm: concat(this.chunks, this.samples),
sampleRate: this.rate,
audioEpochMs: this.epochMs,
durationSeconds: this.durationSeconds,
};
+ }
+
+ stop(): MicRecording {
+ const recording = this.snapshot();
this.release();
return recording;
}
diff --git a/src/lib/offscreen.ts b/src/lib/offscreen.ts
index 8df4fe0..4d7c9b1 100644
--- a/src/lib/offscreen.ts
+++ b/src/lib/offscreen.ts
@@ -8,6 +8,8 @@ import {
VOICE_SIDEPANEL_TARGET,
type VoiceAbortRequest,
type VoiceAbortResponse,
+ type VoiceFlushRequest,
+ type VoiceFlushResponse,
VoiceMessage,
type VoicePermissionQueryRequest,
type VoicePermissionQueryResponse,
@@ -209,6 +211,23 @@ export function stopVoiceCapture(
);
}
+export function flushVoiceCapture(
+ guideId: string,
+ step: VoiceStepMark,
+ settings: VoiceTranscriptionSettings,
+): Promise<VoiceFlushResponse> {
+ return answered<VoiceFlushResponse>(
+ voiceMessage<VoiceFlushRequest>({
+ type: VoiceMessage.VOICE_FLUSH,
+ target: VOICE_OFFSCREEN_TARGET,
+ guideId,
+ step,
+ settings,
+ }),
+ { ok: false, reason: 'stream-ended', error: 'The microphone host is no longer available' },
+ );
+}
+
export function abortVoiceCapture(): Promise<VoiceAbortResponse> {
return request(voiceMessage<VoiceAbortRequest>({ type: VoiceMessage.VOICE_ABORT, target: VOICE_OFFSCREEN_TARGET }));
}
diff --git a/src/lib/voice-host.ts b/src/lib/voice-host.ts
index 0303ee2..1b17bd3 100644
--- a/src/lib/voice-host.ts
+++ b/src/lib/voice-host.ts
@@ -1,3 +1,4 @@
+import { partialRecording } from '@/core/capture/voice/partial-recording';
import type { NarrationResult } from '@/core/capture/voice/types';
import { getExtensionURL, onMessage, sendMessage } from './browser-api';
import { logger } from './logger';
@@ -11,6 +12,8 @@ import {
type VoiceErrorEvent,
type VoiceErrorReason,
type VoiceEvent,
+ type VoiceFlushRequest,
+ type VoiceFlushResponse,
type VoiceHandoffEvent,
type VoiceLevelEvent,
VoiceMessage,
@@ -71,6 +74,7 @@ async function permissionState(): Promise<VoicePermissionQueryResponse> {
export function createVoiceHost(): VoiceHost {
let pending = 0;
let retained: VoiceRecording | null = null;
+ let flushedUpToSeconds = 0;
const recorder = new MicRecorder(getExtensionURL('/pcm-processor.js'), {
onEpoch: (audioEpochMs) =>
@@ -133,6 +137,7 @@ export function createVoiceHost(): VoiceHost {
return { started: false, reason: 'already-recording', error: 'Microphone capture is already running' };
}
try {
+ flushedUpToSeconds = 0;
const stream = await recorder.start(request.deviceId);
logger.info('voice: microphone capture started', stream);
return { started: true, ...stream };
@@ -156,6 +161,32 @@ export function createVoiceHost(): VoiceHost {
deliver(guideId, result);
}
+ async function handleFlush(request: VoiceFlushRequest): Promise<VoiceFlushResponse> {
+ if (!recorder.recording) {
+ return { ok: false, reason: 'not-recording', error: 'Microphone capture is not running' };
+ }
+ if (!request.settings?.apiKey) {
+ return { ok: false, reason: 'missing-api-key', error: 'No transcription API key is configured' };
+ }
+
+ const full = usableRecording(recorder.snapshot());
+ if (!full) return { ok: true, flushed: false };
+
+ const closesAt = (request.step.timestamp - full.audioEpochMs) / 1000;
+ const slice = partialRecording(full, flushedUpToSeconds, closesAt);
+ if (!slice) return { ok: true, flushed: false };
+
+ flushedUpToSeconds = closesAt;
+ pending += 1;
+ try {
+ const result = await narrateRecording(slice, [request.step], request.settings);
+ if (result.descriptions.length > 0) deliver(request.guideId, result);
+ return { ok: true, flushed: result.descriptions.length > 0 };
+ } finally {
+ pending -= 1;
+ }
+ }
+
async function handleStop(request: VoiceStopRequest): Promise<VoiceStopResponse> {
if (!recorder.recording) {
return { ok: false, reason: 'not-recording', error: 'Microphone capture is not running' };
@@ -177,8 +208,14 @@ export function createVoiceHost(): VoiceHost {
return { ok: false, reason: 'missing-api-key', error: 'No transcription API key is configured' };
}
- retained = audio;
- void transcribeInBackground(request.guideId, audio, request.steps, settings);
+ const tail = flushedUpToSeconds > 0 ? partialRecording(audio, flushedUpToSeconds, audio.durationSeconds) : audio;
+ if (!tail) {
+ deliver(request.guideId, EMPTY_NARRATION);
+ return { ok: true, audioEpochMs, durationSeconds };
+ }
+
+ retained = tail;
+ void transcribeInBackground(request.guideId, tail, request.steps, settings);
return { ok: true, audioEpochMs, durationSeconds };
}
@@ -197,6 +234,8 @@ export function createVoiceHost(): VoiceHost {
switch (request.type) {
case VoiceMessage.VOICE_START:
return handleStart(request);
+ case VoiceMessage.VOICE_FLUSH:
+ return handleFlush(request);
case VoiceMessage.VOICE_STOP:
return handleStop(request);
case VoiceMessage.VOICE_ABORT:
diff --git a/src/lib/voice-messages.ts b/src/lib/voice-messages.ts
index 9acc35e..511f0f8 100644
--- a/src/lib/voice-messages.ts
+++ b/src/lib/voice-messages.ts
@@ -13,6 +13,7 @@ export type VoiceTarget =
export const VoiceMessage = {
VOICE_START: 'VOICE_START',
VOICE_STOP: 'VOICE_STOP',
+ VOICE_FLUSH: 'VOICE_FLUSH',
VOICE_ABORT: 'VOICE_ABORT',
VOICE_STATUS: 'VOICE_STATUS',
VOICE_PERMISSION_QUERY: 'VOICE_PERMISSION_QUERY',
@@ -76,6 +77,18 @@ export type VoiceStopResponse =
| { ok: true; audioEpochMs: number; durationSeconds: number }
| { ok: false; reason: VoiceErrorReason; error: string };
+export interface VoiceFlushRequest extends VoiceEnvelope {
+ type: typeof VoiceMessage.VOICE_FLUSH;
+ target: typeof VOICE_OFFSCREEN_TARGET;
+ guideId: string;
+ step: VoiceStepMark;
+ settings: VoiceTranscriptionSettings;
+}
+
+export type VoiceFlushResponse =
+ | { ok: true; flushed: boolean }
+ | { ok: false; reason: VoiceErrorReason; error: string };
+
export interface VoiceAbortRequest extends VoiceEnvelope {
type: typeof VoiceMessage.VOICE_ABORT;
target: typeof VOICE_OFFSCREEN_TARGET;
@@ -155,6 +168,7 @@ export interface VoicePermissionResultEvent extends VoiceEnvelope {
export type VoiceRequest =
| VoiceStartRequest
| VoiceStopRequest
+ | VoiceFlushRequest
| VoiceAbortRequest
| VoiceStatusRequest
| VoicePermissionQueryRequest;
diff --git a/src/locales/de.yml b/src/locales/de.yml
index 4e74062..3546253 100644
--- a/src/locales/de.yml
+++ b/src/locales/de.yml
@@ -216,6 +216,7 @@ editor:
descriptionErrorFailed: Beschreibung konnte nicht erstellt werden. Versuche es erneut.
descriptionErrorSaveFailed: Die Beschreibung wurde erstellt, konnte aber nicht gespeichert werden. Versuche es erneut.
writingStepDescription: "Beschreibung wird geschrieben…"
+ transcribingStepDescription: "Deine Aufnahme wird transkribiert…"
capture:
recordSteps: Schritte aufzeichnen
diff --git a/src/locales/en.yml b/src/locales/en.yml
index 215fab5..04d740a 100644
--- a/src/locales/en.yml
+++ b/src/locales/en.yml
@@ -203,6 +203,7 @@ editor:
descriptionErrorFailed: Could not generate a description. Try again.
descriptionErrorSaveFailed: Generated the description but could not save it. Try again.
writingStepDescription: "Writing description\u2026"
+ transcribingStepDescription: "Transcribing what you said…"
rewriteAskAi: Ask AI
rewritePlaceholder: "Tell AI how to edit this text\u2026"
rewriteEnter: Enter
diff --git a/src/locales/es.yml b/src/locales/es.yml
index 89cec9c..dc333a1 100644
--- a/src/locales/es.yml
+++ b/src/locales/es.yml
@@ -203,6 +203,7 @@ editor:
descriptionErrorFailed: No se pudo generar una descripción. Inténtalo de nuevo.
descriptionErrorSaveFailed: Se generó la descripción pero no se pudo guardar. Inténtalo de nuevo.
writingStepDescription: "Escribiendo descripci\xF3n\u2026"
+ transcribingStepDescription: "Transcribiendo lo que dijiste…"
rewriteAskAi: Preguntar a la IA
rewritePlaceholder: "Dile a la IA c\xF3mo editar este texto\u2026"
rewriteEnter: Intro
diff --git a/src/locales/fr.yml b/src/locales/fr.yml
index bbd783d..8ce0f64 100644
--- a/src/locales/fr.yml
+++ b/src/locales/fr.yml
@@ -203,6 +203,7 @@ editor:
descriptionErrorFailed: "Impossible de générer une description. Réessayez."
descriptionErrorSaveFailed: "Description générée mais impossible de l'enregistrer. Réessayez."
writingStepDescription: "R\xE9daction de la description\u2026"
+ transcribingStepDescription: "Transcription de ce que tu as dit…"
rewriteAskAi: "Demander \xE0 l'IA"
rewritePlaceholder: "Dites \xE0 l'IA comment modifier ce texte\u2026"
rewriteEnter: "Entr\xE9e"
diff --git a/src/locales/pt-BR.yml b/src/locales/pt-BR.yml
index 63e2976..2922f23 100644
--- a/src/locales/pt-BR.yml
+++ b/src/locales/pt-BR.yml
@@ -203,6 +203,7 @@ editor:
descriptionErrorFailed: Não foi possível gerar uma descrição. Tente novamente.
descriptionErrorSaveFailed: A descrição foi gerada mas não foi possível salvá-la. Tente novamente.
writingStepDescription: "Escrevendo descri\xE7\xE3o\u2026"
+ transcribingStepDescription: "Transcrevendo o que você disse…"
rewriteAskAi: "Perguntar \xE0 IA"
rewritePlaceholder: "Diga \xE0 IA como editar este texto\u2026"
rewriteEnter: Enter
diff --git a/src/ui/sidepanel/RecordingView.tsx b/src/ui/sidepanel/RecordingView.tsx
index ceca244..692d006 100644
--- a/src/ui/sidepanel/RecordingView.tsx
+++ b/src/ui/sidepanel/RecordingView.tsx
@@ -172,7 +172,11 @@ export default function RecordingView({ guideId, onStop, voice }: RecordingViewP
{liveStep.step.aiPending ? (
<p className="flex items-center gap-1.5 text-[13px] font-medium leading-snug text-muted-foreground">
<Loader2 size={13} className="animate-spin" />
- {i18n.t('editor.writingStepDescription')}
+ {i18n.t(
+ voice.phase === 'recording' || voice.phase === 'transcribing'
+ ? 'editor.transcribingStepDescription'
+ : 'editor.writingStepDescription',
+ )}
</p>
) : (
<p className="text-[13px] font-medium leading-snug text-foreground">