feat: 增加简化版json数据

This commit is contained in:
2026-04-15 14:52:33 +08:00
parent 37cd2171b1
commit 8c5cd3705a
9 changed files with 310 additions and 1 deletions
+53
View File
@@ -196,6 +196,44 @@ definitions:
$ref: '#/definitions/models.Node'
type: array
type: object
models.SimpleEdge:
properties:
label:
example: 包含
type: string
source:
example: "1"
type: string
target:
example: "2"
type: string
type:
example: CONTAINS
type: string
type: object
models.SimpleGraphData:
properties:
edges:
items:
$ref: '#/definitions/models.SimpleEdge'
type: array
nodes:
items:
$ref: '#/definitions/models.SimpleNode'
type: array
type: object
models.SimpleNode:
properties:
id:
example: "1"
type: string
label:
example: 人工智能
type: string
type:
example: 概念
type: string
type: object
models.UpdateNodeRequest:
properties:
label:
@@ -302,6 +340,21 @@ paths:
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: 获取图数据
/api/graph/simpleJson:
get:
description: 获取知识图谱的全部节点和边数据(仅保留核心信息,适合LLM处理)
produces:
- application/json
responses:
"200":
description: 成功
schema:
$ref: '#/definitions/models.SimpleGraphData'
"500":
description: 内部错误
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: 获取简化图数据
/api/graph/stats:
get:
description: 获取知识图谱的节点数、边数等统计信息