RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
refactor(agent): remove unreachable canvas helpers (#20171)
Sbaaoui Idriss322322caa8a5
diff --git a/internal/agent/canvas/multibranch.go b/internal/agent/canvas/multibranch.goindex 3eb23f5d0b..d8c346e9ac 100644--- a/internal/agent/canvas/multibranch.go+++ b/internal/agent/canvas/multibranch.go@@ -47,7 +47,6 @@ package canvasimport ("context"- "fmt""strings""github.com/cloudwego/eino/compose"@@ -201,18 +200,3 @@ func makeSwitchBranchCondition(endNodes map[string]bool) compose.GraphMultiBrancreturn chosen, nil}}--// fmtBranchRegistrations is a small debug helper kept here so the-// table of installed branches can be dumped from a test or a future-// verbose-logging path without pulling in fmt at the call site.-// Currently unused; lives next to its data type for symmetry.-func fmtBranchRegistrations(regs []branchRegistration) string {- if len(regs) == 0 {- return "no multi-branches installed"- }- var b strings.Builder- for _, r := range regs {- fmt.Fprintf(&b, "%s -> %v\n", r.Parent, r.EndNodes)- }- return b.String()-}diff --git a/internal/agent/canvas/node_body.go b/internal/agent/canvas/node_body.goindex 6f1c7808fa..c4fe408aba 100644--- a/internal/agent/canvas/node_body.go+++ b/internal/agent/canvas/node_body.go@@ -35,9 +35,7 @@ import ("fmt""ragflow/internal/common""ragflow/internal/dao"- "strconv""strings"- "time""ragflow/internal/agent/runtime"@@ -195,22 +193,6 @@ func legacyNoOpBody(cpnID string) nodeBodyFn {}}-// componentTimeout returns the per-component Invoke timeout.-//-// Reads the COMPONENT_EXEC_TIMEOUT env var (seconds); defaults to 600s-// (10 min) to match the Python @timeout decorator's default in-// agent/component/base.py. Invalid / non-positive values fall back to-// the default — invalid input must never widen the timeout silently.-func componentTimeout() time.Duration {- const def = 600 * time.Second- if v := common.GetEnv(common.EnvComponentExecTimeout); v != "" {- if secs, err := strconv.Atoi(v); err == nil && secs > 0 {- return time.Duration(secs) * time.Second- }- }- return def-}-// realComponentBody returns a body that delegates to the supplied// runtime.Component. The component is constructed once at build time// (in buildNodeBody) and re-invoked per iteration.diff --git a/internal/agent/canvas/runner.go b/internal/agent/canvas/runner.goindex a390f271f4..bcbbdeb939 100644--- a/internal/agent/canvas/runner.go+++ b/internal/agent/canvas/runner.go@@ -498,50 +498,3 @@ func safeEventJSON(v any) string {func nowUnix() int64 {return time.Now().Unix()}--// extractAnswerFromState is kept for reference but is no longer called-// by the Runner — answer extraction now happens in buildRunFunc.-// Remove in a follow-up cleanup pass once all tests pass.-func extractAnswerFromState(state *CanvasState) (string, []interface{}) {- if state == nil {- return "", nil- }- snap := state.Snapshot()- var answer string- var reference []interface{}- // First pass: look for an "answer" key (preferred).- for _, bucket := range snap {- if a, ok := bucket["answer"].(string); ok && a != "" {- answer = a- break- }- }- // Second pass: fall back to "result" then "content" if- // no "answer" was found.- if answer == "" {- for _, bucket := range snap {- if r, ok := bucket["result"].(string); ok && r != "" {- answer = r- break- }- }- }- if answer == "" {- for _, bucket := range snap {- if c, ok := bucket["content"].(string); ok && c != "" {- answer = c- break- }- }- }- // Collect references (best-effort, no precedence).- for _, bucket := range snap {- if r, ok := bucket["reference"].([]interface{}); ok {- reference = append(reference, r...)- }- }- if answer == "" {- answer = "Run completed with no surfaceable answer."- }- return answer, reference-}diff --git a/internal/agent/canvas/scheduler.go b/internal/agent/canvas/scheduler.goindex ecc788823c..7560dcdb0a 100644--- a/internal/agent/canvas/scheduler.go+++ b/internal/agent/canvas/scheduler.go@@ -836,18 +836,3 @@ func wireWorkflowTerminals(addEndInput(terminalMergeNodeID)return nil}--// snapshotOutputs is retained as a thin wrapper around state.Snapshot()-// for any leftover callers in test/bench files. New code should call-// state.Snapshot() directly.-func snapshotOutputs(src map[string]map[string]any) map[string]map[string]any {- out := make(map[string]map[string]any, len(src))- for k, v := range src {- cp := make(map[string]any, len(v))- for kk, vv := range v {- cp[kk] = vv- }- out[k] = cp- }- return out-}