Pārlūkot izejas kodu

找图找数agent

liutao 2 mēneši atpakaļ
vecāks
revīzija
b55a6c626b

BIN
aiAgent_gd/qwen_agent/memory/__pycache__/SqlMemory.cpython-310.pyc


+ 2 - 2
aiAgent_gd/qwen_agent/memory/data/sqls/sql_examples_找图找数.jsonl

@@ -2,11 +2,11 @@
   {
     "query_type": "land_find",
     "query": "请帮我查一下萧山区永久基本农田面积大于100亩的地块",
-    "sql_code": "select objectid,xzqmc,xzqdm,dlbm,dlmc,yjjbnttbmj from dlgis.gcs330000g2001_yjjbnt_gx_xsb where xzqmc ='萧山区' and yjjbnttbmj >100*666.67 limit 10"
+    "sql_code": "select objectid from dlgis.gcs330000g2001_yjjbnt_gx_xsb where xzqmc ='萧山区' and yjjbnttbmj >100*666.67 limit 10"
   },
   {
     "query_type": "land_find",
     "query": "请帮我查一下西湖区永久基本农田面积小于100亩的地块",
-    "sql_code": "select objectid,xzqmc,xzqdm,dlbm,dlmc,yjjbnttbmj from dlgis.gcs330000g2001_yjjbnt_gx_xsb where xzqmc ='西湖区' and yjjbnttbmj <100*666.67 limit 10"
+    "sql_code": "select objectid from dlgis.gcs330000g2001_yjjbnt_gx_xsb where xzqmc ='西湖区' and yjjbnttbmj <100*666.67 limit 10"
   }
 ]

+ 1 - 1
aiAgent_gd/qwen_agent/sub_agent/sql/land_find_sql_agent.py

@@ -49,7 +49,7 @@ class LandFindSqlAgent(BaseSubAgent):
         注意5: 查询出地块。必须要对ydmj进行desc排序。查询地块有数量限制时,比如'1宗','一宗','1块',使用limit 1语句;未限定时,只查询10宗,使用limit 10语句
         注意6: 问题中设计具体的地点时,需要使用round(st_distance(st_geometryfromtext('具体地点的wkt', 4490)::geography,shape::geography)::numeric,0)获取其distance, 如果问题未指定范围则使用 distance <= 5000 来限制在地点5公里内,并对其排序
         注意7: 生成sql时,只对涉及表结构中的字段进行条件设置,不可生成不在表字段列表中的查询条件,不可生成任何不在表字段中的条件,比如周边5公里有什么设施
-        注意8: 查询语句包含 objectid,xzqmc,xzqdm,dlbm,dlmc,yjjbnttbmj这个字段
+        注意8: 查询语句select只包含objectid这个字段
         注意9: 只准生成查询 的sql 语句,不可生成任何 修改数据的语句, 比如:update, delete, insert, truncate 等
         注意10: gcs330000g2001_yjjbnt_gx_xsb数据表的schema是dlgis
         """

+ 3 - 6
aiAgent_gd/run_server_async.py

@@ -181,7 +181,6 @@ async def kgQuery(id: str):
     sql = f'select id, xzqmc, xzqdm, dymc, yddm, ydxz, ydmj, rjlsx, rjlxx, jzmdsx, jzmdxx, jzgdsx, jzgdxx, ldlsx, ldlxx, pfwh, pfsj, st_area(shape::geography) as pfmarea,st_astext(shape) as geom, st_astext(st_centroid(shape)) as center_wkt from sde.kzxxxgh where id in ({id})'
     res_tuples = await async_db.run(sql)
     result, success = res_tuples
-    print(success, result)
     return json.loads(result)
 
 
@@ -190,16 +189,14 @@ async def klyzyQuery(id: str):
     sql = f'select *, st_astext(shape) as geom, st_astext(st_centroid(shape)) as center_wkt from sde.ecgap_klyzy where id in ({id})'
     res_tuples = await async_db.run(sql)
     result, success = res_tuples
-    print(success, result)
     return json.loads(result)
 
 
-@app.get("/queryYjjbntGeometry")
-async def queryYjjbntGeometry(id: int):
-    sql = f'select *,st_astext(shape) as geom from dlgis.gcs330000g2001_yjjbnt_gx_xsb where objectid = {id}'
+@app.get("/yjjbntQuery")
+async def yjjbntQuery(id: str):
+    sql = f'select *,st_astext(shape) as geom from dlgis.gcs330000g2001_yjjbnt_gx_xsb where objectid in ({id})'
     res_tuples = await async_xzdb.run(sql)
     result, success = res_tuples
-    print(success, result)
     return json.loads(result)