mirror of
https://github.com/PenumbraOS/mabl.git
synced 2026-02-03 17:40:45 -06:00
Separate out empty transcription STT error
This commit is contained in:
parent
a8719a2140
commit
3759fd7cd5
@ -77,12 +77,19 @@ class InteractionFlowManager
|
||||
if (didAbort) {
|
||||
return
|
||||
}
|
||||
Log.d(TAG, "STT final transcription: $finalText")
|
||||
setState(InteractionFlowState.PROCESSING)
|
||||
contentCallback?.onFinalTranscription(finalText)
|
||||
|
||||
// Start conversation with the transcribed text
|
||||
startConversationFromInput(finalText)
|
||||
if (finalText.trim().isEmpty()) {
|
||||
Log.d(TAG, "STT transcription was empty, skipping")
|
||||
setState(InteractionFlowState.IDLE)
|
||||
stateCallback?.onError(Error.SttError("Empty transcription"))
|
||||
} else {
|
||||
Log.d(TAG, "STT final transcription: $finalText")
|
||||
setState(InteractionFlowState.PROCESSING)
|
||||
contentCallback?.onFinalTranscription(finalText)
|
||||
|
||||
// Start conversation with the transcribed text
|
||||
startConversationFromInput(finalText)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(errorMessage: String) {
|
||||
|
||||
@ -39,8 +39,14 @@ class DemoSttService : MablService("DemoSttService") {
|
||||
client.stt.initialize(object : SttRecognitionListener() {
|
||||
override fun onError(error: Int) {
|
||||
try {
|
||||
currentCallback?.onError("Recognition error: $error")
|
||||
} catch (e: RemoteException) {
|
||||
// RecognitionError.ERROR_NO_MATCH
|
||||
if (error == 7) {
|
||||
Log.d("DemoSttService", "No speech recognized")
|
||||
currentCallback?.onFinalTranscription("")
|
||||
} else {
|
||||
currentCallback?.onError("Recognition error: $error")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e("DemoSttService", "Callback error", e)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user