gushoubang il y a 6 mois
Parent
commit
5fd577caff
1 fichiers modifiés avec 14 ajouts et 10 suppressions
  1. 14 10
      app/services/chat_service.py

+ 14 - 10
app/services/chat_service.py

@@ -121,16 +121,12 @@ def create_chat(msg,type):
                 landType = json_res["landType"]
                 poi = json_res["poi"]
                 # if landType != "未找到相关数据" and landType != "" and districtName  != "未找到相关数据"and districtName != "":
-                if  poi == "":
-
-                    if landType in land and districtName in addtress:
-                        json_res = jsonResToDict(json_res)
-                        # print(json_res)
-                    else:
-                        json_res = prompt
-                        json_res = res_error(json_res, "selectLand","error")
+                
+
+                if landType in land and districtName in addtress:
+                    json_res = jsonResToDict(json_res,poi)
+                    # print(json_res)
                 else:
-                    #位置点信息
                     json_res = prompt
                     json_res = res_error(json_res, "selectLand","error")
             except:
@@ -180,8 +176,16 @@ def update_chat_history(user_message):
 # 将大模型解析的结果转换为选址需要的数据格式
 
 
-def jsonResToDict(json_res):
+def jsonResToDict(json_res,poi):
+    #位置点为空,利用行政区划选址
+    if poi == "":
+        print("位置点为空,利用行政区划选址")
+    
 
+    # 位置点不为空,利用位置点选址
+    else:
+        print("位置点不为空,利用位置点选址")
+[]
     # 1.查询选址范围信息
     districtName = json_res["districtName"]
     ewkt = getAiDistrict(districtName)