fix(asr): 修复语音识别结果处理逻辑
- 修改了部分识别结果的处理方式,从覆盖改为追加模式 - 在最终结果处理中同步更新当前识别中间结果 - 修复了日志输出中的变量引用错误 - 确保语音识别流程中的文本传递一致性
这个提交包含在:
父节点
1c3e7ff073
当前提交
1ec9d8e917
@ -113,18 +113,19 @@ object AsrHelper : OfflineCmdListener {
|
|||||||
|
|
||||||
override fun onPartialResult(taskId: String, text: String) {
|
override fun onPartialResult(taskId: String, text: String) {
|
||||||
// 滚动更新当前识别中间结果
|
// 滚动更新当前识别中间结果
|
||||||
currentPartial = text
|
currentPartial += text
|
||||||
Log.d(TAG, "ASR partial: $text")
|
Log.d(TAG, "ASR partial: $text")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFinalResult(taskId: String, text: String) {
|
override fun onFinalResult(taskId: String, text: String) {
|
||||||
// 将最终结果追加拼接到会话字符串
|
// 将最终结果追加拼接到会话字符串
|
||||||
sessionBuilder.append(text)
|
sessionBuilder.append(text)
|
||||||
val fullText = sessionBuilder.toString()
|
|
||||||
isMicRunning = false
|
isMicRunning = false
|
||||||
Log.d(TAG, "ASR final result: $fullText")
|
// 滚动更新当前识别中间结果
|
||||||
|
currentPartial += text
|
||||||
|
Log.d(TAG, "ASR final result: $currentPartial")
|
||||||
IntentRecognizeHelper.recognize(
|
IntentRecognizeHelper.recognize(
|
||||||
text = fullText,
|
text = currentPartial,
|
||||||
scence = scene,
|
scence = scene,
|
||||||
onSuccess = { action ->
|
onSuccess = { action ->
|
||||||
if (action.name == "goToDecisionCenter") {
|
if (action.name == "goToDecisionCenter") {
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户