Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,12 @@ public String addEntity(@Param("graphName") String graphName,
memoryMutableGraph.addEdge(((GraphEdge) entity).getEdge());
}
}
GraphMemoryServer insertServer = CACHE.getServerByName(graphName);
if (insertServer == null || insertServer.getGraphAccessors().isEmpty()) {
throw new RuntimeException("Server or graph accessor not available for graph: " + graphName);
}
CACHE.getConsolidateServer().executeConsolidateTask(
CACHE.getServerByName(graphName).getGraphAccessors().get(0), memoryMutableGraph);
insertServer.getGraphAccessors().get(0), memoryMutableGraph);
return "Success to add entities, num: " + graphEntities.size();
}

Expand Down Expand Up @@ -213,6 +217,9 @@ public String execQuery(@Param("sessionId") String sessionId,
VectorSearch search = new VectorSearch(null, sessionId);
search.addVector(new KeywordVector(query));
server.search(search);
if (server.getGraphAccessors().isEmpty()) {
throw new RuntimeException("No graph accessor available for session: " + sessionId);
}
Context context = server.verbalize(sessionId,
new SubgraphSemanticPromptFunction(server.getGraphAccessors().get(0)));
return context.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public String search(VectorSearch search) {
sessionManagement.createSession(sessionId);
}

if (graphAccessors.isEmpty()) {
throw new RuntimeException("No graph accessor available");
}
for (IndexStore indexStore : indexStores) {
if (indexStore instanceof EntityAttributeIndexStore) {
SessionOperator searchOperator = new SessionOperator(graphAccessors.get(0), indexStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ public void putGraph(Graph g) {
}

public void putServer(GraphMemoryServer server) {
if (server.getGraphAccessors().isEmpty()) {
throw new RuntimeException("Cannot register server without graph accessor");
}
name2Server.put(server.getGraphAccessors().get(0)
.getGraphSchema().getName(), server);
}

public void putSession(GraphMemoryServer server, String sessionId) {
if (server.getGraphAccessors().isEmpty()) {
throw new RuntimeException("Cannot register session without graph accessor");
}
session2GraphName.put(sessionId,
server.getGraphAccessors().get(0).getGraphSchema().getName());
}
Expand Down
Loading