diff --git a/pom.xml b/pom.xml
index dc143d7..a1ec29c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,6 +100,10 @@
commonmark-ext-gfm-tables
0.21.0
+
+ org.springframework.ai
+ spring-ai-starter-model-openai
+
diff --git a/src/main/java/com/supervision/pdfqaserver/cache/PromptCache.java b/src/main/java/com/supervision/pdfqaserver/cache/PromptCache.java
index d355d8b..9ff1499 100644
--- a/src/main/java/com/supervision/pdfqaserver/cache/PromptCache.java
+++ b/src/main/java/com/supervision/pdfqaserver/cache/PromptCache.java
@@ -838,7 +838,6 @@ x {}
"- Express simple equality predicates in map patterns and move all other filters to a **WHERE** clause.\\n\\n"
"4. Return Clause Strategy:\\n"
"- RETURN every node and relationship mentioned, unless the user explicitly requests specific properties.\\n\\n"
- "- The truncationId、name attribute of a node is very important, and each node needs to return truncationId、name .\\n\\n"
"5. Final Cypher Script Generation:\\n"
"- Respond with **only** the final Cypher query—no commentary or extra text.\\n"
"- Use OPTIONAL MATCH only if explicitly required by the user and supported by the schema.\\n"
diff --git a/src/main/java/com/supervision/pdfqaserver/dao/Neo4jRepository.java b/src/main/java/com/supervision/pdfqaserver/dao/Neo4jRepository.java
index 1ccd977..0141dfb 100644
--- a/src/main/java/com/supervision/pdfqaserver/dao/Neo4jRepository.java
+++ b/src/main/java/com/supervision/pdfqaserver/dao/Neo4jRepository.java
@@ -9,6 +9,7 @@ import com.supervision.pdfqaserver.dto.neo4j.NodeData;
import com.supervision.pdfqaserver.dto.neo4j.RelationObject;
import com.supervision.pdfqaserver.dto.neo4j.RelationshipData;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.neo4j.driver.*;
import org.neo4j.driver.Record;
import org.neo4j.driver.types.Node;
@@ -20,6 +21,7 @@ import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import static org.neo4j.driver.Values.parameters;
+@Slf4j
@Repository
@RequiredArgsConstructor
public class Neo4jRepository {
@@ -153,6 +155,7 @@ public class Neo4jRepository {
if (StrUtil.isEmpty(nodeType)){
continue;
}
+ nodeType = nodeType.substring(1, nodeType.length()-1).replace("`", "");
String propertyName = record.get("propertyName").asString();
List propertyTypes = record.get("propertyTypes").asList(Value::asString);
@@ -160,8 +163,9 @@ public class Neo4jRepository {
TruncationERAttributeDTO attributeDTO = new TruncationERAttributeDTO(propertyName, null, CollUtil.getFirst(propertyTypes));
// 检查是否已存在该节点类型
+ final String nodeType_f = nodeType;
EntityExtractionDTO existingEntity = extractionDTOS.stream()
- .filter(e -> StrUtil.equals(e.getEntityEn(), nodeType))
+ .filter(e -> StrUtil.equals(e.getEntityEn(), nodeType_f))
.findFirst().orElse(null);
if (existingEntity != null) {
@@ -197,6 +201,7 @@ public class Neo4jRepository {
if (StrUtil.isEmpty(relType)){
continue;
}
+ relType = relType.substring(1, relType.length()-1).replace("`", "");
String propertyName = record.get("propertyName").asString();
List propertyTypes = record.get("propertyTypes").asList(Value::asString);
@@ -214,14 +219,15 @@ public class Neo4jRepository {
List relationExtractionDTOS = new ArrayList<>();
String queryEndpoints = """
- MATCH (s)-[r:`{rtype}`]->(t)
+ MATCH (s)-[r: `{rtype}` ]->(t)
WITH labels(s)[0] AS src, labels(t)[0] AS tgt
RETURN src, tgt
""";
for (Map.Entry>> entry : relationProperties.entrySet()) {
String relType = entry.getKey();
List