Browse Source

智能选址

liutao 1 week ago
parent
commit
d1deb87ca5
2 changed files with 8 additions and 2 deletions
  1. 2 2
      landsite_agent/examples.json
  2. 6 0
      landsite_agent/prompt_template.py

+ 2 - 2
landsite_agent/examples.json

@@ -26,8 +26,8 @@
   },
   {
     "query_type": "land_site_selection",
-    "query": "帮我在温州南站附近推荐几块50亩左右的工业用地,温州南站的坐标为120.58,27.97,数据表是控制性详细规划",
-    "sql_code": "select t.id from (select id,dkcsd,ghfhd,dkgzd,jtblx,cyppd,ydmj,round(st_distance(st_geometryfromtext('POINT (120.58 27.97)', 4490)::geography,shape::geography)::numeric,0) as distance from sde.kzxxxgh where ydxz like '%工业%' and shape is not null and abs(ydmj - 50*0.0667) <= 1) as t where t.distance <= 10000 order by (dkcsd + ghfhd + dkgzd + jtblx + cyppd) desc nulls last limit 5"
+    "query": "帮我在温州南站附近推荐几块工业用地,温州南站的坐标为120.58,27.97,数据表是控制性详细规划",
+    "sql_code": "select t.id from (select id,dkcsd,ghfhd,dkgzd,jtblx,cyppd,ydmj,round(st_distance(st_geometryfromtext('POINT (120.58 27.97)', 4490)::geography,shape::geography)::numeric,0) as distance from sde.kzxxxgh where ydxz like '%工业%' and shape is not null) as t where t.distance <= 10000 order by (dkcsd + ghfhd + dkgzd + jtblx + cyppd) desc nulls last limit 5"
   },
   {
     "query_type": "land_site_selection",

+ 6 - 0
landsite_agent/prompt_template.py

@@ -86,6 +86,12 @@ PROMPT_TEMPLATE = """
    - 合理使用索引字段(如id、xzqmc等)
    - 对于空间查询,注意使用正确的空间函数和坐标系
 
+8. 附近地块查询:
+   - 如果用户问题涉及"附近地块"并且提供了经纬度坐标点(如"查询某点附近的地块"),则SQL中需使用st_distance函数计算地块与指定点的距离。
+   - 距离条件为小于10公里(10000米)。
+   - 地块的shape字段和指定的经纬度点都需转换为geography类型,坐标系为4490。
+   - 示例:st_distance(st_geometryfromtext('POINT (经度 纬度)', 4490)::geography,shape::geography < 10000
+
 历史对话和相似示例:
 {chat_history}