mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-19 18:15:41 +00:00
feat(kg): bidirectional multi-hop traversal
Add reverse-edge UNION ALL to recursive CTE so traversal follows both source→target and target→source edges. Reverse edges prefixed with ~ in via field (e.g. ~manages). Tool output shows directional arrows.
This commit is contained in:
1 parent
9ad4a879d5
commit
b99f119e37
2 files changed
+37
-1
No files matched your search
@@ -110,7 +110,11 @@ func (t *KnowledgeGraphSearchTool) executeTraversal(ctx context.Context, agentID
|
||||
for _, r := range results {
|
||||
sb.WriteString(fmt.Sprintf("- [depth %d] %s (%s)", r.Depth, r.Entity.Name, r.Entity.EntityType))
|
||||
if r.Via != "" {
|
||||
sb.WriteString(fmt.Sprintf(" via %q", r.Via))
|
||||
if strings.HasPrefix(r.Via, "~") {
|
||||
sb.WriteString(fmt.Sprintf(" ←[%s]—", r.Via[1:]))
|
||||
} else {
|
||||
sb.WriteString(fmt.Sprintf(" —[%s]→", r.Via))
|
||||
}
|
||||
}
|
||||
if r.Entity.Description != "" {
|
||||
sb.WriteString(fmt.Sprintf("\n %s", r.Entity.Description))
|
||||
|
||||
Reference in new issue
Block a user