fix(mobile): handle file picker cancellation
This commit is contained in:
@@ -463,6 +463,7 @@ import { isNativeAppRuntime, type SpeechCapture } from '@/services/speech-captur
|
||||
import { downloadSummaryCardImage } from '@/services/summary-card-image';
|
||||
import { getMemoryCandidates } from '@/services/personal-assistant';
|
||||
import { currentAccountKey } from '@/services/request-scope';
|
||||
import { isFileSelectionCancelled } from '@/utils/file-selection';
|
||||
import {
|
||||
clearBroadcastQuestionContext,
|
||||
getBroadcastMessage,
|
||||
@@ -1084,8 +1085,10 @@ const pickMedia = async () => {
|
||||
icon: 'none'
|
||||
});
|
||||
} catch (error) {
|
||||
const text = error instanceof Error ? error.message : '附件选择失败';
|
||||
if (text !== '未选择附件') uni.showToast({ title: text, icon: 'none' });
|
||||
if (!isFileSelectionCancelled(error)) {
|
||||
const text = error instanceof Error ? error.message : '附件选择失败';
|
||||
uni.showToast({ title: text, icon: 'none' });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1150,8 +1153,10 @@ const pickVoiceAudio = async () => {
|
||||
void sendQuestion(text, { voice: true });
|
||||
} catch (error) {
|
||||
if (generation !== voiceTranscriptionGeneration) return;
|
||||
const text = error instanceof Error ? error.message : '语音转写失败,请改用文字输入';
|
||||
if (text !== '未选择音频') pushSystem(text);
|
||||
if (!isFileSelectionCancelled(error)) {
|
||||
const text = error instanceof Error ? error.message : '语音转写失败,请改用文字输入';
|
||||
pushSystem(text);
|
||||
}
|
||||
} finally {
|
||||
if (generation === voiceTranscriptionGeneration) {
|
||||
abortVoiceTranscription = null;
|
||||
|
||||
Reference in New Issue
Block a user