Ver código fonte

选址提示词修改

liutao 3 semanas atrás
pai
commit
aa63bdf786
2 arquivos alterados com 22 adições e 7 exclusões
  1. 6 6
      landsite_agent/examples.json
  2. 16 1
      landsite_agent/prompt_template.py

+ 6 - 6
landsite_agent/examples.json

@@ -2,32 +2,32 @@
   {
     "query_type": "land_site_selection",
     "query": "帮我在萧山区推荐几块50亩左右的工业用地,数据表是控制性详细规划",
-    "sql_code": "select id from sde.kzxxxgh where xzqmc = '萧山区' and ydxz like '%工业%' and abs(ydmj - 50*0.0667) <= 1 and shape is not null order by ydmj nulls last limit 5"
+    "sql_code": "select id from sde.kzxxxgh where xzqmc = '萧山区' and ydxz like '%工业%' and abs(ydmj - 50*0.0667) <= 1 and shape is not null order by (dkcsd + ghfhd + dkgzd + jtblx + cyppd) desc nulls last limit 5"
   },
   {
     "query_type": "land_site_selection",
     "query": "帮我在萧山区推荐一宗1公顷左右的学校用地,数据表是控制性详细规划",
-    "sql_code": "select id from sde.kzxxxgh where xzqmc = '萧山区' and ydxz like '%学校%' and abs(ydmj - 1) <= 1 and shape is not null order by ydmj nulls last limit 1"
+    "sql_code": "select id from sde.kzxxxgh where xzqmc = '萧山区' and ydxz like '%学校%' and abs(ydmj - 1) <= 1 and shape is not null order by (dkcsd + ghfhd + dkgzd + jtblx + cyppd) desc nulls last limit 1"
   },
   {
     "query_type": "land_site_selection",
     "query": "帮我在萧山区推荐几块50亩左右的工业用地,数据表是公告地块",
-    "sql_code": "select id from sde.ecgap_klyzy where xzqmc = '萧山区' and tdyt like '%工业%' and abs(dkmj-5) <= 1 and shape is not null and sfsj=1 order by dkmj nulls last limit 5"
+    "sql_code": "select id from sde.ecgap_klyzy where xzqmc = '萧山区' and tdyt like '%工业%' and abs(dkmj-5) <= 1 and shape is not null and sfsj=1 order by (dkcsd + ghfhd + dkgzd + jtblx + cyppd) desc nulls last limit 5"
   },
   {
     "query_type": "land_site_selection",
     "query": "请在萧山机场附近选出30-100亩之间的工业用地,数据表是公告地块",
-    "sql_code": "select t.id from (select id,dkmj,round(st_distance(st_geometryfromtext('POINT (120.42827489304307 30.23751646603668)', 4490)::geography,shape::geography)::numeric,0) as distance from sde.ecgap_klyzy where tdyt like '%工业%' and sfsj=1 and shape is not null and dkmj BETWEEN 30 and 100) as t where t.distance <= 10000  order by t.dkmj nulls last limit 5"
+    "sql_code": "select t.id from (select id,dkmj,round(st_distance(st_geometryfromtext('POINT (120.42827489304307 30.23751646603668)', 4490)::geography,shape::geography)::numeric,0) as distance from sde.ecgap_klyzy where tdyt like '%工业%' and sfsj=1 and shape is not null and dkmj BETWEEN 30 and 100) as t where t.distance <= 10000 order by (dkcsd + ghfhd + dkgzd + jtblx + cyppd) desc nulls last limit 5"
   },
   {
     "query_type": "land_site_selection",
     "query": "帮我在萧山机场附近推荐几块50亩左右的工业用地,数据表是控制性详细规划",
-    "sql_code": "select t.id from (select id,ydmj,round(st_distance(st_geometryfromtext('POINT (120.42827489304307 30.23751646603668)', 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 t.ydmj nulls last limit 5"
+    "sql_code": "select t.id from (select id,ydmj,round(st_distance(st_geometryfromtext('POINT (120.42827489304307 30.23751646603668)', 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_type": "land_site_selection",
     "query": "帮我在温州南站附近推荐几块50亩左右的工业用地,温州南站的坐标为120.58,27.97,数据表是控制性详细规划",
-    "sql_code": "select t.id from (select id,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 t.ydmj nulls last limit 5"
+    "sql_code": "select t.id from (select id,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_type": "land_site_selection",

+ 16 - 1
landsite_agent/prompt_template.py

@@ -25,6 +25,11 @@ PROMPT_TEMPLATE = """
    - ldlxx: 绿地率下限
    - ldlxx: 绿地率下限
    - shape: 地块图形wkt
+   - dkcsd: 地块成熟度
+   - ghfhd: 规划符合度
+   - dkgzd: 地块规整度
+   - jtblx: 交通便利性
+   - cyppd: 产业匹配度
 
 2. 公告地块表 (sde.ecgap_klyzy):
    - id: 主键ID
@@ -37,6 +42,11 @@ PROMPT_TEMPLATE = """
    - tdyt: 土地用途
    - shape: 地块图形wkt
    - sfsj: 是否上架(1表示已上架,0表示未上架)
+   - dkcsd: 地块成熟度
+   - ghfhd: 规划符合度
+   - dkgzd: 地块规整度
+   - jtblx: 交通便利性
+   - cyppd: 产业匹配度
 
 重要注意事项:
 1. 只准生成查询的SQL语句,不可生成任何修改数据的语句,包括但不限于:
@@ -65,7 +75,12 @@ PROMPT_TEMPLATE = """
    - 如果未限定数量或限定数量大于5,则SQL中使用LIMIT 5
    - 如果用户问题涉及到最大、最小值查询(如最大面积、最小高度等),则根据相关字段排序后使用LIMIT 1
 
-6. 其他注意事项:
+6. 评分排序规则:
+   - 评分字段包括:地块成熟度(dkcsd)、规划符合度(ghfhd)、地块规整度(dkgzd)、交通便利性(jtblx)、产业匹配度(cyppd)
+   - 当需要根据综合评分排序时,使用这些字段的总和进行倒序排序
+   - 示例:ORDER BY (dkcsd + ghfhd + dkgzd + jtblx + cyppd) DESC
+
+7. 其他注意事项:
    - 确保SQL语句的语法正确性
    - 注意字段名称的准确性
    - 合理使用索引字段(如id、xzqmc等)