fix(mobile): stop preloading answer TTS on native App
On native App the eager TTS request delayed the answer bubble: the message was created in `preparing` state, so the text stayed behind a voice line that was still waiting on a round trip. Skip the preload when `isNativeAppRuntime()`, marking the voice `unavailable` so the text and citations render immediately. The existing `unavailable` branch already exposes a play button that calls `toggleAnswerSpeech`, so voice stays reachable on demand instead of being dropped. H5 keeps preloading. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -993,6 +993,7 @@ const sendQuestion = async (
|
||||
}
|
||||
retireEarlierMemoryCandidate(nextResult.memoryCandidate?.id);
|
||||
const spoken = (nextResult.answer || '').trim();
|
||||
const shouldPreloadVoice = Boolean(spoken) && !isNativeAppRuntime();
|
||||
replaceMsg(pending.id, {
|
||||
id: pending.id,
|
||||
role: 'master',
|
||||
@@ -1004,12 +1005,12 @@ const sendQuestion = async (
|
||||
feedbackReasonCodes: [],
|
||||
feedbackComment: '',
|
||||
citationsOpen: false,
|
||||
voiceStatus: spoken ? 'preparing' : 'unavailable',
|
||||
voiceStatus: shouldPreloadVoice ? 'preparing' : 'unavailable',
|
||||
voiceDuration: null,
|
||||
unread: Boolean(spoken),
|
||||
transcriptOpen: false
|
||||
});
|
||||
if (spoken) void prepareVoice(pending.id, spoken);
|
||||
if (shouldPreloadVoice) void prepareVoice(pending.id, spoken);
|
||||
if (!nextResult.answer && !nextResult.snippets?.length && !nextResult.memoryCandidate) {
|
||||
pushSystem('未检索到可引用内容,换个问法试试');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user