mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-11 03:13:24 +00:00
- Sigma.js graph: restore doc_type coloring (revert Louvain community detection) - Fix animation flash after FA2 layout finishes by removing post-processing camera reset and redundant noverlap/compactOrphans in stopLayout - Fix vault tree "Load more" state bug when filtering by doc_type: add treeVersion counter to force re-mount and reset auto-expand state - Fix meta map loss: loadRoot now merges instead of replacing, preserving subtree entries from previous loadSubtree calls - Add compact graph DTO endpoints and hooks for KG and vault graphs - Add semantic zoom tiers, adaptive FA2 settings, and node sizing
60 lines
2.0 KiB
Go
60 lines
2.0 KiB
Go
package store
|
|
|
|
import "context"
|
|
|
|
// GraphNode is a lightweight vault document for graph visualization.
|
|
type GraphNode struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"t"` // short key for wire size
|
|
Path string `json:"p"` // workspace-relative path
|
|
DocType string `json:"dt"` // doc_type
|
|
Degree int `json:"deg"`
|
|
}
|
|
|
|
// GraphEdge is a lightweight vault link for graph visualization.
|
|
type GraphEdge struct {
|
|
ID string `json:"id"`
|
|
FromID string `json:"from"`
|
|
ToID string `json:"to"`
|
|
LinkType string `json:"type"`
|
|
}
|
|
|
|
// KGGraphNode is a lightweight KG entity for graph visualization.
|
|
type KGGraphNode struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"n"`
|
|
EntityType string `json:"t"`
|
|
Confidence float64 `json:"c"`
|
|
}
|
|
|
|
// KGGraphEdge is a lightweight KG relation for graph visualization.
|
|
type KGGraphEdge struct {
|
|
ID string `json:"id"`
|
|
SourceID string `json:"src"`
|
|
TargetID string `json:"tgt"`
|
|
RelationType string `json:"type"`
|
|
}
|
|
|
|
// VaultGraphListOptions configures a vault graph query.
|
|
type VaultGraphListOptions struct {
|
|
TeamID *string
|
|
TeamIDs []string
|
|
Limit int // max 10000
|
|
}
|
|
|
|
// VaultGraphStore provides read-only graph data for visualization.
|
|
type VaultGraphStore interface {
|
|
// ListGraphNodes returns lightweight nodes with pre-computed degree.
|
|
ListGraphNodes(ctx context.Context, tenantID, agentID string, opts VaultGraphListOptions) ([]GraphNode, int, error)
|
|
// ListGraphEdges returns lightweight edges for nodes in scope.
|
|
ListGraphEdges(ctx context.Context, tenantID, agentID string, opts VaultGraphListOptions) ([]GraphEdge, int, error)
|
|
}
|
|
|
|
// KGGraphStore provides read-only KG graph data for visualization.
|
|
type KGGraphStore interface {
|
|
// ListKGGraphNodes returns lightweight entities.
|
|
ListKGGraphNodes(ctx context.Context, agentID, userID string, limit int) ([]KGGraphNode, int, error)
|
|
// ListKGGraphEdges returns lightweight relations.
|
|
ListKGGraphEdges(ctx context.Context, agentID, userID string, limit int) ([]KGGraphEdge, int, error)
|
|
}
|