Browse Source

[bug]: 修复更换模型接口后出现的bug

liutao 3 months ago
parent
commit
9de63b3dc3

+ 5 - 5
aiAgent_gd/qwen_agent/config/db_config.py

@@ -4,11 +4,11 @@ db_list = {
 
 
     },
     },
     "pg": {
     "pg": {
-        "host": "60.191.110.204",
-        "port": "5432",
-        "database": "zlzd",
-        "user": "sde",
-        "password": "sde",
+        "host": "10.249.168.231",
+        "port": "54321",
+        "database": "sde",
+        "user": "zjugis",
+        "password": "zjugis1402!",
     }
     }
 }
 }
 
 

+ 1 - 1
aiAgent_gd/qwen_agent/memory/SqlMemory.py

@@ -12,7 +12,7 @@ from qwen_agent.utils.util import get_data_from_jsons
 os.environ["TOKENIZERS_PARALLELISM"] = "false"
 os.environ["TOKENIZERS_PARALLELISM"] = "false"
 
 
 embedding_model_dict = {
 embedding_model_dict = {
-    "text2vec": "E:\AI_temp\m3e-base",
+    "text2vec": "/data/m3e-base",
     # "text2vec": "D:\m3e-base",
     # "text2vec": "D:\m3e-base",
 
 
 }
 }

+ 2 - 61
aiAgent_gd/qwen_agent/memory/data/plans/plan_examples_智能选址.jsonl

@@ -1,66 +1,7 @@
 [
 [
   {
   {
     "query_type": "land_site_selection",
     "query_type": "land_site_selection",
-    "query": "帮我在杭州市推荐一宗50亩左右的工业用地",
-    "plan": "Question: 帮我在杭州市推荐一宗50亩左右的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,面积为‘50’亩左右,规划用途为‘工业用地’的地块,所以需要通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,面积为‘50’亩左右,规划用途为‘工业用地’的地块\"},\n    {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "请帮我在杭州市找几块在开发区内,园区主导产业为汽车制造业的工业用地",
-    "plan": "Question: 请帮我在杭州市找几块在开发区内,园区主导产业为汽车制造业的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,是否在开发园区内为‘是’,园区主导产业中包含‘汽车制造业’,规划用途为‘工业用地’的地块,所以需要通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,是否在开发园区内为‘是’,园区主导产业中包含‘汽车制造业’,规划用途为‘工业用地’的地块\"},\n    {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "帮我在杭州市滨江区推荐一宗50亩左右的工业用地",
-    "plan": "Question: 帮我在杭州市滨江区推荐一宗50亩左右的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’, county 为‘滨江区’,面积为‘50’亩左右,规划用途为‘工业用地’的地块,所以需要通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,面积为‘50’亩左右,规划用途为‘工业用地’的地块\"},\n    {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "帮我在杭州市西湖区推荐一宗35亩左右的工业用地",
-    "plan": "Question: 帮我在杭州市滨江区推荐一宗35亩左右的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’, county 为‘西湖区’,面积为‘35’亩左右,规划用途为‘工业用地’的地块,所以需要通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,面积为‘50’亩左右,规划用途为‘工业用地’的地块\"},\n    {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "帮我在杭州市西湖区推荐一宗30亩到50亩的工业用地",
-    "plan": "Question: 帮我在杭州市西湖区推荐一宗30亩到50亩的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’, county 为‘西湖区’,面积大于‘30’亩,小于 ‘50’ 亩,规划用途为‘工业用地’的地块,所以需要通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,面积为‘50’亩左右,规划用途为‘工业用地’的地块\"},\n    {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "帮我在杭州市滨江区正泰大厦附近推荐一宗50亩左右的工业用地",
-    "plan": "Question: 帮我在杭州市滨江区正泰大厦附近推荐一宗50亩左右的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,区县为‘滨江区’,详细地点为‘杭州市滨江区正泰大厦’,面积为‘50’亩左右,规划用途为‘工业用地’的地块,所以需要先通过[GisGeocoderAgent]将详细的地址转换为坐标点,再通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"GisGeocoderAgent\", \"instruction\": \"你需要调用 [GisGeocoderAgent],来将‘杭州市滨江区正泰大厦’ 转换为坐标wkt\"},\n {\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,面积为‘50’亩左右,规划用途为‘工业用地’的地块\"},   {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "帮我在杭州市滨江区推荐一宗交通便利的50亩左右的工业用地",
-    "plan": "Question: 帮我在杭州市滨江区推荐一宗交通便利的50亩左右的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,区县为‘滨江区’,周边设施为‘交通’,面积为‘50’亩左右,规划用途为‘工业用地’的地块,所以需要先通过[LandSiteSelectionSqlAgent]查询图层信息,再通过[GisSurroundingFacilitiesQueryAgent]查询周边设施中的交通信息,再最后使用summary的Action来表示供应情况。Plan: ```json\n    [ {\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’, 区县为“滨江区”,面积为‘50’亩左右,规划用途为‘工业用地’的地块\"}, \n{\"action_name\": \"GisSurroundingFacilitiesQueryAgent\", \"instruction\": \"你需要调用 [GisSurroundingFacilitiesQueryAgent],查询周边设施信息\"},\n  {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "帮我在杭州市西湖区找几块面积50亩左右,人口相对密集的工业用地",
-    "plan": "Question: 帮我在杭州市西湖区找几块面积50亩左右,人口相对密集的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,区县为‘西湖区’,周边设施为‘人口’,面积为‘50’亩左右,规划用途为‘工业用地’的地块,所以需要先通过[LandSiteSelectionSqlAgent]查询图层信息,再通过[GisSurroundingFacilitiesQueryAgent]查询周边设施中的人口信息,再最后使用summary的Action来表示供应情况。Plan: ```json\n    [ {\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,区县为‘西湖区’,面积为‘50’亩左右,规划用途为‘工业用地’的地块\"}, \n{\"action_name\": \"GisSurroundingFacilitiesQueryAgent\", \"instruction\": \"你需要调用 [GisSurroundingFacilitiesQueryAgent],查询周边设施信息\"},\n  {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "在杭州市萧山机场附近推荐几块总价不超过2000万的工业用地",
-    "plan": "Question: 在杭州市萧山机场附近推荐几块总价不超过2000万的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,详细地点为‘萧山机场’,地块总价小于等于‘2000’万,规划用途为‘工业用地’的地块,所以需要先通过[GisGeocoderAgent]将详细的地址转换为坐标点,再通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"GisGeocoderAgent\", \"instruction\": \"你需要调用 [GisGeocoderAgent],来将‘萧山机场’ 转换为坐标wkt\"},\n {\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,地块总价小于等于为‘2000’万,规划用途为‘工业用地’的地块\"},   {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "请在杭州市杭州东站附近推荐几块面积在50亩左右,公共设施相对完善的工业用地",
-    "plan": "Question: 请在杭州市杭州东站附近推荐几块面积在50左右,公共设施相对完善的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,详细地点为‘杭州东站’,周边设施为“公共设施”,面积在‘50’亩左右,规划用途为‘工业用地’的地块,所以需要先通过[GisGeocoderAgent]将详细的地址转换为坐标点,再通过[LandSiteSelectionSqlAgent]查询图层信息,再通过[GisSurroundingFacilitiesQueryAgent]查询周边设施中的公共设施信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"GisGeocoderAgent\", \"instruction\": \"你需要调用 [GisGeocoderAgent],来将‘杭州东站’ 转换为坐标wkt\"},\n {\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,面积在‘50’亩左右,规划用途为‘工业用地’的地块\"},  \n{\"action_name\": \"GisSurroundingFacilitiesQueryAgent\", \"instruction\": \"你需要调用 [GisSurroundingFacilitiesQueryAgent],查询周边设施中的公共设施信息\"}, {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },  {
-    "query_type": "land_site_selection",
-    "query": "请在杭州市杭州东站附近15公里范围内推荐几块工业用地",
-    "plan": "Question: 请在杭州市杭州东站附近15公里范围内推荐几块工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,详细地点为‘杭州东站’,规划用途为‘工业用地’的地块,所以需要先通过[GisGeocoderAgent]将详细的地址转换为坐标点,再通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"GisGeocoderAgent\", \"instruction\": \"你需要调用 [GisGeocoderAgent],来将‘杭州东站’ 转换为坐标wkt\"},\n {\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,详细地点为‘杭州东站’,规划用途为‘工业用地’的地块\"}, {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "请帮我在杭州市余杭区找几块面积在50亩左右,总价不超过3000万,周边5公里内有地铁站的地块",
-    "plan": "Question: 请帮我在杭州市余杭区找几块面积在50亩左右,总价不超过2000万,周边5公里内有地铁站的地块 \nThought: 用户问题中想查询城市为‘杭州市’,区县为‘余杭’,周边设施为‘地铁站’,面积为‘50’亩左右,地块总价小于等于“3000”万的地块,所以需要先通过[LandSiteSelectionSqlAgent]查询图层信息,再通过[GisSurroundingFacilitiesQueryAgent]查询周边设施中的地铁站信息,再最后使用summary的Action来表示供应情况。Plan: ```json\n    [ {\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,区县为‘余杭’,周边设施为‘地铁站’,面积为‘50’亩左右,地块总价小于等于“3000”万的地块\"}, \n{\"action_name\": \"GisSurroundingFacilitiesQueryAgent\", \"instruction\": \"你需要调用 [GisSurroundingFacilitiesQueryAgent],查询周边设施地铁站信息\"},\n  {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
-  },
-  {
-    "query_type": "land_site_selection",
-    "query": "帮我杭州市找几块面积在30~40亩,周边有新能源产业的工业用地",
-    "plan": "Question: 帮我杭州市找几块面积在30~40亩,周边有新能源产业的工业用地 \nThought: 用户问题中想查询城市为‘杭州市’,面积在‘30’ 亩 至‘40’亩区间,五公里内有‘新能源’产业的企业,规划用途为‘工业用地’的地块,所以需要先通过[LandSiteSelectionSqlAgent]查询图层信息,再使用summary的Action来表示地块查询结果。Plan: ```json\n    [ {\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,面积在‘30’ 亩 至‘40’亩区间,五公里内有‘新能源’产业的企业,规划用途为‘工业用地’的地块\"}, \n  {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
+    "query": "帮我在萧山区推荐一宗50亩左右的工业用地",
+    "plan": "Question: 帮我在萧山区推荐一宗50亩左右的工业用地 \nThought: 用户问题中想查询城市为‘萧山区’,面积为‘50’亩左右,规划用途为‘工业用地’的地块,所以需要通过[LandSiteSelectionSqlAgent]查询图层信息,最后使用summary的Action来表示供应情况。Plan: ```json\n    [{\"action_name\": \"LandSiteSelectionSqlAgent\", \"instruction\": \"你需要调用 [LandSiteSelectionSqlAgent],来查询城市为‘杭州市’,面积为‘50’亩左右,规划用途为‘工业用地’的地块\"},\n    {\"action_name\": \"summary\", \"instruction\": \"你需要根据用户的Question和查询的结果,回答用户问题。\"}]"
   }
   }
 ]
 ]

+ 3 - 58
aiAgent_gd/qwen_agent/memory/data/sqls/sql_examples_智能选址.jsonl

@@ -1,62 +1,7 @@
 [
 [
  {
  {
- "query_type": "land_site_selection",
- "query": "帮我在杭州市推荐一宗50亩左右的工业用地",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score, st_astext(st_centroid(geom)) as center_wkt from nrllm.land_public_sale where city = '杭州市' and planned_land_use = '工业用地' and abs(area * 0.0015 - 50) <= 5 order by abs(area * 0.0015 - 50), comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "请帮我在杭州市找几块在开发区内,园区主导产业为汽车制造业的工业用地",
- "sql_code": "select id, name, county, location, total_price, unit_price, area, park_name, park_primary_industry, comprehensive_score, st_astext(st_centroid(geom)) as center_wkt from nrllm.land_public_sale where city = '杭州市' and in_industrial_park = '是' and park_primary_industry like '%汽车制造业%' and planned_land_use = '工业用地' order by comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "帮我在杭州市滨江区推荐一宗50亩左右的工业用地",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score , st_astext(st_centroid(geom)) as center_wkt from nrllm.land_public_sale where city = '杭州市' and county = '滨江区' and planned_land_use = '工业用地' and abs(area * 0.0015 - 50) <= 5 order by abs(area * 0.0015 - 50), comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "帮我在杭州市滨江区正泰大厦附近推荐一宗50亩左右的工业用地",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score, round(st_distance(st_geometryfromtext('POINT (40520795.286336236 3343271.716593298)', 4528), st_transform(geom, 4528))::numeric,0) distance, st_astext(st_centroid(geom)) as center_wkt from nrllm.land_public_sale where city = '杭州市' and county = '滨江区' and planned_land_use = '工业用地' and abs(area * 0.0015 - 50) <= 5 and distance <= 5000 order by distance, abs(area * 0.0015 - 50) asc, comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "帮我在杭州市萧山机场附近推荐一宗50亩左右的工业用地",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score, round(st_distance(st_geometryfromtext('POINT (40536500.157731295 3344173.678146237)', 4528), st_transform(geom, 4528))::numeric,0) distance, st_astext(st_centroid(geom)) as center_wkt from nrllm.land_public_sale where city = '杭州市' and county = '滨江区' and planned_land_use = '工业用地' and abs(area * 0.0015 - 50) <= 5 and distance <= 5000 order by distance, abs(area * 0.0015 - 50) asc, comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "在杭州市萧山机场附近推荐几块总价不超过2000万的工业用地",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score, round(st_distance(st_geometryfromtext('POINT (40536500.157731295 3344173.678146237)', 4528), st_transform(geom, 4528))::numeric,0) as distance, st_astext(st_centroid(geom)) as center_wkt from nrllm.land_public_sale where city = '杭州市' and county = '滨江区' and planned_land_use = '工业用地' and total_price <= 2000 and round(st_distance(st_geometryfromtext('POINT (40536500.157731295 3344173.678146237)', 4528), st_transform(geom, 4528))::numeric,0) <= 5000 order by distance, abs(area * 0.0015 - 50) asc, comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "帮我在杭州市西湖区土地协会附近推荐一宗50亩左右的工业用地",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score, round(st_distance(st_geometryfromtext('POINT (40513914.94028399 3350070.761533372)', 4528), st_transform(geom, 4528))::numeric,0) distance, st_astext(st_centroid(geom)) as center_wkt from nrllm.land_public_sale where city = '杭州市' and county = '西湖区' and planned_land_use = '工业用地' and abs(area * 0.0015 - 50) <= 5 and distance <= 5000 order by distance, abs(area * 0.0015 - 50) asc, comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "帮我在杭州市滨江区推荐一宗交通便利的50亩左右的工业用地",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score, st_astext(st_centroid(geom)) center_wkt from nrllm.land_public_sale where city = '杭州市' and county = '滨江区' and planned_land_use = '工业用地' and abs(area * 0.0015 - 50) <= 5 order by abs(area * 0.0015 - 50) asc, comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "帮我在杭州市西湖区推荐一宗30亩到50亩的工业用地",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score, st_astext(st_centroid(geom)) center_wkt from nrllm.land_public_sale where city = '杭州市' and county = '滨江区' and planned_land_use = '工业用地' and area * 0.0015 >= 30 and area * 0.0015 <= 50 order by abs(area * 0.0015 - 50) asc, comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "请帮我在杭州市余杭区找几块面积在50亩左右,总价不超过3000万,周边5公里内有地铁站的地块",
- "sql_code": "select id, name, county, location,total_price,unit_price, area, comprehensive_score, st_astext(st_centroid(geom)) center_wkt from nrllm.land_public_sale where city = '杭州市' and county = '余杭区' and total_price <= 3000 and abs(area * 0.0015 - 50) <= 5 order by abs(area * 0.0015 - 50) asc, comprehensive_score desc nulls last limit 10"
- },
- {
- "query_type": "land_site_selection",
- "query": "请在杭州市杭州东站附近8公里范围内推荐几块工业用地",
- "sql_code": "select id, name, county, location, total_price, unit_price, area, comprehensive_score, st_astext(st_centroid(geom)) as center_wkt from nrllm.land_public_sale where city = '杭州市' and planned_land_use = '工业用地' and round(st_distance(st_geometryfromtext('POINT (40519226.78670315 3352109.7250877074)', 4528), st_transform(geom, 4528))::numeric, 0) <= 8000 order by comprehensive_score desc nulls last"
- },
- {
- "query_type": "land_site_selection",
- "query": "帮我杭州市找几块面积在30~40亩,周边有新能源产业的工业用地",
- "sql_code": "select id, name, county, location, total_price, unit_price, area, comprehensive_score, st_astext(st_centroid(geom)) as center_wkt, string_agg(distinct en_name, ',') as 五公里内新能源产业企业名称 from (select a.id, a.name, a.county, location, total_price, unit_price, area, comprehensive_score, a.geom, b.name as en_name from nrllm.land_public_sale a, (select name, geom from nrllm.layer_poi_industry_enterprise where industry like '%新能源%') b where city = '杭州市' and planned_land_use = '工业用地' and area * 0.0015 >= 30 and area * 0.0015 <= 40 and st_dwithin(a.geom::geography, b.geom::geography, 5000)) t group by id, name, county, location, total_price, unit_price, area, comprehensive_score, center_wkt"
+  "query_type": "land_site_selection",
+  "query": "帮我在萧山区推荐一宗50亩左右的工业用地",
+  "sql_code": "select id, xzqmc, name, address, dkmj, tdyt, st_astext(st_centroid(shape)) as center_wkt from sde.ecgap_klyzy where xzqmc = '萧山区' and tdyt = '工业用地' and abs(dkmj - 50) <= 5 order by dkmj nulls last limit 10"
  }
  }
 ]
 ]

+ 13 - 23
aiAgent_gd/qwen_agent/sub_agent/sql/land_site_selection_sql_agent.py

@@ -32,47 +32,37 @@ class LandSiteSelectionSqlAgent(BaseSubAgent):
         self.SubAgent_Summary_Prompt = "通过查询数据库,检索数据库得到的信息为:\n{obs}\n"
         self.SubAgent_Summary_Prompt = "通过查询数据库,检索数据库得到的信息为:\n{obs}\n"
         self.SubAgent_PROMPT = """你是一个PostgreSQL专家,当前需要根据用户问题和上下文,生成语法正确的PostgreSQL查询语句。'
         self.SubAgent_PROMPT = """你是一个PostgreSQL专家,当前需要根据用户问题和上下文,生成语法正确的PostgreSQL查询语句。'
          #数据库表的表名和表结构如下:
          #数据库表的表名和表结构如下:
-        `nrllm.land_public_sale`(
-            `city` COMMENTS '所属地级市 用来指定地级市',
-            `county` COMMENTS '所属区县 用来指定区 或者 县',
+        `sde.ecgap_klyzy`(
+            `xzqmc` COMMENTS '所属区县(行政区代码) 用来指定区 或者 县',
+            `xzqdm` COMMENTS '行政区代码 6位,前2位代表省,前4位代表市,前6位代表区县',
             `name` COMMENTS '地块名称',
             `name` COMMENTS '地块名称',
-            `location` COMMENTS '土地坐落',
-            `area` COMMENTS '土地面积,单位平方米',
-            `status` COMMENTS '出让状态,未售,已售',
-            `planned_land_use` COMMENTS '土地规划用途',
-            `announcement_date` COMMENTS '公告日期',
-            `auction_date` COMMENTS '出让日期',
-            `resource_type` COMMENTS '资源类型',
-            `total_price` COMMENTS '土地总价,单位万元',
-            `unit_price` COMMENTS '土地单价,单位万元/平方米',
-            `park_primary_industry` COMMENTS '所在园区主导产业',
-            `in_industrial_park` COMMENTS '是否在开发园区内: 是,否',
-            `park_level` COMMENTS '开发园区等级:省级开发区,国家级开发区',
-            `comprehensive_score` COMMENTS '地块综合得分'
-            `geometry_wkt` COMMENTS '地块图形wkt'
+            `address` COMMENTS '土地坐落',
+            `dkmj` COMMENTS '土地面积,单位亩',
+            `tdyt` COMMENTS '土地规划用途',
+            `shape` COMMENTS '地块图形wkt'
         )
         )
 
 
 
 
         有几个注意事项:
         有几个注意事项:
         注意0:请仔细区分"去年","今年","N年前","近三年"等时间关键词,必须使用to_char(transaction_sold_time,'yyyy') as nf,具体去年、今年等使用to_char(CURRENT_DATE - INTERVAL '1 year', 'YYYY')、to_char(CURRENT_DATE, 'YYYY'),如果提到了近三年、近五年时候查询是请使用to_char(transaction_sold_time,'yyyy') > to_char(CURRENT_DATE - INTERVAL '3 year', 'YYYY')、to_char(transaction_sold_time,'yyyy') > to_char(CURRENT_DATE - INTERVAL '5 year', 'YYYY');
         注意0:请仔细区分"去年","今年","N年前","近三年"等时间关键词,必须使用to_char(transaction_sold_time,'yyyy') as nf,具体去年、今年等使用to_char(CURRENT_DATE - INTERVAL '1 year', 'YYYY')、to_char(CURRENT_DATE, 'YYYY'),如果提到了近三年、近五年时候查询是请使用to_char(transaction_sold_time,'yyyy') > to_char(CURRENT_DATE - INTERVAL '3 year', 'YYYY')、to_char(transaction_sold_time,'yyyy') > to_char(CURRENT_DATE - INTERVAL '5 year', 'YYYY');
         注意1: 统计面积时候,无指定单位的情况下,请默认转换为亩并四舍五入成整数,平方米转换为亩请乘以0.0015
         注意1: 统计面积时候,无指定单位的情况下,请默认转换为亩并四舍五入成整数,平方米转换为亩请乘以0.0015
-        注意2: 查询地区条件时,查询**省时请使用 province 字段,查询**市时请使用 city 字段, 查询**区县时请使用 county 字段,区县为**时请使用 county 字段
+        注意2: 查询地区条件时,区县为**时请使用 xzqmc 字段。省为**时请先将行政区名称转换为行政区代码,使用xzqdm字段的前2位进行模糊查询,市为**时请先将行政区名称转换为行政区代码,使用xzqdm字段的前4位进行模糊查询
         注意3: 计算百分比之类的数值时,需要使用round函数保留两位小数
         注意3: 计算百分比之类的数值时,需要使用round函数保留两位小数
         注意4: 使用 order by 进行排序时。必须使用 nulls last 确保 null值不会对排序产生影响,使用方法如下: order by xxxx desc nulls last 或者 order by xxxx nulls last
         注意4: 使用 order by 进行排序时。必须使用 nulls last 确保 null值不会对排序产生影响,使用方法如下: order by xxxx desc nulls last 或者 order by xxxx nulls last
         注意5: 当用户问题中的面积等于不是一个确定值的时候,如‘面积为xx亩左右’或‘面积为xx平方米左右’, 需要条件中添加 abs(area * 0.0015 - xx) <= 5, 将面积差控制在5亩之内,使用 ‘order by abs(area * 0.0015 - xx)  nulls last’ 来进行排序
         注意5: 当用户问题中的面积等于不是一个确定值的时候,如‘面积为xx亩左右’或‘面积为xx平方米左右’, 需要条件中添加 abs(area * 0.0015 - xx) <= 5, 将面积差控制在5亩之内,使用 ‘order by abs(area * 0.0015 - xx)  nulls last’ 来进行排序
-        注意5: 当用户问题中的面积是一个确定值的时候,如‘面积为xx亩’或‘面积为xx平方米’, 需要条件中添加 abs(area * 0.0015 - xx) <= 5, 将面积差控制在5亩之内,使用 ‘order by abs(area * 0.0015 - xx)  nulls last’ 来进行排序
-        注意6: 查询出地块。必须要对comprehensive_score 进行desc排序
-        注意7: 问题中设计具体的地点时,需要使用round(st_distance(st_geometryfromtext('具体地点的wkt', 4528), st_transform(geom, 4528))::numeric,0)获取其distance, 如果问题未指定范围则使用 distance <= 5000 来限制在地点5公里内,并对其排序
+        注意5: 当用户问题中的面积是一个确定值的时候,如‘面积为xx亩’或‘面积为xx平方米’, 需要条件中添加 abs(area * 0.0015 - xx) <= 5, 将面积差控制在5亩之内,使用 ‘order by abs(dkmj * 0.0015 - xx)  nulls last’ 来进行排序
+        注意6: 查询出地块。必须要对dkmj 进行desc排序
+        注意7: 问题中设计具体的地点时,需要使用round(st_distance(st_geometryfromtext('具体地点的wkt', 4528), st_transform(shape, 4528))::numeric,0)获取其distance, 如果问题未指定范围则使用 distance <= 5000 来限制在地点5公里内,并对其排序
         注意8: 当问题中提及周边分析的条件时,不需要将其转换为查询条件,比如交通便利,离港口码头近,人口等
         注意8: 当问题中提及周边分析的条件时,不需要将其转换为查询条件,比如交通便利,离港口码头近,人口等
         注意9: 生成sql时,只对涉及表结构中的字段进行条件设置,不可生成不在表字段列表中的查询条件,不可生成任何不在表字段中的条件,比如周边5公里有什么设施
         注意9: 生成sql时,只对涉及表结构中的字段进行条件设置,不可生成不在表字段列表中的查询条件,不可生成任何不在表字段中的条件,比如周边5公里有什么设施
-        注意10: 生成sql时,必须使用 st_astext(st_centroid(geom)) as center_wkt 
+        注意10: 生成sql时,必须使用 st_astext(st_centroid(shape)) as center_wkt 
         注意11: 问题中涉及以下条件时,不需要将其转换为sql条件:
         注意11: 问题中涉及以下条件时,不需要将其转换为sql条件:
             人口
             人口
             人口密度
             人口密度
             交通设施
             交通设施
             地铁站距离
             地铁站距离
             
             
-        注意12: 查询语句必须包含 id, name, county, location,total_price,unit_price, area, comprehensive_score, st_astext(st_centroid(geom)) as center_wkt 这几个字段
+        注意12: 查询语句必须包含 id, xzqmc, name, address, dkmj, tdyt, st_astext(st_centroid(shape)) as center_wkt 这几个字段
         注意13: 只准生成查询 的sql 语句,不可生成任何 修改数据的语句, 比如:update, delete, insert, truncate 等
         注意13: 只准生成查询 的sql 语句,不可生成任何 修改数据的语句, 比如:update, delete, insert, truncate 等
         ```
         ```
         以下是可供参考的SQL写法(仅供参考,也可自由发挥):
         以下是可供参考的SQL写法(仅供参考,也可自由发挥):

+ 1 - 1
aiAgent_gd/run_server_async.py

@@ -31,7 +31,7 @@ llm_turbo_name = "gpt-4-turbo"
 max_ref_token = 4000
 max_ref_token = 4000
 # model_server = "http://10.10.0.10:7907/v1"
 # model_server = "http://10.10.0.10:7907/v1"
 # model_server = "http://lq.lianqiai.cn:7905/v1"
 # model_server = "http://lq.lianqiai.cn:7905/v1"
-model_server = "http://ac.zjugis.com:8511/v1"
+model_server = "http://10.36.162.54:20331/v1"
 api_key = ""
 api_key = ""
 server_host = "0.0.0.0"
 server_host = "0.0.0.0"
 server_port = 8511
 server_port = 8511