fix: 修正swag文档端口号

This commit is contained in:
2026-04-13 16:24:25 +08:00
parent 4c3d5298af
commit c9643db67e
4 changed files with 347 additions and 357 deletions
+1 -1
View File
@@ -332,7 +332,7 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0.0",
Host: "localhost:8080",
Host: "localhost:3001",
BasePath: "/",
Schemes: []string{},
Title: "知识图谱 API",
+6 -16
View File
@@ -6,15 +6,13 @@
"contact": {},
"version": "1.0.0"
},
"host": "localhost:8080",
"host": "localhost:3001",
"basePath": "/",
"paths": {
"/api/graph": {
"get": {
"description": "获取知识图谱的全部节点和边数据",
"produces": [
"application/json"
],
"produces": ["application/json"],
"summary": "获取图数据",
"responses": {
"200": {
@@ -35,9 +33,7 @@
"/api/graph/stats": {
"get": {
"description": "获取知识图谱的节点数、边数等统计信息",
"produces": [
"application/json"
],
"produces": ["application/json"],
"summary": "获取图统计信息",
"responses": {
"200": {
@@ -59,9 +55,7 @@
"/api/nodes/{id}": {
"get": {
"description": "根据节点 ID 获取知识图谱中的节点详细信息",
"produces": [
"application/json"
],
"produces": ["application/json"],
"summary": "获取节点详情",
"parameters": [
{
@@ -103,9 +97,7 @@
"/api/nodes/{id}/neighbors": {
"get": {
"description": "根据节点 ID 获取其所有邻居节点及关联边",
"produces": [
"application/json"
],
"produces": ["application/json"],
"summary": "获取节点邻居",
"parameters": [
{
@@ -147,9 +139,7 @@
"/api/search": {
"get": {
"description": "根据关键词搜索知识图谱中的节点",
"produces": [
"application/json"
],
"produces": ["application/json"],
"summary": "搜索节点",
"parameters": [
{
+20 -20
View File
@@ -30,22 +30,22 @@ definitions:
properties:
edges:
items:
$ref: '#/definitions/models.Edge'
$ref: "#/definitions/models.Edge"
type: array
nodes:
items:
$ref: '#/definitions/models.Node'
$ref: "#/definitions/models.Node"
type: array
type: object
models.NeighborResponse:
properties:
edges:
items:
$ref: '#/definitions/models.Edge'
$ref: "#/definitions/models.Edge"
type: array
nodes:
items:
$ref: '#/definitions/models.Node'
$ref: "#/definitions/models.Node"
type: array
type: object
models.Node:
@@ -88,10 +88,10 @@ definitions:
type: integer
results:
items:
$ref: '#/definitions/models.Node'
$ref: "#/definitions/models.Node"
type: array
type: object
host: localhost:8080
host: localhost:3001
info:
contact: {}
description: 知识图谱后端服务,提供图数据查询、节点搜索等功能
@@ -107,11 +107,11 @@ paths:
"200":
description: 成功
schema:
$ref: '#/definitions/models.GraphData'
$ref: "#/definitions/models.GraphData"
"500":
description: 内部错误
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
summary: 获取图数据
/api/graph/stats:
get:
@@ -127,7 +127,7 @@ paths:
"500":
description: 内部错误
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
summary: 获取图统计信息
/api/nodes/{id}:
get:
@@ -144,19 +144,19 @@ paths:
"200":
description: 成功
schema:
$ref: '#/definitions/models.NodeResponse'
$ref: "#/definitions/models.NodeResponse"
"400":
description: 请求错误
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
"404":
description: 节点未找到
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
"500":
description: 内部错误
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
summary: 获取节点详情
/api/nodes/{id}/neighbors:
get:
@@ -173,19 +173,19 @@ paths:
"200":
description: 成功
schema:
$ref: '#/definitions/models.NeighborResponse'
$ref: "#/definitions/models.NeighborResponse"
"400":
description: 请求错误
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
"404":
description: 节点未找到
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
"500":
description: 内部错误
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
summary: 获取节点邻居
/api/search:
get:
@@ -202,14 +202,14 @@ paths:
"200":
description: 成功
schema:
$ref: '#/definitions/models.SearchResponse'
$ref: "#/definitions/models.SearchResponse"
"400":
description: 请求错误
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
"500":
description: 内部错误
schema:
$ref: '#/definitions/models.ErrorResponse'
$ref: "#/definitions/models.ErrorResponse"
summary: 搜索节点
swagger: "2.0"
+1 -1
View File
@@ -20,7 +20,7 @@ import (
// @title 知识图谱 API
// @version 1.0.0
// @description 知识图谱后端服务,提供图数据查询、节点搜索等功能
// @host localhost:8080
// @host localhost:3001
// @BasePath /
func main() {
cfg, err := config.Load()