From 09c2a03cefa687832257d3b816da50db3cfcc0f2 Mon Sep 17 00:00:00 2001
From: ai_xiaopei <xiaopei@aisim.cn>
Date: Sat, 25 Jul 2026 23:48:11 +0800
Subject: [PATCH] feat: 实现输出格式化
---
internal/graph/model.go | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/internal/graph/model.go b/internal/graph/model.go
new file mode 100644
index 0000000..0702912
--- /dev/null
+++ b/internal/graph/model.go
@@ -0,0 +1,27 @@
+package graph
+
+// Node 图节点(对应一个 markdown 文件)
+type Node struct {
+ ID int64 `json:"id"`
+ Path string `json:"path"`
+ Title string `json:"title"`
+ Section string `json:"section"`
+ Tags []string `json:"tags"`
+ Entities []string `json:"entities"`
+ Wikilinks []string `json:"wikilinks"`
+ Content string `json:"content"`
+}
+
+// Edge 图边(实体关系)
+type Edge struct {
+ FromNode int64 `json:"from_node"`
+ ToNode int64 `json:"to_node"` // 对于 tag/entity 边,ToNode 可以是虚拟节点 ID
+ Relation string `json:"relation"` // "tag" | "entity" | "wikilink"
+ Label string `json:"label"` // 具体值
+}
+
+// Graph 知识图谱
+type Graph struct {
+ Nodes []*Node
+ Edges []*Edge
+}
--
Gitblit v1.9.1