修改金三隐性问题,以及解决对话到AMP关闭的bug
authorazao <821478748@qq.com>
Thu, 30 Oct 2025 05:47:56 +0000 (13:47 +0800)
committerazao <821478748@qq.com>
Thu, 30 Oct 2025 05:47:56 +0000 (13:47 +0800)
2.sdk/project/K8/sdk/services/microPython/ports/quectel/core/ai_VC.py

index 837e970..4523816 100644 (file)
@@ -1372,6 +1372,7 @@ class AI_VC(Abstract):
         self.Close_flag =0 #=1时,连续对话播放完音频就退出
         self.AI_alarm = _ai_alarm.AI_alarm()
         self.buffer = bytearray(1024*8) #音频缓存区
+        self.tts_completed = 0#音频是否播放过
         self.stop_tts = 0#音频是否播放完
         #表情变化状态以及检索词
         self.face_status = 0 # 0为正常,1为哭泣,2为愤怒,3为疑惑
@@ -2060,7 +2061,7 @@ class AI_VC(Abstract):
         EventMesh.subscribe("draw_handle", self.draw_handle)
         EventMesh.subscribe("dmp_update", self.dmp_update)
         EventMesh.subscribe("update_volume", self.update_volume)
-        EventMesh.subscribe("AI_VC_Close", self.Close)
+        EventMesh.subscribe("AI_VC_Close", self.AI_VC_Close)
         EventMesh.publish("close_led")
 
         self.bot_name = "柒先生"
@@ -3149,6 +3150,7 @@ class AI_VC(Abstract):
                         elif jsload_data["event"] == "tts.completed" :#tts结束
                             EventMesh.publish("open_led_green")#绿色
                             EventMesh.publish("publish_AI_btnInfo",{"func":self.VC_Play_Start})
+                            self.tts_completed = 1
                             self.LocalRespondingEnded_timerout = 0
                             self.VC_state = VC_State_TTSEnd
                             pass
@@ -3163,9 +3165,10 @@ class AI_VC(Abstract):
                             #EventMesh.publish("open_led_green")#绿色
                             self.LocalRespondingEnded_timerout = 3
                             self.VC_state = VC_State_End
-                            if self.stop_tts == 1:
+                            if self.stop_tts == 1 and self.tts_completed == 1:#已经播放了音频并且音频停止了
                                 self.AI_client_VC_end_tts()#音频结束
                                 self.stop_tts = 0
+                                self.tts_completed = 0
                             EventMesh.publish("send_device_VC_state")#上传VC状态
                             pass
                         elif jsload_data["event"] == "command" :#命令匹配
@@ -4560,7 +4563,8 @@ class AI_VC(Abstract):
         print("factory_timer_cb play......")
         #self.aud.play(1,0,'U:/static/peizhichenggong.mp3')#切换成功
         EventMesh.publish("audio_montage_play",["xinhaoruo1.mp3"])
-
+    def AI_VC_Close(self,event,msg):
+        EventMesh.publish("publish_AI_btnInfo",{"func":self.Close}) 
     def Close(self):
         self.VC_Thinking_timerout = 0
         self.VC_satrt_flag = 0