Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Go: add deepdoc server framework (#19988)

Jin Hai3b7cc76ef3c3
diff --git a/build.sh b/build.sh
index 610af90740..083c811bcb 100755
--- a/build.sh
+++ b/build.sh
@@ -560,7 +560,7 @@ build_go() {
GOPROXY=${GOPROXY:-https://goproxy.cn,https://proxy.golang.org,direct} CGO_ENABLED=1 \
CGO_CFLAGS="$CGO_CFLAGS" CGO_LDFLAGS="$CGO_LDFLAGS" \
go build -tags cgo,static,sonic "${strip_flags[@]}" -o "$RAGFLOW_SERVER_BINARY" \
- cmd/ragflow_server.go
+ cmd/ragflow_server.go cmd/deepdoc_server_ee.go
set +x
diff --git a/cmd/deepdoc_server_ee.go b/cmd/deepdoc_server_ee.go
new file mode 100644
index 0000000000..09bacb9c7e
--- /dev/null
+++ b/cmd/deepdoc_server_ee.go
@@ -0,0 +1,27 @@
+//
+// Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package main
+
+import (
+ "context"
+ "ragflow/internal/common"
+)
+
+func runDeepDoc(ctx context.Context, args *serverArgs) error {
+ common.Info("DeepDoc server is not implemented")
+ return nil
+}
diff --git a/cmd/ragflow_server.go b/cmd/ragflow_server.go
index 14fbd06dd8..0066958ec7 100644
--- a/cmd/ragflow_server.go
+++ b/cmd/ragflow_server.go
@@ -78,7 +78,7 @@ import (
)
type serverArgs struct {
- mode *string // admin | api | ingestor | syncer
+ mode *string // admin | api | ingestor | syncer | deepdoc
helpFlag bool
versionFlag bool
logLevel *string
@@ -86,8 +86,8 @@ type serverArgs struct {
configPath *string // Used by admin, api; user defined config path
initSuperUser bool // Used by admin;
port *int // Used by admin, api
- adminHost *string // Used by api, ingestor, syncer for heartbeat
- adminPort *int // Used by api, ingestor, syncer for heartbeat, "ip:port"
+ adminHost *string // Used by api, ingestor, syncer, deepdoc for heartbeat
+ adminPort *int // Used by api, ingestor, syncer, deepdoc for heartbeat, "ip:port"
name *string // server name
enablePProf bool // enable pprof
mcpEnabled bool
@@ -257,6 +257,9 @@ func parseArgs() (*serverArgs, error) {
case "--syncer":
serverMode = "syncer"
args.mode = &serverMode
+ case "--deepdoc":
+ serverMode = "deepdoc"
+ args.mode = &serverMode
case "-h", "--help":
args.helpFlag = true
case "-v", "--version":
@@ -427,21 +430,22 @@ func parsePort(value, name string) (int, error) {
func printHelp(args *serverArgs) {
switch {
case args.mode == nil:
- fmt.Fprintf(os.Stderr, "Usage: %s --api|--admin|--ingestor|--syncer [OPTIONS]\n", os.Args[0])
+ fmt.Fprintf(os.Stderr, "Usage: %s --api|--admin|--ingestor|--syncer|--deepdoc [OPTIONS]\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s --migrate [OPTIONS]\n\n", os.Args[0])
fmt.Fprintf(os.Stderr, "RAGFlow Server - Open-source RAG engine based on deep document understanding\n\n")
fmt.Fprintf(os.Stderr, "Mode selection (default: --api):\n")
fmt.Fprintf(os.Stderr, " --api \tRun as API server\n")
fmt.Fprintf(os.Stderr, " --admin \tRun as admin server\n")
fmt.Fprintf(os.Stderr, " --ingestor \tRun as ingestion worker\n")
- fmt.Fprintf(os.Stderr, " --syncer \tRun as file sync service\n\n")
+ fmt.Fprintf(os.Stderr, " --syncer \tRun as file sync service\n")
+ fmt.Fprintf(os.Stderr, " --deepdoc \tRun as DeepDoc server\n\n")
fmt.Fprintf(os.Stderr, "Standalone action (mutually exclusive with a mode):\n")
fmt.Fprintf(os.Stderr, " --migrate \tRun database migrations and exit\n\n")
fmt.Fprintf(os.Stderr, "Common options:\n")
fmt.Fprintf(os.Stderr, " -f, --config string\tPath to configuration file\n")
fmt.Fprintf(os.Stderr, " -p, --port int \tServer port (overrides config file)\n")
- fmt.Fprintf(os.Stderr, " --admin-host string\tAdmin server host:port (ingestor and syncer)\n")
- fmt.Fprintf(os.Stderr, " --name string \tServer name (ingestor and syncer)\n")
+ fmt.Fprintf(os.Stderr, " --admin-host string\tAdmin server host:port (ingestor, syncer, deepdoc)\n")
+ fmt.Fprintf(os.Stderr, " --name string \tServer name (ingestor, syncer, deepdoc)\n")
fmt.Fprintf(os.Stderr, " --init-superuser\tInitialize superuser account (admin)\n")
fmt.Fprintf(os.Stderr, " -v, --version \tPrint version information and exit\n")
fmt.Fprintf(os.Stderr, " --log-level string\tLog level: debug, info, warn, error (default: warn)\n")
@@ -460,6 +464,7 @@ func printHelp(args *serverArgs) {
fmt.Fprintf(os.Stderr, "Run '%s --admin --help' for admin server options.\n", os.Args[0])
fmt.Fprintf(os.Stderr, "Run '%s --ingestor --help' for ingester options.\n", os.Args[0])
fmt.Fprintf(os.Stderr, "Run '%s --syncer --help' for syncer options.\n", os.Args[0])
+ fmt.Fprintf(os.Stderr, "Run '%s --deepdoc --help' for DeepDoc server options.\n", os.Args[0])
case *args.mode == "api":
fmt.Fprintf(os.Stderr, "Usage: %s --api [OPTIONS]\n\n", os.Args[0])
fmt.Fprintf(os.Stderr, "RAGFlow API Server\n\n")
@@ -512,6 +517,17 @@ func printHelp(args *serverArgs) {
fmt.Fprintf(os.Stderr, " --log-level string\tLog level: debug, info, warn, error (default: warn)\n")
fmt.Fprintf(os.Stderr, " --profile \t\tEnable pprof server\n")
fmt.Fprintf(os.Stderr, " -h, --help \t\tShow this help message and exit\n")
+ case *args.mode == "deepdoc":
+ fmt.Fprintf(os.Stderr, "Usage: %s --deepdoc [OPTIONS]\n\n", os.Args[0])
+ fmt.Fprintf(os.Stderr, "RAGFlow DeepDoc Inference Service - DeepDoc model inference service\n\n")
+ fmt.Fprintf(os.Stderr, "Options:\n")
+ fmt.Fprintf(os.Stderr, " -f --config string\tPath to config file\n")
+ fmt.Fprintf(os.Stderr, " --name string\t\t\tSync service server name (default: \"default_syncer\")\n")
+ fmt.Fprintf(os.Stderr, " --admin-host string\tAdmin server host:port (overrides config file)\n")
+ fmt.Fprintf(os.Stderr, " -v, --version \t\tPrint version information and exit\n")
+ fmt.Fprintf(os.Stderr, " --debug \t\tEnable debug-level logging\n")
+ fmt.Fprintf(os.Stderr, " --profile \t\tEnable pprof server\n")
+ fmt.Fprintf(os.Stderr, " -h, --help \t\tShow this help message and exit\n")
}
}
@@ -619,6 +635,11 @@ func main() {
uuid := utility.GenerateUUID()
serverName = fmt.Sprintf("syncer_server_%s", uuid)
}
+ case "deepdoc":
+ if serverName == "" {
+ uuid := utility.GenerateUUID()
+ serverName = fmt.Sprintf("deepdoc_server_%s", uuid)
+ }
default:
err = errors.New(*arguments.mode)
common.Error("invalid server mode", err)
@@ -743,6 +764,11 @@ func main() {
fmt.Printf("Failed to start SYNCER: %v\n", err)
os.Exit(1)
}
+ case "deepdoc":
+ if err = runDeepDoc(ctx, arguments); err != nil {
+ fmt.Printf("Failed to start DEEPDOC: %v\n", err)
+ os.Exit(1)
+ }
default:
fmt.Printf("Invalid server mode: %s\n", *arguments.mode)
os.Exit(1)