root 4 days ago
parent
commit
ff09d477ad
1 changed files with 6 additions and 0 deletions
  1. 6 0
      ai-slibra-assistant/util/request_utils.py

+ 6 - 0
ai-slibra-assistant/util/request_utils.py

@@ -169,6 +169,10 @@ def business_service(session_id, uid, code, tools,  asr):
             mess = f"根据您的手机号查询到{nums}个小区," + ";".join(map(lambda x: ",".join(x), zip(neighbour, ["户号是"]* nums, cardNo)))+ "。解决轻按1, 未解决请安2."
         elif tools in ["meter_owner_phone", "meter_owner_neighbour"]:
             loc_phone = [[content['neighbourhoodName'], content['meterReaderPhone']] for content in contents]
+            loc_phone = filter(lambda x: len(x[1])>0, loc_phone)
+            if len(loc_phone)==0:
+                return ''
+            loc_phone = [i for i in loc_phone]
             mess = f"您查询的小区{loc_phone[0][0]},抄表员电话是{loc_phone[0][1]};抄表员电话是{loc_phone[0][1]}, 重听请说再说一次,是否已解决您的问题?"
         else:
             mess = ''
@@ -193,6 +197,8 @@ def business_service(session_id, uid, code, tools,  asr):
                 content = resp['data'].get("contents")
                 title = "NO" if content is None or len(content) == 0 else "YES"
                 businessContent = getContent(content, tools) if title == "YES" else ''
+                if len(businessContent)==0:
+                    title = "NO"
                 opt = [
                     {"title": title, "isFaq": False, "faqContent": '', "asr": asr, "businessContent": businessContent}]
                 logger.info(f"session:{session_id},code:{code},uid:{uid}, tools:{tools},asr:{asr}, opt:{opt}")