增加asr拦截 UI有bug需修改
authorhcj <1224667075@qq.com>
Tue, 22 Jul 2025 07:31:53 +0000 (15:31 +0800)
committerhcj <1224667075@qq.com>
Tue, 22 Jul 2025 07:31:53 +0000 (15:31 +0800)
code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp

index 619cb16..ff6c82c 100644 (file)
@@ -177,18 +177,23 @@ void uapi_UI_stop_start_asr_timeout(void)
 {
     asr_need_stop=1;
 }
+#if 0
+#define ASR_HODE
+#endif
 
 void uapi_UI_stop_asr(void)
 {
-    // SendMsgToUIService(UI_AI_JUMP_TO_RESULT_VIEW, 0, nullptr, 0);//先跳转到结果界面
+    #ifdef ASR_HODE
+    SendMsgToUIService(UI_AI_JUMP_TO_RESULT_VIEW, 0, nullptr, 0);//先跳转到结果界面
 
-    // if(strlen(result_str_asr))
-    // {
-    //     send_ai_txt(0,result_str_asr);
-    //     ble_set_ai_Question_str(result_str_asr);
+    if(strlen(result_str_asr))
+    {
+        send_ai_txt(0,result_str_asr);
+        ble_set_ai_Question_str(result_str_asr);
 
-    //     memset_s(result_str_asr,AI_RESULT_STR_LEN,0,AI_RESULT_STR_LEN);
-    // }
+        memset_s(result_str_asr,AI_RESULT_STR_LEN,0,AI_RESULT_STR_LEN);
+    }
+    #endif
 
     if(stop_AudioCaptureProcess_AI())
     {
@@ -713,6 +718,10 @@ bool aer_result_analysis(char *buf)
 
     if(is_end_bool==true)
     {
+        
+        #ifdef ASR_HODE
+        memcpy_s(&result_str_asr[strlen(result_str_asr)],AI_RESULT_STR_LEN/2,result_str,strlen(result_str));
+        #else
         memset_s(result_str_asr,256,0,256); 
         memcpy_s(result_str_asr,256,result_str,strlen(result_str));
         SendMsgToUIService(UI_AI_JUMP_TO_RESULT_VIEW, 0, nullptr, 0);//先跳转到结果界面
@@ -720,6 +729,7 @@ bool aer_result_analysis(char *buf)
         ble_set_ai_Question_str(result_str_asr);
         // stop_AudioCaptureProcess_AI();
         send_ai_txt(0,result_str_asr);
+        #endif
         
     }
     if(strcmp(event_str,"TranscriptionStarted")==0) //可以对话了,切换到聆听界面