Files

86 lines
2.9 KiB
Go

package model
// Node represents a graph node
type Node struct {
ID string `json:"id"`
Label string `json:"label"`
Type string `json:"type,omitempty"`
X float64 `json:"x,omitempty"`
Y float64 `json:"y,omitempty"`
Style map[string]interface{} `json:"style,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
}
// Edge represents a graph edge
type Edge struct {
ID string `json:"id"`
Source string `json:"source"`
Target string `json:"target"`
Label string `json:"label,omitempty"`
Type string `json:"type,omitempty"`
Style map[string]interface{} `json:"style,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
}
// GraphData represents the complete graph structure
type GraphData struct {
Nodes []Node `json:"nodes"`
Edges []Edge `json:"edges"`
}
// SimpleNode 简化版节点结构,仅保留核心信息,适合 LLM 处理
type SimpleNode struct {
ID string `json:"id" example:"1"`
Label string `json:"label" example:"人工智能"`
Type string `json:"type,omitempty" example:"概念"`
}
// SimpleEdge 简化版边结构,仅保留核心信息,适合 LLM 处理
type SimpleEdge struct {
Source string `json:"source" example:"1"`
Target string `json:"target" example:"2"`
Type string `json:"type,omitempty" example:"CONTAINS"`
Label string `json:"label,omitempty" example:"包含"`
}
// SimpleGraphData 简化版图数据,适合 LLM 处理
type SimpleGraphData struct {
Nodes []SimpleNode `json:"nodes"`
Edges []SimpleEdge `json:"edges"`
}
// StatsResponse represents graph statistics
type StatsResponse struct {
TotalNodes int `json:"totalNodes"`
TotalEdges int `json:"totalEdges"`
ConceptNodes int `json:"conceptNodes,omitempty"`
ToolNodes int `json:"toolNodes,omitempty"`
ApplicationNodes int `json:"applicationNodes,omitempty"`
}
// NeighborResponse represents a node's neighbors and related edges
type NeighborResponse struct {
Nodes []Node `json:"nodes"`
Edges []Edge `json:"edges"`
}
// NodeResponse represents a node detail response
type NodeResponse struct {
ID string `json:"id"`
Label string `json:"label"`
Type string `json:"type,omitempty"`
X float64 `json:"x,omitempty"`
Y float64 `json:"y,omitempty"`
Style map[string]interface{} `json:"style,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
Neighbors []Node `json:"neighbors,omitempty"`
}
// SearchResponse represents search results
type SearchResponse struct {
Count int `json:"count"`
Query string `json:"query"`
Nodes []Node `json:"nodes"`
}