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
+78
View File
@@ -131,6 +131,29 @@ const docTemplate = `{
}
}
},
"/api/graph/simpleJson": {
"get": {
"description": "获取知识图谱的全部节点和边数据(仅保留核心信息,适合LLM处理)",
"produces": [
"application/json"
],
"summary": "获取简化图数据",
"responses": {
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/models.SimpleGraphData"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/graph/stats": {
"get": {
"description": "获取知识图谱的节点数、边数等统计信息",
@@ -694,6 +717,61 @@ const docTemplate = `{
}
}
},
"models.SimpleEdge": {
"type": "object",
"properties": {
"label": {
"type": "string",
"example": "包含"
},
"source": {
"type": "string",
"example": "1"
},
"target": {
"type": "string",
"example": "2"
},
"type": {
"type": "string",
"example": "CONTAINS"
}
}
},
"models.SimpleGraphData": {
"type": "object",
"properties": {
"edges": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SimpleEdge"
}
},
"nodes": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SimpleNode"
}
}
}
},
"models.SimpleNode": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "1"
},
"label": {
"type": "string",
"example": "人工智能"
},
"type": {
"type": "string",
"example": "概念"
}
}
},
"models.UpdateNodeRequest": {
"type": "object",
"properties": {
+78
View File
@@ -125,6 +125,29 @@
}
}
},
"/api/graph/simpleJson": {
"get": {
"description": "获取知识图谱的全部节点和边数据(仅保留核心信息,适合LLM处理)",
"produces": [
"application/json"
],
"summary": "获取简化图数据",
"responses": {
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/models.SimpleGraphData"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
}
}
}
},
"/api/graph/stats": {
"get": {
"description": "获取知识图谱的节点数、边数等统计信息",
@@ -688,6 +711,61 @@
}
}
},
"models.SimpleEdge": {
"type": "object",
"properties": {
"label": {
"type": "string",
"example": "包含"
},
"source": {
"type": "string",
"example": "1"
},
"target": {
"type": "string",
"example": "2"
},
"type": {
"type": "string",
"example": "CONTAINS"
}
}
},
"models.SimpleGraphData": {
"type": "object",
"properties": {
"edges": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SimpleEdge"
}
},
"nodes": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SimpleNode"
}
}
}
},
"models.SimpleNode": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "1"
},
"label": {
"type": "string",
"example": "人工智能"
},
"type": {
"type": "string",
"example": "概念"
}
}
},
"models.UpdateNodeRequest": {
"type": "object",
"properties": {
+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: 获取知识图谱的节点数、边数等统计信息