fix: transcription segment dedup, store finalisation, and panel colours
- transcriptionService: track finalizedSegmentCount so only newly-final segments are emitted per WS message (was re-processing full array each time, causing the live segment to freeze in the completed list) - transcriptionStore: saveSegment isFinal branch now appends the passed text directly instead of currentSegment (currentSegment was stale relative to the incoming final) - CCTranscriptionPanel: record button colour changed from var(--color-text) to explicit #2563eb so it is visible in dark mode; completed segment backgrounds changed from hardcoded #fff to var(--color-muted) so text is readable in both themes; keyword Add button gets same blue fix Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -249,11 +249,9 @@ export const useTranscriptionStore = create<TranscriptionState>((set, get) => ({
|
||||
const { completedSegments, currentSegment, activeSession, wordCount } = get();
|
||||
|
||||
if (isFinal) {
|
||||
// Final segment - move current to completed, clear current
|
||||
const newCompleted = [...completedSegments];
|
||||
if (currentSegment && currentSegment.text.trim()) {
|
||||
newCompleted.push({ ...currentSegment, isFinal: true });
|
||||
}
|
||||
// Final segment — append the finalized text directly (not currentSegment, which
|
||||
// may lag behind or duplicate when WhisperLive re-sends the full segments array).
|
||||
const newCompleted = [...completedSegments, { text, isFinal: true, ...metadata }];
|
||||
const newWordCount = newCompleted.reduce(
|
||||
(sum, seg) => sum + seg.text.trim().split(/\s+/).filter(Boolean).length,
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user