1.解决deepseek回应慢问题
authorluozheng <1732036298@qq.com>
Sat, 19 Jul 2025 10:18:11 +0000 (18:18 +0800)
committerluozheng <1732036298@qq.com>
Sat, 19 Jul 2025 10:18:11 +0000 (18:18 +0800)
2.解决4G网络AI   所有AI  询问问题后,AI在回答问题时候中断,进行下一个问题,回答的还是上一个问题

code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp

index 2809b07..c6d09c6 100644 (file)
@@ -22,7 +22,7 @@
 #define CURRENT_AIAUDIO_TYPE AIAUDIO_TYPE_SBC
 
 #if defined(SUPPORT_CHINA_MOBILE_DMP) || defined(SUPPORT_CHINA_MOBILE_AI_REGULATION)
-    #define AI_VOICE_JIUTIAN  // 九天版本
+    #define AI_VOICE_FD230  // 九天版本
 #elif defined(BOARD_N9)
     #define AI_VOICE_N9 //N9 星辰Ai
 #else
@@ -156,6 +156,8 @@ namespace OHOS
         std::string GetAccumulatedText(void);
         void sendSegment(const std::string &text, size_t pos);
 
+        static bool cur_ai_4g_answer_update;
+
     private:
         AiVoiceModel();
         ~AiVoiceModel();
index 8cd0d07..f151a90 100644 (file)
@@ -1676,6 +1676,7 @@ namespace OHOS
     static osTimerId_t g_start_ai_answer_update_Handle = nullptr;
     static constexpr const int8_t NUMBER_THREE = 3;
     static int8_t START_UPDATE_AIANSWER_CNT = NUMBER_THREE;
+    bool AiVoiceModel::cur_ai_4g_answer_update = false;
     static void AI4G_START_AI_ANSWER_CallbackProc(int data)
     {
         START_UPDATE_AIANSWER_CNT--;
@@ -1685,7 +1686,15 @@ namespace OHOS
         }
         else
         {
-            AiVoiceModel::GetInstance().UpdateAiAnswerStr();
+            if(!AiVoiceModel::cur_ai_4g_answer_update)
+            {
+                AiVoiceModel::cur_ai_4g_answer_update = true;
+                if(AiVoiceModel::GetInstance().UpdateAiAnswerStr())
+                {
+                    AiVoiceModel::cur_ai_4g_answer_update = false;
+                    LOS_Msleep(10);
+                }
+            }
         }
     }
 
@@ -1745,6 +1754,7 @@ namespace OHOS
             }
             g_start_ai_answer_update_Handle = nullptr;
             START_UPDATE_AIANSWER_CNT = NUMBER_THREE;
+            AiVoiceModel::cur_ai_4g_answer_update = false;
         }
     }
 
index 7902488..c148744 100644 (file)
@@ -438,7 +438,7 @@ namespace OHOS
             aiModelPicker->SetStyle(STYLE_BORDER_RADIUS, 150);
             aiModelPicker->SetItemHeight(40);
             aiModelPicker->SetLoopState(true);
-#if defined(AI_VOICE_JIUTIAN) || defined(AI_VOICE_N9)
+#if defined(AI_VOICE_FD230) || defined(AI_VOICE_N9)
 #else
             aiModelPicker->SetRotateFactor(1.0);
             aiModelPicker->RequestFocus();
@@ -546,7 +546,7 @@ namespace OHOS
         container_->SetOnClickListener(presenter_);
 
         ChangeView(MAX_AIVOICE_VIEWID, AIVOICE_STARTCHAT_VIEWID);
-#if defined(AI_VOICE_JIUTIAN) || defined(AI_VOICE_N9)
+#if defined(AI_VOICE_FD230) || defined(AI_VOICE_N9)
         CreateAiVoiceVoiceView();
 #endif
 
index 033eae4..7c24fe1 100644 (file)
@@ -133,14 +133,11 @@ void uapi_UI_start_asr(uint8_t type)
     // uapi_stop_tts();
 
     
-    if(type_ai!=type)
+    type_ai=type;
+    if(chat_client)
     {
-        type_ai=type;
-        if(chat_client)
-        {
-            chat_server_deinit();
-            chat_reconnect=1;
-        }
+        chat_server_deinit();
+        chat_reconnect=1;
     }
 
 
@@ -442,7 +439,7 @@ void bk_websocket_demo(void *data) {
                 }
                 else if(type_ai==AI_TYPE_DE)
                 {
-                    chat_client = init_websocket_client("ws://118.145.158.207:22080/chat/ws?platform=huoshan&model=ep-20250206162546-g74w6",NULL,0);
+                    chat_client = init_websocket_client("ws://118.145.158.207:22080/chat/ws?platform=huoshan&model=ep-20250205103849-582m7",NULL,0);
                 }
                 else 
                 {