fix(app-expo): allow read-aloud on other split segments while TTS paused
Match playback refs to the correct assistant segment so the interrupt overlay does not block other bubbles, and preempt local playback when switching segments. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,25 +3,9 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
|
||||
import { audioFocus } from '@/core/audio/audio-focus';
|
||||
|
||||
import type { PlaybackItem, PlayerStatus } from '../types';
|
||||
import { parseAssistantSplitListKey } from '@/features/conversation/message-split';
|
||||
|
||||
/**
|
||||
* `handleTtsSegment` 使用 `assistantSegmentMessageId` → `{uuid}_seg_{n}`;
|
||||
* 展平气泡使用 `{uuid}_part_{n}`。同一条落库助手消息上的连续分段应用入队续播,
|
||||
* 而不是「暂停后又到一条 tts_auto 就整轨切换成最新」——否则多段朗读只会听到最后一段。
|
||||
*/
|
||||
function parseAssistantSplitListKey(listKey: string | undefined): {
|
||||
messageId: string;
|
||||
segmentIndex: number;
|
||||
} | null {
|
||||
if (!listKey) return null;
|
||||
const m =
|
||||
/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})_(?:seg|part)_(\d+)$/i.exec(
|
||||
listKey,
|
||||
);
|
||||
if (!m) return null;
|
||||
return { messageId: m[1]!, segmentIndex: Number(m[2]) };
|
||||
}
|
||||
import type { PlaybackItem, PlayerStatus } from '../types';
|
||||
|
||||
function isLaterSegmentOfSameAssistantBubble(
|
||||
current: PlaybackItem | null | undefined,
|
||||
|
||||
Reference in New Issue
Block a user