Files
X-Agents/team-require/api/neo4j-graph-save.md
DESKTOP-72TV0V4\caoxiaozhu c917d6b04c feat: 添加Neo4j图数据库支持及前端代码重构
- 新增 Neo4j 图数据库 handler、service、model
- 后端添加 SaveGraph API 接口
- 前端 Database.vue 重构,拆分为独立组件
- 新增 web/src/views/database/ 组件目录
- 删除临时文件 (temp_*.go)
- 添加 Neo4j 相关 API 需求文档

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 09:11:08 +08:00

1.5 KiB

Neo4j 图谱保存接口需求

需求说明

前端需要保存 Neo4j 图谱的连接信息,以便后续快速加载和查看。


接口地址

POST /database/graph/save

请求参数

参数 类型 必填 说明
databaseId string 数据库 ID
databaseName string 数据库名称
uri string Neo4j 连接地址,如 bolt://localhost:7687
username string 用户名
labels array 标签列表
relationshipTypes array 关系类型列表
selectedLabel string 当前选中的标签

请求示例

{
  "databaseId": "123",
  "databaseName": "neo4j",
  "uri": "bolt://10.10.10.189:7687",
  "username": "neo4j",
  "labels": ["User", "Order", "Product"],
  "relationshipTypes": ["KNOWS", "BOUGHT", "BELONGS_TO"],
  "selectedLabel": "User"
}

返回参数

参数 类型 说明
success bool 是否成功
message string 消息

返回示例

{
  "success": true,
  "message": "保存成功"
}

前端调用示例

fetch('/database/graph/save', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    databaseId: '123',
    databaseName: 'neo4j',
    uri: 'bolt://10.10.10.189:7687',
    username: 'neo4j',
    labels: ['User', 'Order', 'Product'],
    relationshipTypes: ['KNOWS', 'BOUGHT', 'BELONGS_TO'],
    selectedLabel: 'User',
  }),
})