root 1 месяц назад
Родитель
Сommit
dcf9f313ba
2 измененных файлов с 110 добавлено и 35 удалено
  1. 79 30
      ai-slibra-assistant/data/robot.json
  2. 31 5
      ai-slibra-assistant/util/request_utils.py

+ 79 - 30
ai-slibra-assistant/data/robot.json

@@ -1009,17 +1009,41 @@
                 },
                 {
                     "commonReply": [
-                        "1"
+                        "好的",
+                        "嗯,好的",
+                        "是的",
+                        "对的",
+                        "是",
+                        "已解决",
+                        "解决了",
+                        "嗯,是的",
+                        "没错",
+                        "没问题",
+                        "就是这个",
+                        "嗯,解决了"
                     ],
                     "next": "101.00",
-                    "title": "1"
+                    "title": "肯定回复"
                 },
                 {
                     "commonReply": [
-                        "2"
+                        "查的不对",
+                        "不查这个",
+                        "不查这个小区",
+                        "没解决",
+                        "你查错了",
+                        "错了",
+                        "没解决",
+                        "没",
+                        "没有",
+                        "不对",
+                        "错了",
+                        "查的什么",
+                        "不是这个",
+                        "不是这个小区"
                     ],
                     "next": "2.10",
-                    "title": "2"
+                    "title": "否定回复"
                 },
                 {
                     "commonReply": [
@@ -1620,20 +1644,6 @@
                     "next": "100.01",
                     "title": "播放次数超限"
                 },
-                {
-                    "commonReply": [
-                        "1"
-                    ],
-                    "next": "101.00",
-                    "title": "1"
-                },
-                {
-                    "commonReply": [
-                        "2"
-                    ],
-                    "next": "4.10",
-                    "title": "2"
-                },
                 {
                     "commonReply": [
                         "others"
@@ -1969,6 +1979,28 @@
                     "next": "100.01",
                     "title": "播放次数超限"
                 },
+                {
+                    "commonReply": [
+                        "转人工",
+                        "人工客服",
+                        "转人工客服",
+                        "找人工客服",
+                        "转给人工",
+                        "你找个人和我说",
+                        "请安排人工服务",
+                        "请转人工",
+                        "换个人来跟我说呗",
+                        "转人工服务",
+                        "接通人工",
+                        "我不想跟机器人说话",
+                        "转接人工吗",
+                        "请转人工台",
+                        "我转人工",
+                        "选择人工"
+                    ],
+                    "next": "99.00",
+                    "title": "转人工"
+                },
                 {
                     "commonReply": [
                         "others"
@@ -2011,20 +2043,13 @@
         {
             "id": "4.60",
             "inputType": "0",
-            "mainContent": "您可以拨打,824,777,6,查询用户编号。重听请说再说一次 。如需其他服务请按1",
+            "mainContent": "您可以拨打,824/--/777/--/6,查询用户编号。还有什么可以帮您?",
             "mainContentType": "txt",
             "mainInterrupt": false,
             "mainType": "fixed",
             "maxTimes": 2,
             "nodeName": "引导用户编号查询",
             "options": [
-                {
-                    "commonReply": [
-                        "1"
-                    ],
-                    "next": "101.00",
-                    "title": "1"
-                },
                 {
                     "commonReply": [
                         "再说一遍",
@@ -2504,17 +2529,41 @@
                 },
                 {
                     "commonReply": [
-                        "1"
+                        "好的",
+                        "嗯,好的",
+                        "是的",
+                        "对的",
+                        "是",
+                        "已解决",
+                        "解决了",
+                        "嗯,是的",
+                        "没错",
+                        "没问题",
+                        "就是这个",
+                        "嗯,解决了"
                     ],
                     "next": "101.00",
-                    "title": "1"
+                    "title": "肯定回复"
                 },
                 {
                     "commonReply": [
-                        "2"
+                        "查的不对",
+                        "不查这个",
+                        "不查这个小区",
+                        "没解决",
+                        "你查错了",
+                        "错了",
+                        "没解决",
+                        "没",
+                        "没有",
+                        "不对",
+                        "错了",
+                        "查的什么",
+                        "不是这个",
+                        "不是这个小区"
                     ],
                     "next": "5.10",
-                    "title": "2"
+                    "title": "否定回复"
                 },
                 {
                     "commonReply": [

+ 31 - 5
ai-slibra-assistant/util/request_utils.py

@@ -149,20 +149,20 @@ def business_service(session_id, uid, code, tools,  asr):
             conclusions = [f"预计{time}恢复供水" if time is not None else "暂未确定恢复时间" for time in timeEnd]
             nums = len(neighbourhoodName)
             mess +=";".join([",".join(i) for i in zip(neighbourhoodName, reason, timeBegin, conclusions)])
-            mess +=",解决轻按1,未解决请按2"
+            mess +=",是否已解决您的问题?"
         elif tools in ["fee_info", "fee_user_info"]:
             mess = "您账户截止"
             statisticsTime = [content.get("statisticsTime", '') for content in contents]
             waterFees = [round(float(content.get("waterFees", 0)), 2) for content in contents]
-            meterAmount = [round(float(content.get("meterAmount", 0)),2) for content in contents]
-            mess = mess + statisticsTime[0] + "您的抄表表数为"+str(meterAmount[0]) +"欠费金额为" + str(waterFees[0])+ "元。如需详细查询缴费和水量情况可以登陆佳木斯供水公众号,如需人工查询请拨打8247777,解决轻按1, 未解决请按2."
+            meterAmount = [round(float(content.get("meterAmount", 0)), 2) for content in contents]
+            mess = mess + statisticsTime[0] + "您的抄表表数为"+str(meterAmount[0]) +"欠费金额为" + str(waterFees[0])+ "元。如需详细查询缴费和水量情况可以登陆佳木斯供水公众号,如需人工查询请拨打824/--/777/--/6,还有什么可以帮你?."
         elif tools in ["user_info", "user_phone_info"]:
             neighbour, cardNo = [content.get("neighbourhoodName") for content in contents], [content.get("userNo") for content in contents]
             nums = len(neighbour)
             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]
-            mess = f"您查询的小区{loc_phone[0][0]},抄表员电话是{loc_phone[0][1]},抄表员电话是{loc_phone[0][1]}, 重听请说再说一次,解决轻按“1”, 未解决请按“2”."
+            mess = f"您查询的小区{loc_phone[0][0]},抄表员电话是{loc_phone[0][1]};抄表员电话是{loc_phone[0][1]}, 重听请说再说一次,是否已解决您的问题?"
         else:
             mess = ''
         return mess
@@ -176,8 +176,34 @@ def business_service(session_id, uid, code, tools,  asr):
     if tools in ["water_loc_info", "fee_user_info", "user_phone_info", "meter_owner_neighbour"] and len(asr)==0:
         return [{"title": "NO", "isFaq": False, "faqContent": '', "asr": asr, "businessContent": ''}]
     # parse water_loc_info
-    if tools in ["water_loc_info", "meter_owner_neighbour"]:
+    if tools in ["water_loc_info", "meter_owner_neighbour", "water_info", "meter_owner_phone"]:
         asr = norm_community(asr)
+    if tools in ["water_info", "meter_owner_phone"]:
+        newtools = "water_loc_info" if tools == "water_info" else "meter_owner_neighbour"
+        param = json.dumps(dict(nodeId=code,
+                                userId=uid,
+                                sessionId=session_id,
+                                asrText=asr,
+                                method=newtools
+                                ), ensure_ascii=False)
+        try:
+            # 192.168.40.21
+            res = requests.post(f"http://{SERVE_HOST}:8001/bigModel/queryBusinessInfo",
+                                param.encode("UTF-8"),
+                                headers={'Content-Type': 'application/json;charset=utf-8'},
+                                timeout=30)
+            resp = json.loads(res.text)
+            logger.info(f"bussiness:{resp}, tools:{tools}, session:{session_id}")
+            if resp['code'] == "0":
+                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 ''
+                opt = [
+                    {"title": title, "isFaq": False, "faqContent": '', "asr": asr, "businessContent": businessContent}]
+                logger.info(f"code:{code},uid:{uid}, tools:{tools},asr:{asr}, opt:{opt}")
+                return opt
+        except Exception as e:
+            logger.info(f"bussion service服务异常:session:{session_id}, tools:{tools},uid:{uid}:{e}")
     param = json.dumps(dict(nodeId=code,
                             userId=uid,
                             sessionId=session_id,