shanghui 3 달 전
부모
커밋
5e2ab3f1c9
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      src/core/voip/bot.py

+ 6 - 0
src/core/voip/bot.py

@@ -457,10 +457,16 @@ class ToTextBotAgent:
                         self.call_agent.logger.info("响应中没有 'data' 字段")
                 else:
                     # 错误处理
+                    response={"node_id":"100.01","contents":[{"content_type":"voice","content":"感谢您的来电,祝您生活愉快,再见!","voice_url":"/root/aibot/dm/voice/buy.wav","voice_content":""}],"wait_time":1,"action":{"action_code":"hang","action_content":"机器人挂断"},"inputType":"0"}
+                    parsed_response = ChatMessage.from_json(response)
+                    self.call_agent.message_queue.put(parsed_response)
                     self.call_agent.logger.info(f"请求失败,状态码: {response.status_code}, 响应内容: {response.text}")
             except requests.RequestException as e:
                 traceback.print_exc()
                 self.call_agent.logger.error(f"TaskId={request.taskId}, 请求发生异常: {e}, URL: {url}")
+                response={"node_id":"100.01","contents":[{"content_type":"voice","content":"感谢您的来电,祝您生活愉快,再见!","voice_url":"/root/aibot/dm/voice/buy.wav","voice_content":""}],"wait_time":1,"action":{"action_code":"hang","action_content":"机器人挂断"},"inputType":"0"}
+                parsed_response = ChatMessage.from_json(response)
+                self.call_agent.message_queue.put(parsed_response)
             finally:
                 latency = (time.time() - start_time)
                 registry.BOT_REQUEST_COUNT.inc()