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
Align code with EE (#21007)
Jin Haif4931a94543f
diff --git a/internal/entity/models/base_model.go b/internal/entity/models/base_model.goindex 79e8e1f772..82c9c0e516 100644--- a/internal/entity/models/base_model.go+++ b/internal/entity/models/base_model.go@@ -136,7 +136,11 @@ func collectModelUsage(modelUsage *common.ModelUsage, usage *TokenUsage) error {if !modelUsage.StartAt.IsZero() {modelUsage.ResponseTimeMS = time.Since(modelUsage.StartAt).Milliseconds()}- return clickhouse.GetDriver().CollectModelUsage(modelUsage)+ driver := clickhouse.GetDriver()+ if driver == nil {+ return nil+ }+ return driver.CollectModelUsage(modelUsage)}// applyStreamUsage exposes streamed token usage to the caller and records itdiff --git a/internal/harness/graph/graph/graph_integration_test.go b/internal/harness/graph/graph/graph_integration_test.goindex 53cc426f40..929fcf6a7f 100644--- a/internal/harness/graph/graph/graph_integration_test.go+++ b/internal/harness/graph/graph/graph_integration_test.go@@ -266,19 +266,22 @@ func TestGraphIntegration_Streaming(t *testing.T) {outCh, errCh := cg.Stream(ctx, map[string]interface{}{"value": ""}, types.StreamModeValues)events := 0-loop:- for {+ for outCh != nil || errCh != nil {select {case _, ok := <-outCh:if !ok {- break loop+ outCh = nil+ continue}events++- case err := <-errCh:+ case err, ok := <-errCh:+ if !ok {+ errCh = nil+ continue+ }if err != nil {t.Fatalf("Stream error: %v", err)}- break loopcase <-time.After(3 * time.Second):t.Fatal("stream timeout")}diff --git a/internal/router/router_test.go b/internal/router/router_test.goindex 7ed8b4ded4..aa40fc123c 100644--- a/internal/router/router_test.go+++ b/internal/router/router_test.go@@ -4,6 +4,7 @@ import ("encoding/json""net/http""net/http/httptest"+ "os""testing""github.com/gin-gonic/gin"@@ -11,9 +12,18 @@ import ("ragflow/internal/common""ragflow/internal/handler"+ "ragflow/internal/server""ragflow/internal/service")+func TestMain(m *testing.M) {+ if err := server.InitLocalVariables(); err != nil {+ panic(err)+ }+ server.SetServerName("test")+ os.Exit(m.Run())+}+func TestRouterSetupRemovesActionRoutes(t *testing.T) {gin.SetMode(gin.TestMode)originalLogger := common.Logger