Skip to content

Commit 59500eb

Browse files
rosscadoclaude
andcommitted
fix: map refinement sequence to target for response routing
Fixes P1 code review issue where refinement transcriptions were being discarded due to missing sequence→element mapping. When uploading combined audio for Phase 2 refinement, we now properly map the returned sequence number to the target element via `context.transcriptionTargets[sequenceNum]`. This allows the refinement response handler to correctly identify and update the target field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 63d1dd2 commit 59500eb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/state-machines/DictationMachine.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,7 @@ const machine = createMachine<DictationContext, DictationEvent, DictationTypesta
14661466
Object.keys(targetTranscriptions).forEach(key => {
14671467
const seq = parseInt(key, 10);
14681468
delete context.transcriptions[seq];
1469+
delete context.transcriptionTargets[seq]; // Clean up target mapping too
14691470
});
14701471

14711472
// Store the refined transcription
@@ -1977,6 +1978,9 @@ const machine = createMachine<DictationContext, DictationEvent, DictationTypesta
19771978
`[DictationMachine] Refinement transcription sent with sequence ${sequenceNum} for target ${targetId}`
19781979
);
19791980

1981+
// Map the refinement sequence to the target element so the response can be routed correctly
1982+
context.transcriptionTargets[sequenceNum] = targetElement;
1983+
19801984
// Track this as an active refinement
19811985
context.activeRefinementSequences.set(targetId, sequenceNum);
19821986

0 commit comments

Comments
 (0)