ux: 无有效语音时友好提示

onStop 时:
- 识别文字 >=2 字: 自动发送 (正常流程)
- 识别文字 =1 字: toast '语音过短,请重试'
- 无识别文字: toast '未检测到语音,请重试'
This commit is contained in:
yuzhiran
2026-07-05 20:32:29 +08:00
parent 50bb3c45ed
commit 4e4e1ca271
@@ -184,6 +184,10 @@ function initRecorder() {
if (text && text.length >= 2) { if (text && text.length >= 2) {
inputText.value = text inputText.value = text
sendAnswer() sendAnswer()
} else if (text && text.length === 1) {
uni.showToast({ title: '语音过短,请重试', icon: 'none' })
} else if (!text) {
uni.showToast({ title: '未检测到语音,请重试', icon: 'none' })
} }
} }
manager.onError = (res) => { manager.onError = (res) => {