// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": {}, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/api/edges": { "post": { "description": "在知识图谱中创建一个新边(关系)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "创建边", "parameters": [ { "description": "边创建请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.CreateEdgeRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "$ref": "#/definitions/model.EdgeResponse" } }, "400": { "description": "请求错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "404": { "description": "源节点或目标节点未找到", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "409": { "description": "边已存在", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } }, "/api/edges/{id}": { "delete": { "description": "从知识图谱中删除指定的边", "produces": [ "application/json" ], "summary": "删除边", "parameters": [ { "type": "string", "description": "边ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/model.DeleteResponse" } }, "404": { "description": "边未找到", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } }, "/api/graph": { "get": { "description": "获取知识图谱的全部节点和边数据", "produces": [ "application/json" ], "summary": "获取图数据", "responses": { "200": { "description": "成功", "schema": { "$ref": "#/definitions/model.GraphData" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } }, "/api/graph/simpleJson": { "get": { "description": "获取知识图谱的全部节点和边数据(仅保留核心信息,适合LLM处理)", "produces": [ "application/json" ], "summary": "获取简化图数据", "responses": { "200": { "description": "成功", "schema": { "$ref": "#/definitions/model.SimpleGraphData" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } }, "/api/graph/stats": { "get": { "description": "获取知识图谱的节点数、边数等统计信息", "produces": [ "application/json" ], "summary": "获取图统计信息", "responses": { "200": { "description": "成功", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } }, "/api/nodes": { "post": { "description": "在知识图谱中创建一个新节点", "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "创建节点", "parameters": [ { "description": "节点创建请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.CreateNodeRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "$ref": "#/definitions/model.Node" } }, "400": { "description": "请求错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "409": { "description": "节点已存在", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } }, "/api/nodes/{id}": { "get": { "description": "根据节点 ID 获取知识图谱中的节点详细信息", "produces": [ "application/json" ], "summary": "获取节点详情", "parameters": [ { "type": "string", "description": "节点 ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "成功", "schema": { "$ref": "#/definitions/model.NodeResponse" } }, "400": { "description": "请求错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "404": { "description": "节点未找到", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } }, "put": { "description": "更新知识图谱中指定节点的信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "更新节点", "parameters": [ { "type": "string", "description": "节点ID", "name": "id", "in": "path", "required": true }, { "description": "节点更新请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.UpdateNodeRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/model.Node" } }, "400": { "description": "请求错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "404": { "description": "节点未找到", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } }, "delete": { "description": "从知识图谱中删除指定节点及其相关的所有边", "produces": [ "application/json" ], "summary": "删除节点", "parameters": [ { "type": "string", "description": "节点ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/model.DeleteResponse" } }, "404": { "description": "节点未找到", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } }, "/api/nodes/{id}/neighbors": { "get": { "description": "根据节点 ID 获取其所有邻居节点及关联边", "produces": [ "application/json" ], "summary": "获取节点邻居", "parameters": [ { "type": "string", "description": "节点 ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "成功", "schema": { "$ref": "#/definitions/model.NeighborResponse" } }, "400": { "description": "请求错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "404": { "description": "节点未找到", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } }, "/api/search": { "get": { "description": "根据关键词搜索知识图谱中的节点", "produces": [ "application/json" ], "summary": "搜索节点", "parameters": [ { "type": "string", "description": "搜索关键词", "name": "q", "in": "query", "required": true } ], "responses": { "200": { "description": "成功", "schema": { "$ref": "#/definitions/model.SearchResponse" } }, "400": { "description": "请求错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/model.ErrorResponse" } } } } } }, "definitions": { "model.CreateEdgeRequest": { "type": "object", "required": [ "id", "label", "source", "target" ], "properties": { "id": { "type": "string", "example": "edge_123" }, "label": { "type": "string", "example": "包含" }, "properties": { "type": "object", "additionalProperties": true }, "source": { "type": "string", "example": "node_1" }, "target": { "type": "string", "example": "node_2" }, "type": { "type": "string", "example": "CONTAINS" } } }, "model.CreateNodeRequest": { "type": "object", "required": [ "id", "label", "type" ], "properties": { "id": { "type": "string", "example": "node_123" }, "label": { "type": "string", "example": "人工智能" }, "properties": { "type": "object", "additionalProperties": true }, "type": { "type": "string", "example": "概念" }, "x": { "type": "number", "example": 100 }, "y": { "type": "number", "example": 200 } } }, "model.DeleteResponse": { "type": "object", "properties": { "id": { "type": "string", "example": "node_123" }, "message": { "type": "string", "example": "节点已成功删除" }, "success": { "type": "boolean", "example": true } } }, "model.Edge": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "properties": { "type": "object", "additionalProperties": true }, "source": { "type": "string" }, "style": { "type": "object", "additionalProperties": true }, "target": { "type": "string" }, "type": { "type": "string" } } }, "model.EdgeResponse": { "type": "object", "properties": { "id": { "type": "string", "example": "edge_123" }, "label": { "type": "string", "example": "包含" }, "properties": { "type": "object", "additionalProperties": true }, "source": { "type": "string", "example": "node_1" }, "target": { "type": "string", "example": "node_2" }, "type": { "type": "string", "example": "CONTAINS" } } }, "model.ErrorResponse": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } } }, "model.GraphData": { "type": "object", "properties": { "edges": { "type": "array", "items": { "$ref": "#/definitions/model.Edge" } }, "nodes": { "type": "array", "items": { "$ref": "#/definitions/model.Node" } } } }, "model.NeighborResponse": { "type": "object", "properties": { "edges": { "type": "array", "items": { "$ref": "#/definitions/model.Edge" } }, "nodes": { "type": "array", "items": { "$ref": "#/definitions/model.Node" } } } }, "model.Node": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "properties": { "type": "object", "additionalProperties": true }, "style": { "type": "object", "additionalProperties": true }, "type": { "type": "string" }, "x": { "type": "number" }, "y": { "type": "number" } } }, "model.NodeResponse": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "neighbors": { "type": "array", "items": { "$ref": "#/definitions/model.Node" } }, "properties": { "type": "object", "additionalProperties": true }, "style": { "type": "object", "additionalProperties": true }, "type": { "type": "string" }, "x": { "type": "number" }, "y": { "type": "number" } } }, "model.SearchResponse": { "type": "object", "properties": { "count": { "type": "integer" }, "nodes": { "type": "array", "items": { "$ref": "#/definitions/model.Node" } }, "query": { "type": "string" } } }, "model.SimpleEdge": { "type": "object", "properties": { "label": { "type": "string", "example": "包含" }, "source": { "type": "string", "example": "1" }, "target": { "type": "string", "example": "2" }, "type": { "type": "string", "example": "CONTAINS" } } }, "model.SimpleGraphData": { "type": "object", "properties": { "edges": { "type": "array", "items": { "$ref": "#/definitions/model.SimpleEdge" } }, "nodes": { "type": "array", "items": { "$ref": "#/definitions/model.SimpleNode" } } } }, "model.SimpleNode": { "type": "object", "properties": { "id": { "type": "string", "example": "1" }, "label": { "type": "string", "example": "人工智能" }, "type": { "type": "string", "example": "概念" } } }, "model.UpdateNodeRequest": { "type": "object", "properties": { "label": { "type": "string", "example": "机器学习" }, "properties": { "type": "object", "additionalProperties": true }, "type": { "type": "string", "example": "工具" }, "x": { "type": "number", "example": 150 }, "y": { "type": "number", "example": 250 } } } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "1.0.0", Host: "localhost:3001", BasePath: "/", Schemes: []string{}, Title: "知识图谱 API", Description: "知识图谱后端服务,提供图数据查询、节点搜索等功能", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) }