mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-18 16:13:22 +02:00
remove type from loading
This commit is contained in:
@@ -74,8 +74,20 @@ export class KnowledgeGraphManager {
|
||||
const lines = data.split("\n").filter(line => line.trim() !== "");
|
||||
return lines.reduce((graph: KnowledgeGraph, line) => {
|
||||
const item = JSON.parse(line);
|
||||
if (item.type === "entity") graph.entities.push(item as Entity);
|
||||
if (item.type === "relation") graph.relations.push(item as Relation);
|
||||
if (item.type === "entity") {
|
||||
graph.entities.push({
|
||||
name: item.name,
|
||||
entityType: item.entityType,
|
||||
observations: item.observations
|
||||
});
|
||||
}
|
||||
if (item.type === "relation") {
|
||||
graph.relations.push({
|
||||
from: item.from,
|
||||
to: item.to,
|
||||
relationType: item.relationType
|
||||
});
|
||||
}
|
||||
return graph;
|
||||
}, { entities: [], relations: [] });
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user