2026-06-24 10:02:42 +00:00
|
|
|
package usecase
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
libkg "haixun-backend/internal/library/knowledge"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type GraphSummary struct {
|
2026-06-24 16:48:56 +00:00
|
|
|
ID string
|
|
|
|
|
BrandID string
|
|
|
|
|
TopicID string
|
|
|
|
|
Seed string
|
|
|
|
|
Nodes []libkg.Node
|
|
|
|
|
Edges []libkg.Edge
|
|
|
|
|
BraveSources []libkg.BraveSource
|
|
|
|
|
ExpandStrategy string
|
|
|
|
|
PainTagCount int
|
|
|
|
|
GeneratedAt int64
|
|
|
|
|
CreateAt int64
|
|
|
|
|
UpdateAt int64
|
2026-06-24 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpsertRequest struct {
|
2026-06-24 16:48:56 +00:00
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
BrandID string
|
|
|
|
|
TopicID string
|
|
|
|
|
Seed string
|
|
|
|
|
Nodes []libkg.Node
|
|
|
|
|
Edges []libkg.Edge
|
|
|
|
|
BraveSources []libkg.BraveSource
|
|
|
|
|
ExpandStrategy string
|
|
|
|
|
PainTagCount int
|
|
|
|
|
GeneratedAt int64
|
2026-06-24 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-24 16:48:56 +00:00
|
|
|
type NodeUpdate struct {
|
|
|
|
|
NodeID string
|
|
|
|
|
SelectedForScan *bool
|
|
|
|
|
RelevanceTags []string
|
|
|
|
|
RelevanceTagsSet bool
|
|
|
|
|
RecencyTags []string
|
|
|
|
|
RecencyTagsSet bool
|
2026-06-24 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpdateNodesRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
BrandID string
|
2026-06-24 16:48:56 +00:00
|
|
|
TopicID string
|
|
|
|
|
Updates []NodeUpdate
|
2026-06-24 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UseCase interface {
|
|
|
|
|
Get(ctx context.Context, tenantID, ownerUID, brandID string) (*GraphSummary, error)
|
2026-06-24 16:48:56 +00:00
|
|
|
GetByTopic(ctx context.Context, tenantID, ownerUID, topicID string) (*GraphSummary, error)
|
2026-06-24 10:02:42 +00:00
|
|
|
Upsert(ctx context.Context, req UpsertRequest) (*GraphSummary, error)
|
2026-06-24 16:48:56 +00:00
|
|
|
UpdateNodes(ctx context.Context, req UpdateNodesRequest) (*GraphSummary, error)
|
|
|
|
|
AttachTopicID(ctx context.Context, tenantID, ownerUID, brandID, topicID string) error
|
2026-06-24 10:02:42 +00:00
|
|
|
}
|