Browse Source

修复neo4j 使用旧的COUNT{}语法产生告警的问题

wangxq 1 month ago
parent
commit
11d3954325
2 changed files with 4 additions and 4 deletions
  1. 3 3
      app/core/data_interface/interface.py
  2. 1 1
      app/core/llm/llm_service.py

+ 3 - 3
app/core/data_interface/interface.py

@@ -58,7 +58,7 @@ def standard_list(skip_count, page_size, en_name_filter=None,
     MATCH (n:data_standard)
     WHERE {where_str}
     RETURN properties(n) as properties,n.time as time,id(n) as nodeid,
-           COUNT{{()-[]->(n)}} + COUNT{{(n)-[]->()}} as relationship_count
+           COUNT((()-[]->(n))) + COUNT(((n)-[]->()))  as relationship_count
     ORDER BY time desc
     SKIP $skip_count
     LIMIT $page_size
@@ -283,8 +283,8 @@ def label_list(skip_count, page_size, en_name_filter=None,
     cql = f"""
     MATCH (n:data_label)
     WHERE {where_str}
-    RETURN properties(n) as properties,n.time as time,id(n) as nodeid,
-           COUNT{{()-[]->(n)}} + COUNT{{(n)-[]->()}} as relationship_count
+    RETURN properties(n) as properties,n.time as time,elementId(n) as nodeid,
+           COUNT((()-[]->(n))) + COUNT(((n)-[]->()))  as relationship_count
     ORDER BY time desc
     SKIP $skip_count
     LIMIT $page_size

+ 1 - 1
app/core/llm/llm_service.py

@@ -43,7 +43,7 @@ def llm_client(content):
                 messages=[
                     {
                         "role": "system", 
-                        "content": "你是一个严格遵循指令的翻译工具。你的唯一任务是将中文单词/短语翻译成英文,"
+                        "content": "你是一个严格遵循指令的翻译工具和数据库专家。你的唯一任务是将中文单词/短语翻译成英文,符合postgresql数据库表和字段的命令规则,"
                                   "并且严格按照如下规则:\n"
                                   "1. 只返回英文翻译,不包含任何解释、描述或额外内容\n"
                                   "2. 使用小写字母\n"