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
Go: fix env variables (#18032)
Jin Haic0bc146fcb2f
diff --git a/internal/admin/service.go b/internal/admin/service.goindex e534566133..e385414ae4 100644--- a/internal/admin/service.go+++ b/internal/admin/service.go@@ -1395,38 +1395,40 @@ func (s *Service) ListAllConfigs() ([]map[string]interface{}, error) {func (s *Service) ListEnvironments() ([]map[string]interface{}, error) {result := make([]map[string]interface{}, 0)+ globalConfig := server.GetConfig()+// DOC_ENGINE- docEngine := common.GetEnv(common.EnvDocEngine)+ docEngine := globalConfig.GetEnvDocumentEngineType()if docEngine == "" {docEngine = "elasticsearch"}result = append(result, map[string]interface{}{- "env": "DOC_ENGINE",+ "env": "DOCUMENT_ENGINE","value": docEngine,})// DEFAULT_SUPERUSER_EMAIL- defaultSuperuserEmail := common.GetEnv(common.EnvDefaultSuperuserEmail)+ defaultSuperuserEmail := globalConfig.GetEnvDefaultSuperUserEmail()if defaultSuperuserEmail == "" {defaultSuperuserEmail = "[email protected]"}result = append(result, map[string]interface{}{- "env": common.EnvDefaultSuperuserEmail,+ "env": "DEFAULT_SUPERUSER_EMAIL","value": defaultSuperuserEmail,})// DB_TYPE- dbType := common.GetEnv(common.EnvDBType)+ dbType := globalConfig.GetEnvDatabaseType()if dbType == "" {dbType = "mysql"}result = append(result, map[string]interface{}{- "env": "DB_TYPE",+ "env": "DATABASE","value": dbType,})// DEVICE- device := common.GetEnv(common.EnvDevice)+ device := globalConfig.GetEnvDeviceType()if device == "" {device = "cpu"}@@ -1436,12 +1438,12 @@ func (s *Service) ListEnvironments() ([]map[string]interface{}, error) {})// STORAGE_IMPL- storageImpl := common.GetEnv(common.EnvStorageImpl)+ storageImpl := globalConfig.GetEnvStorageType()if storageImpl == "" {- storageImpl = "MINIO"+ storageImpl = "minio"}result = append(result, map[string]interface{}{- "env": common.EnvStorageImpl,+ "env": "STORAGE","value": storageImpl,})diff --git a/internal/agent/component/stagehand_runtime_integration_test.go b/internal/agent/component/stagehand_runtime_integration_test.goindex 50d8b72a3e..2062e560e5 100644--- a/internal/agent/component/stagehand_runtime_integration_test.go+++ b/internal/agent/component/stagehand_runtime_integration_test.go@@ -87,7 +87,7 @@ import (// against https://www.bbc.com/news/world — returns a non-empty// summary string in ~10s.func TestStagehandRuntime_Extract(t *testing.T) {- apiKey := common.GetEnv(common.EnvOpenAIApiKey)+ apiKey := common.GetEnv(common.EnvOpenAIAPIKey)baseURL := common.GetEnv(common.EnvOpenAIBaseURL)model := common.GetEnv(common.EnvOpenAIModel)if apiKey == "" || baseURL == "" || model == "" {@@ -190,7 +190,7 @@ func cacheDirGuess() string {//// Skipped unless OPENAI_* env vars are configured.func TestBrowser_E2E_Extract(t *testing.T) {- apiKey := common.GetEnv(common.EnvOpenAIApiKey)+ apiKey := common.GetEnv(common.EnvOpenAIAPIKey)baseURL := common.GetEnv(common.EnvOpenAIBaseURL)model := common.GetEnv(common.EnvOpenAIModel)if apiKey == "" || baseURL == "" || model == "" {diff --git a/internal/agent/harness/production.go b/internal/agent/harness/production.goindex 0b1f739585..de488746a0 100644--- a/internal/agent/harness/production.go+++ b/internal/agent/harness/production.go@@ -65,7 +65,7 @@ func NewProductionRunner(db *gorm.DB, tenantID string, datasetIDs []string) (*Prreturn nil, fmt.Errorf("hybrid_search is not invokable")}r := &ProductionRunner{db: db, tenantID: tenantID, datasetIDs: datasetIDs, searchTool: search}- if common.GetEnv(common.EnvTavilyApiKey) != "" {+ if common.GetEnv(common.EnvTavilyAPIKey) != "" {r.webTool = tool.NewTavilyTool()}return r, nildiff --git a/internal/agent/sandbox/e2b.go b/internal/agent/sandbox/e2b.goindex ce249f3f24..83beba681f 100644--- a/internal/agent/sandbox/e2b.go+++ b/internal/agent/sandbox/e2b.go@@ -125,7 +125,7 @@ func (p *E2BProvider) ProviderType() ProviderType { return ProviderE2B }// resolves from the same env vars. We return an error if neither// is set so the manager does not register a broken provider.func (p *E2BProvider) Initialize(ctx context.Context) error {- apiKey := common.GetEnv(common.EnvE2BApiKey)+ apiKey := common.GetEnv(common.EnvE2BAPIKey)accessToken := common.GetEnv(common.EnvE2BAccessToken)if apiKey == "" && accessToken == "" {return errors.New(diff --git a/internal/agent/sandbox/e2b_test.go b/internal/agent/sandbox/e2b_test.goindex 23cf355dd8..bd794928bf 100644--- a/internal/agent/sandbox/e2b_test.go+++ b/internal/agent/sandbox/e2b_test.go@@ -93,7 +93,7 @@ func TestE2BProvider_Initialize_MissingCreds(t *testing.T) {// key is set (CI without secrets). The skip is loud via a clear// log line so missing-secrets is visible in test output.func TestE2BProvider_Initialize_WithAPIKey(t *testing.T) {- apiKey := common.GetEnv(common.EnvE2BApiKey)+ apiKey := common.GetEnv(common.EnvE2BAPIKey)if apiKey == "" {t.Skip("E2B_API_KEY not set — skipping network-dependent init check")}@@ -265,7 +265,7 @@ func makeFakeCommandResult(stdout string) *e2bsdk.CommandResult {// the test always runs (so missing-secrets shows up in CI logs).// When enabled, it creates a real sandbox, runs Python, kills it.func TestE2BProvider_FullE2E_SkipWithoutKey(t *testing.T) {- apiKey := common.GetEnv(common.EnvE2BApiKey)+ apiKey := common.GetEnv(common.EnvE2BAPIKey)if apiKey == "" {t.Skip("E2B_API_KEY not set — skipping full E2E test (real network call)")}diff --git a/internal/agent/sandbox/tenki.go b/internal/agent/sandbox/tenki.goindex e1b20e0486..a64f30b711 100644--- a/internal/agent/sandbox/tenki.go+++ b/internal/agent/sandbox/tenki.go@@ -73,7 +73,7 @@ func newTenkiProviderFromEnv() *TenkiProvider {// mirroring the admin-panel settings JSON shape.func tenkiConfigFromEnv() map[string]any {return map[string]any{- "API_KEY": common.GetEnv(common.EnvTenkiApiKey),+ "API_KEY": common.GetEnv(common.EnvTenkiAPIKey),"API_URL": common.GetEnv(common.EnvTenkiAPIURL),"IMAGE": common.GetEnv(common.EnvTenkiImage),"TIMEOUT": common.GetEnv(common.EnvTenkiTimeout),@@ -112,7 +112,7 @@ func (p *TenkiProvider) ProviderType() ProviderType { return ProviderTenki }func (p *TenkiProvider) Initialize(ctx context.Context) error {apiKey := p.apiKeyif apiKey == "" {- apiKey = common.GetEnv(common.EnvTenkiApiKey)+ apiKey = common.GetEnv(common.EnvTenkiAPIKey)}if apiKey == "" {return errors.New("tenki: API key is required (set it in Admin > Sandbox Settings or TENKI_API_KEY)")diff --git a/internal/agent/sandbox/tenki_test.go b/internal/agent/sandbox/tenki_test.goindex 44e8dee839..575b0f8f08 100644--- a/internal/agent/sandbox/tenki_test.go+++ b/internal/agent/sandbox/tenki_test.go@@ -242,7 +242,7 @@ func TestTenkiProvider_BuildTenkiExecutionResult(t *testing.T) {// always runs (so missing-secrets shows up in CI logs). When enabled,// it creates a real sandbox, runs Python, and destroys it.func TestTenkiProvider_FullE2E_SkipWithoutKey(t *testing.T) {- apiKey := common.GetEnv(common.EnvTenkiApiKey)+ apiKey := common.GetEnv(common.EnvTenkiAPIKey)if apiKey == "" {t.Skip("TENKI_API_KEY not set — skipping full E2E test (real network call)")}diff --git a/internal/agent/tool/tavily.go b/internal/agent/tool/tavily.goindex 4eaed95443..3c11e758ff 100644--- a/internal/agent/tool/tavily.go+++ b/internal/agent/tool/tavily.go@@ -214,7 +214,7 @@ func newTavilyExtractTool(h *HTTPHelper, envKey func() string, defaults tavilyEx// defaultTavilyEnvKey is the production env-key resolver. Pulled out// as a named function (not a var) so tests cannot accidentally// mutate it via package-var assignment.-func defaultTavilyEnvKey() string { return common.GetEnv(common.EnvTavilyApiKey) }+func defaultTavilyEnvKey() string { return common.GetEnv(common.EnvTavilyAPIKey) }// Info returns the tool's metadata for the chat model.func (t *TavilyTool) Info(_ context.Context) (*schema.ToolInfo, error) {diff --git a/internal/cli/filesystem/skill_install.go b/internal/cli/filesystem/skill_install.goindex d42535c020..bb319c9af4 100644--- a/internal/cli/filesystem/skill_install.go+++ b/internal/cli/filesystem/skill_install.go@@ -80,10 +80,10 @@ func (a *sourceHTTPClientAdapter) Get(url string) (*http.Response, error) {// NewInstallSkillCommand creates a new install-skill command handlerfunc NewInstallSkillCommand(client HTTPClientInterface, fileProvider *FileProvider, skillProvider Provider) *SkillInstallCommand {// Log proxy settings- if httpProxy := common.GetEnv(common.EnvHttpHTTPProxy); httpProxy != "" {+ if httpProxy := common.GetEnv(common.EnvHTTPProxy); httpProxy != "" {fmt.Printf("Using HTTP proxy: %s\n", httpProxy)}- if httpsProxy := common.GetEnv(common.EnvHttpHTTPSProxy); httpsProxy != "" {+ if httpsProxy := common.GetEnv(common.EnvHTTPSProxy); httpsProxy != "" {fmt.Printf("Using HTTPS proxy: %s\n", httpsProxy)}diff --git a/internal/common/environments.go b/internal/common/environments.goindex 2699253f00..1b422abf53 100644--- a/internal/common/environments.go+++ b/internal/common/environments.go@@ -60,10 +60,10 @@ const (EnvE2BTemplateName = "E2B_TEMPLATE_NAME"EnvE2BTimeout = "E2B_TIMEOUT"EnvE2BAPIURL = "E2B_API_URL"- EnvE2BApiKey = "E2B_API_KEY"+ EnvE2BAPIKey = "E2B_API_KEY"EnvE2BAccessToken = "E2B_ACCESS_TOKEN"EnvE2BDomain = "E2B_DOMAIN"- EnvTenkiApiKey = "TENKI_API_KEY"+ EnvTenkiAPIKey = "TENKI_API_KEY"EnvTenkiAPIURL = "TENKI_API_URL"EnvTenkiImage = "TENKI_IMAGE"EnvTenkiTimeout = "TENKI_TIMEOUT"@@ -83,7 +83,7 @@ const (EnvVECLIBMaximumThreads = "VECLIB_MAXIMUM_THREADS"EnvNumEXPRNumThreads = "NUMEXPR_NUM_THREADS"EnvXDGCacheHome = "XDG_CACHE_HOME"- EnvOpenAIApiKey = "OPENAI_API_KEY"+ EnvOpenAIAPIKey = "OPENAI_API_KEY"EnvOpenAIBaseURL = "OPENAI_BASE_URL"EnvOpenAIModel = "OPENAI_MODEL"EnvStageHandExtractSchemaJSON = "STAGEHAND_EXTRACT_SCHEMA_JSON"@@ -113,12 +113,12 @@ const (EnvTrinoUseTls = "TRINO_USE_TLS"EnvSSHEnableAPIURL = "SSH_ENABLE_API_URL"EnvAllowAnyHost = "ALLOW_ANY_HOST"- EnvTavilyApiKey = "TAVILY_API_KEY"+ EnvTavilyAPIKey = "TAVILY_API_KEY"EnvQueritAPIKey = "QUERIT_API_KEY"EnvHome = "HOME"EnvUserProfile = "USERPROFILE"- EnvHttpHTTPProxy = "http_proxy"- EnvHttpHTTPSProxy = "https_proxy"+ EnvHTTPProxy = "http_proxy"+ EnvHTTPSProxy = "https_proxy"EnvBatchSingle = "BATCH_SINGLE"EnvBatchCount = "BATCH_COUNT"EnvBatchLogLevel = "BATCH_LOG_LEVEL"@@ -139,22 +139,22 @@ const (EnvESIndexPrefix = "ES_INDEX_PREFIX"EnvGiteeListModelsIntegration = "GITEE_LIST_MODELS_INTEGRATION"EnvGiteeBaseUrl = "GITEE_BASE_URL"- EnvGiteeApiKey = "GITEE_API_KEY"- EnvRAGFlowApiTiming = "RAGFLOW_API_TIMING"+ EnvGiteeAPIKey = "GITEE_API_KEY"+ EnvRAGFlowAPITiming = "RAGFLOW_API_TIMING"EnvInfinityURI = "INFINITY_URI"EnvDoclingServerURL = "DOCLING_SERVER_URL"- EnvDoclingApiKey = "DOCLING_API_KEY"- EnvMineruApiServer = "MINERU_APISERVER"- EnvMineruApiKey = "MINERU_API_KEY"+ EnvDoclingAPIKey = "DOCLING_API_KEY"+ EnvMineruAPIServer = "MINERU_APISERVER"+ EnvMineruAPIKey = "MINERU_API_KEY"EnvMineruBackend = "MINERU_BACKEND"- EnvOpenDataLoaderApiServer = "OPENDATALOADER_APISERVER"- EnvOpenDataLoaderApiKey = "OPENDATALOADER_API_KEY"+ EnvOpenDataLoaderAPIServer = "OPENDATALOADER_APISERVER"+ EnvOpenDataLoaderAPIKey = "OPENDATALOADER_API_KEY"EnvPaddleOCRBaseUrl = "PADDLEOCR_BASE_URL"- EnvPaddleOCRApiURL = "PADDLEOCR_API_URL"+ EnvPaddleOCRAPIURL = "PADDLEOCR_API_URL"EnvPaddleOCRAccessToken = "PADDLEOCR_ACCESS_TOKEN"EnvPaddleOCRAlgorithm = "PADDLEOCR_ALGORITHM"EnvSOMarkBaseUrl = "SOMARK_BASE_URL"- EnvSOMarkApiKey = "SOMARK_API_KEY"+ EnvSOMarkAPIKey = "SOMARK_API_KEY"EnvSOMarkImageFormat = "SOMARK_IMAGE_FORMAT"EnvSOMarkFormulaFormat = "SOMARK_FORMULA_FORMAT"EnvSOMarkTableFormat = "SOMARK_TABLE_FORMAT"@@ -166,8 +166,13 @@ const (EnvSOMarkEnableTableImage = "SOMARK_ENABLE_TABLE_IMAGE"EnvSOMarkEnableImageUnderstanding = "SOMARK_ENABLE_IMAGE_UNDERSTANDING"EnvSOMarkKeepHeaderFooter = "SOMARK_KEEP_HEADER_FOOTER"- EnvTCADPApiServerURL = "TCADP_APISERVER_URL"- EnvTCADPApiKey = "TCADP_API_KEY"+ EnvTCADPAPIServerURL = "TCADP_APISERVER_URL"+ EnvTCADPAPIKey = "TCADP_API_KEY"+ EnvFirecrawlAPIKey = "FIRECRAWL_API_KEY"+ EnvFirecrawlAPIURL = "FIRECRAWL_API_URL"+ EnvFirecrawlMaxRetries = "FIRECRAWL_MAX_RETRIES"+ EnvFirecrawlTimeout = "FIRECRAWL_TIMEOUT"+ EnvFirecrawlRelayTimeout = "FIRECRAWL_RELAY_TIMEOUT"EnvRAGFlowSecretKey = "RAGFLOW_SECRET_KEY"EnvEnableRegister = "ENABLE_REGISTER"EnvDisablePasswordLogin = "DISABLE_PASSWORD_LOGIN"@@ -181,8 +186,8 @@ const (EnvTEIModel = "TEI_MODEL"EnvTEIBaseURL = "TEI_BASE_URL"EnvRAGFlowConfDir = "RAGFLOW_CONF_DIR"- EnvRAGProjectBaseURL = "RAG_PROJECT_BASE"- EnvRAGDeployBaseURL = "RAG_DEPLOY_BASE"+ EnvRAGProjectBase = "RAG_PROJECT_BASE"+ EnvRAGDeployBase = "RAG_DEPLOY_BASE"EnvRAGFlowTestEnvIntOrUnset = "RAGFLOW_TEST_ENVINTOR_UNSET"EnvRAGFlowTestEnvIntOr = "RAGFLOW_TEST_ENVINTOR"EnvRAGFlowTestEnvOr = "RAGFLOW_TEST_ENVOR"diff --git a/internal/entity/models/gitee_test.go b/internal/entity/models/gitee_test.goindex ea1e657f0f..0c19d93f33 100644--- a/internal/entity/models/gitee_test.go+++ b/internal/entity/models/gitee_test.go@@ -235,7 +235,7 @@ func TestGiteeListModelsIntegration(t *testing.T) {baseURL = "https://api.moark.ai/v1"}apiConfig := &APIConfig{}- if apiKey := common.GetEnv(common.EnvGiteeApiKey); apiKey != "" {+ if apiKey := common.GetEnv(common.EnvGiteeAPIKey); apiKey != "" {apiConfig.ApiKey = &apiKey}diff --git a/internal/handler/memory.go b/internal/handler/memory.goindex c890e93ccc..f541965dce 100644--- a/internal/handler/memory.go+++ b/internal/handler/memory.go@@ -82,7 +82,7 @@ func NewMemoryHandler(memoryService *service.MemoryService) *MemoryHandler {func (h *MemoryHandler) CreateMemory(c *gin.Context) {// Check if API timing is enabled// If RAGFLOW_API_TIMING environment variable is set, request processing time will be logged- timingEnabled := common.GetEnv(common.EnvRAGFlowApiTiming)+ timingEnabled := common.GetEnv(common.EnvRAGFlowAPITiming)var tStart time.Timeif timingEnabled != "" {tStart = time.Now()diff --git a/internal/ingestion/component/media_dispatch.go b/internal/ingestion/component/media_dispatch.goindex 4c032c2d3e..7b629b7607 100644--- a/internal/ingestion/component/media_dispatch.go+++ b/internal/ingestion/component/media_dispatch.go@@ -31,6 +31,8 @@ import ("encoding/base64""fmt""image"+ "ragflow/internal/common"+// Import image decoders for common formats._ "image/gif"_ "image/jpeg"@@ -40,8 +42,7 @@ import ("sort""strings"- "ragflow/internal/common"- inference "ragflow/internal/deepdoc/parser/pdf/inference"+ "ragflow/internal/deepdoc/parser/pdf/inference""ragflow/internal/entity"modelModule "ragflow/internal/entity/models""ragflow/internal/ingestion/component/schema"diff --git a/internal/ingestion/pipeline/template_integration_test.go b/internal/ingestion/pipeline/template_integration_test.goindex a563cfef02..7fbdb540a3 100644--- a/internal/ingestion/pipeline/template_integration_test.go+++ b/internal/ingestion/pipeline/template_integration_test.go@@ -692,7 +692,7 @@ func TestPipelineRun_TemplateBook_RealComponents(t *testing.T) {func TestPipelineRun_TemplateResume_RealComponents(t *testing.T) {RequireTokenizerPool(t)- apiKey := common.GetEnv(common.EnvOpenAIApiKey)+ apiKey := common.GetEnv(common.EnvOpenAIAPIKey)baseURL := common.GetEnv(common.EnvOpenAIBaseURL)model := common.GetEnv(common.EnvOpenAIModel)if apiKey == "" || baseURL == "" || model == "" {diff --git a/internal/parser/parser/pdf_parser_docling.go b/internal/parser/parser/pdf_parser_docling.goindex 48a2792229..0dd5f75148 100644--- a/internal/parser/parser/pdf_parser_docling.go+++ b/internal/parser/parser/pdf_parser_docling.go@@ -49,7 +49,7 @@ func parsePDFWithDocling(ctx context.Context, filename string, data []byte, pars}apiKey := strings.TrimSpace(parser.DoclingAPIKey)if apiKey == "" {- apiKey = strings.TrimSpace(common.GetEnv(common.EnvDoclingApiKey))+ apiKey = strings.TrimSpace(common.GetEnv(common.EnvDoclingAPIKey))}baseURL := strings.TrimRight(serverURL, "/")diff --git a/internal/parser/parser/pdf_parser_mineru.go b/internal/parser/parser/pdf_parser_mineru.goindex 697946a72a..fa9819f2b0 100644--- a/internal/parser/parser/pdf_parser_mineru.go+++ b/internal/parser/parser/pdf_parser_mineru.go@@ -19,14 +19,14 @@ func parsePDFWithMinerU(ctx context.Context, filename string, data []byte, parse}apiServer := strings.TrimSpace(parser.MinerUAPIServer)if apiServer == "" {- apiServer = strings.TrimSpace(common.GetEnv(common.EnvMineruApiServer))+ apiServer = strings.TrimSpace(common.GetEnv(common.EnvMineruAPIServer))}if apiServer == "" {return ParseResult{Err: fmt.Errorf("parser: MinerU requires mineru_apiserver or MINERU_APISERVER")}}apiKey := parser.MinerUAPIKeyif strings.TrimSpace(apiKey) == "" {- apiKey = strings.TrimSpace(common.GetEnv(common.EnvMineruApiKey))+ apiKey = strings.TrimSpace(common.GetEnv(common.EnvMineruAPIKey))}backend := strings.TrimSpace(parser.MinerUBackend)if backend == "" {diff --git a/internal/parser/parser/pdf_parser_opendataloader.go b/internal/parser/parser/pdf_parser_opendataloader.goindex 5b08566a6c..8920efec07 100644--- a/internal/parser/parser/pdf_parser_opendataloader.go+++ b/internal/parser/parser/pdf_parser_opendataloader.go@@ -19,14 +19,14 @@ func parsePDFWithOpenDataLoader(ctx context.Context, filename string, data []byt}baseURL := strings.TrimSpace(parser.OpenDataLoaderAPIServer)if baseURL == "" {- baseURL = strings.TrimSpace(common.GetEnv(common.EnvOpenDataLoaderApiServer))+ baseURL = strings.TrimSpace(common.GetEnv(common.EnvOpenDataLoaderAPIServer))}if baseURL == "" {return ParseResult{Err: fmt.Errorf("parser: OpenDataLoader requires opendataloader_apiserver or OPENDATALOADER_APISERVER")}}apiKey := strings.TrimSpace(parser.OpenDataLoaderAPIKey)if apiKey == "" {- apiKey = strings.TrimSpace(common.GetEnv(common.EnvOpenDataLoaderApiKey))+ apiKey = strings.TrimSpace(common.GetEnv(common.EnvOpenDataLoaderAPIKey))}bodyReader, contentType, err := openDataLoaderMultipart(filename, data, parser)diff --git a/internal/parser/parser/pdf_parser_paddleocr.go b/internal/parser/parser/pdf_parser_paddleocr.goindex e537933b0f..9bff90d468 100644--- a/internal/parser/parser/pdf_parser_paddleocr.go+++ b/internal/parser/parser/pdf_parser_paddleocr.go@@ -18,7 +18,7 @@ func parsePDFWithPaddleOCR(ctx context.Context, filename string, data []byte, pabaseURL = strings.TrimSpace(common.GetEnv(common.EnvPaddleOCRBaseUrl))}if baseURL == "" {- baseURL = strings.TrimSpace(common.GetEnv(common.EnvPaddleOCRApiURL))+ baseURL = strings.TrimSpace(common.GetEnv(common.EnvPaddleOCRAPIURL))}if baseURL == "" {return ParseResult{Err: fmt.Errorf("parser: PaddleOCR requires paddleocr_base_url or PADDLEOCR_BASE_URL")}diff --git a/internal/parser/parser/pdf_parser_somark.go b/internal/parser/parser/pdf_parser_somark.goindex b58395f548..b2639cfa4c 100644--- a/internal/parser/parser/pdf_parser_somark.go+++ b/internal/parser/parser/pdf_parser_somark.go@@ -28,7 +28,7 @@ func parsePDFWithSoMark(filename string, data []byte, parser *PDFParser) ParseRe}apiKey := parser.SoMarkAPIKeyif strings.TrimSpace(apiKey) == "" {- apiKey = strings.TrimSpace(common.GetEnv(common.EnvSOMarkApiKey))+ apiKey = strings.TrimSpace(common.GetEnv(common.EnvSOMarkAPIKey))}taskID, err := soMarkSubmit(strings.TrimRight(baseURL, "/"), filename, data, parser, apiKey)if err != nil {diff --git a/internal/parser/parser/pdf_parser_tcadp.go b/internal/parser/parser/pdf_parser_tcadp.goindex 1284e2699a..a9050b1ffe 100644--- a/internal/parser/parser/pdf_parser_tcadp.go+++ b/internal/parser/parser/pdf_parser_tcadp.go@@ -21,14 +21,14 @@ func parsePDFWithTCADP(filename string, data []byte, parser *PDFParser) ParseRes}baseURL := strings.TrimSpace(parser.TCADPAPIServer)if baseURL == "" {- baseURL = strings.TrimSpace(common.GetEnv(common.EnvTCADPApiServerURL))+ baseURL = strings.TrimSpace(common.GetEnv(common.EnvTCADPAPIServerURL))}if baseURL == "" {return ParseResult{Err: fmt.Errorf("parser: TCADP requires tcadp_apiserver or TCADP_APISERVER")}}apiKey := strings.TrimSpace(parser.TCADPAPIKey)if apiKey == "" {- apiKey = strings.TrimSpace(common.GetEnv(common.EnvTCADPApiKey))+ apiKey = strings.TrimSpace(common.GetEnv(common.EnvTCADPAPIKey))}requestBody := map[string]any{"file_type": "PDF",diff --git a/internal/server/config/environments.go b/internal/server/config/environments.goindex ae0f25e8c1..d05e2295cb 100644--- a/internal/server/config/environments.go+++ b/internal/server/config/environments.go@@ -20,7 +20,9 @@ import ("fmt""net/mail""ragflow/internal/common"+ "strconv""strings"+ "time")type Environments struct {@@ -38,8 +40,75 @@ type Environments struct {MinioHost string `mapstructure:"minio_host"`MinioRegion string `mapstructure:"minio_region"`- CreateDefaultSuperUser bool `mapstructure:"create_default_super_user"`- DefaultSuperUser DefaultSuperUser `mapstructure:"default_super_user"`+ DefaultSuperUser DefaultSuperUser `mapstructure:"default_super_user"`++ DeviceType string `mapstructure:"device_type"`++ InfinityURL string `mapstructure:"infinity_url"` // INFINITY_URI+ RAGFLowConfPath string `mapstructure:"ragflow_conf_path"` // RAGFLOW_CONF_DIR+ RAGFlowProjectBase string `mapstructure:"ragflow_project_base"` // RAG_PROJECT_BASE+ RAGFlowDeployBase string `mapstructure:"ragflow_deploy_base"` // RAG_DEPLOY_BASE+ SPACYModelPath string `mapstructure:"spacy_model_path"` // SPACY_MODEL_DIR++ DictionaryPath string `mapstructure:"ragflow_dict_path"`+ TTSCacheTTLSeconds time.Duration `mapstructure:"ttscache_ttl_seconds"`+ MAXFileNumberPerUser int `mapstructure:"max_file_number_per_user"`+ MAXContentLength int `mapstructure:"max_content_length"`+ HomePath string `mapstructure:"home_path"`+ UserProfile string `mapstructure:"user_profile"`+ HTTPProxy string `mapstructure:"http_proxy"`+ HTTPSProxy string `mapstructure:"https_proxy"`+ LOGAPITiming bool `mapstructure:"log_api_timing"` // RAGFLOW_API_TIMING+ ChunkFeedbackEnabled bool `mapstructure:"chunk_feedback_enabled"` // CHUNK_FEEDBACK_ENABLED+ ChunkFeedbackWeighting string `mapstructure:"chunk_feedback_weighting"` // CHUNK_FEEDBACK_WEIGHTING++ BoxWebOauthRedirectURL string `mapstructure:"box_web_oauth_redirect_url"` // BOX_WEB_OAUTH_REDIRECT_URI+ GmailWebOAuthRedirectURL string `mapstructure:"gmail_web_oauth_redirect_url"` // GMAIL_WEB_OAUTH_REDIRECT_URI+ GoogleDriveWebOAuthRedirectURL string `mapstructure:"google_drive_web_oauth_redirect_url"` // GOOGLE_DRIVE_WEB_OAUTH_REDIRECT_URI++ DeepDocURL string `mapstructure:"deep_doc_url"`+ TensorRTDLAServer string `mapstructure:"tensorrt_dla_server"`+ OSSDeepDocURL string `mapstructure:"oss_deep_doc_url"` // open source deepdoc URL+ DeepDocBatchSingle string `mapstructure:"deep_doc_batch_single"`+ DeepDocBatchCount int `mapstructure:"deep_doc_batch_count"`+ DeepDocBatchLogLevel string `mapstructure:"deep_doc_batch_log_level"`+ DeepDocSkipOCR bool `mapstructure:"deep_doc_skip_ocr"`+ DeepDocCompareOnly bool `mapstructure:"deep_doc_compare_only"`+ DeepDocCompareFilter string `mapstructure:"deep_doc_compare_filter"`+ DeepDocCompareCSV string `mapstructure:"deep_doc_compare_csv"`+ DeepDocBatchCSV string `mapstructure:"deep_doc_batch_csv"`+ OpenDataLoaderAPIServer string `mapstructure:"open_dataloader_api_server"` // OPENDATALOADER_APISERVER+ OpenDataLoaderAPIKey string `mapstructure:"open_dataloader_api_key"` // OPENDATALOADER_API_KEY+ PaddleOCRBaseURL string `mapstructure:"paddle_ocr_base_url"` // PADDLEOCR_BASE_URL+ PaddleOCRAPIURL string `mapstructure:"paddle_ocr_api_url"` // PADDLEOCR_API_URL+ PaddleOCRAccessToken string `mapstructure:"paddle_ocr_access_token"` // PADDLEOCR_ACCESS_TOKEN+ PaddleOCRAlgorithm string `mapstructure:"paddle_ocr_algorithm"` // PADDLEOCR_ALGORITHM+ SOMarkBaseURL string `mapstructure:"somark_base_url"` // SOMARK_BASE_URL+ SOMarkAPIKey string `mapstructure:"somark_api_key"` // SOMARK_API_KEY+ SOMarkImageFormat string `mapstructure:"somark_image_format"` // SOMARK_IMAGE_FORMAT+ SOMarkFormulaFormat string `mapstructure:"somark_formula_format"` // SOMARK_FORMULA_FORMAT+ SOMarkTableFormat string `mapstructure:"somark_table_format"` // SOMARK_TABLE_FORMAT+ SOMarkCSFormat string `mapstructure:"somark_cs_format"` // SOMARK_CS_FORMAT+ SOMarkEnableTextCrossPage bool `mapstructure:"somark_enable_text_cross_page"` // SOMARK_ENABLE_TEXT_CROSS_PAGE+ SOMarkEnableTableCrossPage bool `mapstructure:"somark_enable_table_cross_page"` // SOMARK_ENABLE_TABLE_CROSS_PAGE+ SOMarkEnableTitleLevelRecognition bool `mapstructure:"somark_title_level_recognition"` // SOMARK_TITLE_LEVEL_RECOGNITION+ SOMarkEnableInlineImage bool `mapstructure:"somark_enable_inline_image"` // SOMARK_ENABLE_INLINE_IMAGE+ SOMarkEnableTableImage bool `mapstructure:"somark_enable_table_image"` // SOMARK_ENABLE_TABLE_IMAGE+ SOMarkEnableImageUnderstanding bool `mapstructure:"somark_enable_image_understanding"` // SOMARK_ENABLE_IMAGE_UNDERSTANDING+ SOMarkKeepHeaderFooter bool `mapstructure:"somark_keep_header_footer"` // SOMARK_KEEP_HEADER_FOOTER+ TCADPAPIServerURL string `mapstructure:"tcad_api_server"` // TCAD_API_SERVER+ TCADPAPIKey string `mapstructure:"tcad_api_key"` // TCAD_API_KEY+ TEIModel string `mapstructure:"tei_model"` // TEI_MODEL+ TEIComposeProfiles string `mapstructure:"tei_compose_profiles"` // EnvComposeProfiles+ TEIBaseURL string `mapstructure:"tei_base_url"` // TEI_BASE_URL+ DoclingServerURL string `mapstructure:"docling_server_url"` // DOCLING_SERVER_URI+ DoclingAPIKey string `mapstructure:"docling_api_key"` // DOCLING_API_KEY+ MinerUAPIServer string `mapstructure:"miner_userver"` // MINERU_APISERVER+ MinerUAPIKey string `mapstructure:"mineru_api_key"` // MINERU_API_KEY+ MinerUBackend string `mapstructure:"mineru_backend"` // MINERU_BACKEND+ TavilyAPIKey string `mapstructure:"tavily_api_key"`+ QueritAPIKey string `mapstructure:"querit_api_key"`+ KeenableAPIURL string `mapstructure:"keenable_api_url"` // KEENABLE_API_URL}type DefaultSuperUser struct {@@ -49,6 +118,10 @@ type DefaultSuperUser struct {}func (c *Config) GetEnvironments() error {++ // Language+ c.environments.Language = GetLanguage()+// Secret keyif envVal := common.GetEnv(common.EnvRAGFlowSecretKey); envVal != "" {c.environments.SecretKey = envVal@@ -58,7 +131,7 @@ func (c *Config) GetEnvironments() error {if c.environments.EnableRegister == nil {c.environments.EnableRegister = new(bool)}- str := strings.ToLower(envVal)+ str := envValif str == "true" || str == "1" || str == "yes" {*c.environments.EnableRegister = true} else {@@ -70,7 +143,7 @@ func (c *Config) GetEnvironments() error {if c.environments.DisablePasswordLogin == nil {c.environments.DisablePasswordLogin = new(bool)}- str := strings.ToLower(envVal)+ str := envValif str == "true" || str == "1" || str == "yes" {*c.environments.DisablePasswordLogin = true} else {@@ -91,26 +164,6 @@ func (c *Config) GetEnvironments() error {}}- // Default super user email- superUserEmail := common.GetEnv(common.EnvDefaultSuperuserEmail)- if superUserEmail != "" {- _, err := mail.ParseAddress(superUserEmail)- if err != nil {- return fmt.Errorf("invalid super user email: %s", superUserEmail)- }- c.environments.DefaultSuperUser.Email = superUserEmail- }-- superUserPassword := common.GetEnv(common.EnvDefaultSuperuserPassword)- if superUserPassword != "" {- c.environments.DefaultSuperUser.Password = superUserPassword- }-- superUserNickname := common.GetEnv(common.EnvDefaultSuperuserNickname)- if superUserNickname != "" {- c.environments.DefaultSuperUser.Nickname = superUserNickname- }-// Meta databasedatabaseType := common.GetEnvSmall(common.EnvDBType)if databaseType != "" {@@ -134,17 +187,373 @@ func (c *Config) GetEnvironments() error {}// Minio- minioHost := strings.ToLower(common.GetEnv(common.EnvMinioHost))+ minioHost := common.GetEnv(common.EnvMinioHost)if minioHost != "" {c.environments.MinioHost = minioHost}- minioRegion := strings.ToLower(common.GetEnv(common.EnvMinioRegion))+ minioRegion := common.GetEnv(common.EnvMinioRegion)if minioRegion != "" {c.environments.MinioRegion = minioRegion}- c.environments.Language = GetLanguage()+ // Default super user email+ superUserEmail := common.GetEnv(common.EnvDefaultSuperuserEmail)+ if superUserEmail != "" {+ _, err := mail.ParseAddress(superUserEmail)+ if err != nil {+ return fmt.Errorf("invalid super user email: %s", superUserEmail)+ }+ c.environments.DefaultSuperUser.Email = superUserEmail+ }++ superUserPassword := common.GetEnv(common.EnvDefaultSuperuserPassword)+ if superUserPassword != "" {+ c.environments.DefaultSuperUser.Password = superUserPassword+ }++ superUserNickname := common.GetEnv(common.EnvDefaultSuperuserNickname)+ if superUserNickname != "" {+ c.environments.DefaultSuperUser.Nickname = superUserNickname+ }++ deviceType := common.GetEnv(common.EnvDevice)+ if deviceType != "" {+ c.environments.DeviceType = deviceType+ }++ infinityURL := common.GetEnv(common.EnvInfinityURI)+ if infinityURL != "" {+ c.environments.InfinityURL = infinityURL+ }++ ragflowConfPath := common.GetEnv(common.EnvRAGFlowConfDir)+ if ragflowConfPath != "" {+ c.environments.RAGFLowConfPath = ragflowConfPath+ }++ ragflowProjectBase := common.GetEnv(common.EnvRAGProjectBase)+ if ragflowProjectBase != "" {+ c.environments.RAGFlowProjectBase = ragflowProjectBase+ }++ ragflowDeployBase := common.GetEnv(common.EnvRAGDeployBase)+ if ragflowDeployBase != "" {+ c.environments.RAGFlowDeployBase = ragflowDeployBase+ }++ spacyModelPATH := common.GetEnv(common.EnvSpacyModelDir)+ if spacyModelPATH != "" {+ c.environments.SPACYModelPath = spacyModelPATH+ }++ dictPath := common.GetEnv(common.EnvRAGFlowDictPath)+ if dictPath != "" {+ c.environments.DictionaryPath = dictPath+ }++ ttsCacheTTLSecondsStr := common.GetEnv(common.EnvRAGFlowTTSCacheTTLSeconds)+ if ttsCacheTTLSecondsStr == "" {+ c.environments.TTSCacheTTLSeconds = 7 * 24 * time.Hour+ } else {+ n, err := strconv.Atoi(ttsCacheTTLSecondsStr)+ if err != nil || n <= 0 {+ c.environments.TTSCacheTTLSeconds = 7 * 24 * time.Hour+ } else {+ c.environments.TTSCacheTTLSeconds = time.Duration(n) * time.Second+ }+ }++ maxFileNumberPerUserStr := common.GetEnv(common.EnvMaxFileNumPerUser)+ if maxFileNumberPerUserStr != "" {+ maxFileNumberPerUser, err := strconv.Atoi(maxFileNumberPerUserStr)+ if err != nil {+ return err+ }+ c.environments.MAXFileNumberPerUser = maxFileNumberPerUser+ }++ maxContentLengthStr := common.GetEnv(common.EnvMaxContentLength)+ if maxContentLengthStr != "" {+ maxContentLength, err := strconv.Atoi(maxContentLengthStr)+ if err != nil {+ return err+ }+ c.environments.MAXContentLength = maxContentLength+ }++ homePath := common.GetEnv(common.EnvHome)+ if homePath != "" {+ c.environments.HomePath = homePath+ }++ userProfile := common.GetEnv(common.EnvUserProfile)+ if userProfile != "" {+ c.environments.UserProfile = userProfile+ }++ httpProxy := common.GetEnv(common.EnvHTTPProxy)+ if httpProxy != "" {+ c.environments.HTTPProxy = httpProxy+ }++ httpsProxy := common.GetEnv(common.EnvHTTPSProxy)+ if httpsProxy != "" {+ c.environments.HTTPSProxy = httpsProxy+ }++ logAPITimingStr := common.GetEnv(common.EnvRAGFlowAPITiming)+ if logAPITimingStr != "" {+ logAPITiming := strings.ToLower(logAPITimingStr) == "true"+ c.environments.LOGAPITiming = logAPITiming+ }++ chunkFeedbackEnabledStr := common.GetEnv(common.EnvChunkFeedbackEnabled)+ if chunkFeedbackEnabledStr != "" {+ chunkFeedbackEnabled := strings.ToLower(chunkFeedbackEnabledStr) == "true"+ c.environments.ChunkFeedbackEnabled = chunkFeedbackEnabled+ }++ chunkFeedbackWeightingStr := common.GetEnv(common.EnvChunkFeedbackWeighting)+ if chunkFeedbackWeightingStr != "" {+ c.environments.ChunkFeedbackWeighting = chunkFeedbackWeightingStr+ }++ boxWebOauthRedirectURLStr := common.GetEnv(common.EnvBoxWebOAuthRedirectURI)+ if boxWebOauthRedirectURLStr != "" {+ c.environments.BoxWebOauthRedirectURL = boxWebOauthRedirectURLStr+ }++ gmailWebOAuthRedirectURLStr := common.GetEnv(common.EnvGmailWebOAuthRedirectURI)+ if gmailWebOAuthRedirectURLStr != "" {+ c.environments.GmailWebOAuthRedirectURL = gmailWebOAuthRedirectURLStr+ }++ GoogleDriveWebOAuthRedirectURLStr := common.GetEnv(common.EnvGoogleDriveWebOAuthRedirectURI)+ if GoogleDriveWebOAuthRedirectURLStr != "" {+ c.environments.GoogleDriveWebOAuthRedirectURL = GoogleDriveWebOAuthRedirectURLStr+ }++ deepDocURLStr := common.GetEnv(common.EnvDeepDocURL)+ if deepDocURLStr != "" {+ c.environments.DeepDocURL = deepDocURLStr+ }++ tensorRTDLAServerStr := common.GetEnv(common.EnvTensorrtDLAServer)+ if tensorRTDLAServerStr != "" {+ c.environments.TensorRTDLAServer = tensorRTDLAServerStr+ }++ OSSDeepDocURLStr := common.GetEnv(common.EnvOSSDeepDocURL)+ if OSSDeepDocURLStr != "" {+ c.environments.OSSDeepDocURL = OSSDeepDocURLStr+ }++ DeepDocBatchSingleStr := common.GetEnv(common.EnvBatchSingle)+ if DeepDocBatchSingleStr != "" {+ c.environments.DeepDocBatchSingle = DeepDocBatchSingleStr+ }++ DeepDocBatchCountStr := common.GetEnv(common.EnvBatchCount)+ if DeepDocBatchCountStr != "" {+ DeepDocBatchCount, err := strconv.Atoi(DeepDocBatchCountStr)+ if err != nil {+ return err+ }+ c.environments.DeepDocBatchCount = DeepDocBatchCount+ }++ DeepDocBatchLogLevelStr := common.GetEnv(common.EnvBatchLogLevel)+ if DeepDocBatchLogLevelStr != "" {+ c.environments.DeepDocBatchLogLevel = DeepDocBatchLogLevelStr+ }++ DeepDocBatchSkipOCRStr := common.GetEnv(common.EnvBatchSkipOCR)+ if DeepDocBatchSkipOCRStr != "" {+ DeepDocBatchSkipOCR := strings.ToLower(DeepDocBatchSkipOCRStr) == "true"+ c.environments.DeepDocSkipOCR = DeepDocBatchSkipOCR+ }++ DeepDocBatchCompareOnlyStr := common.GetEnv(common.EnvBatchCompareOnly)+ if DeepDocBatchCompareOnlyStr != "" {+ DeepDocBatchCompareOnly := strings.ToLower(DeepDocBatchCompareOnlyStr) == "true"+ c.environments.DeepDocCompareOnly = DeepDocBatchCompareOnly+ }++ DeepDocBatchCompareFilterStr := common.GetEnv(common.EnvBatchCompareFilter)+ if DeepDocBatchCompareFilterStr != "" {+ c.environments.DeepDocCompareFilter = DeepDocBatchCompareFilterStr+ }++ DeepDocBatchCompareCSVStr := common.GetEnv(common.EnvBatchCompareCSV)+ if DeepDocBatchCompareCSVStr != "" {+ c.environments.DeepDocCompareCSV = DeepDocBatchCompareCSVStr+ }++ DeepDocBatchCSVStr := common.GetEnv(common.EnvBatchCSV)+ if DeepDocBatchCSVStr != "" {+ c.environments.DeepDocBatchCSV = DeepDocBatchCSVStr+ }++ OpenDataLoaderAPIServerStr := common.GetEnv(common.EnvOpenDataLoaderAPIServer)+ if OpenDataLoaderAPIServerStr != "" {+ c.environments.OpenDataLoaderAPIServer = OpenDataLoaderAPIServerStr+ }++ OpenDataLoaderAPIKeyStr := common.GetEnv(common.EnvOpenDataLoaderAPIKey)+ if OpenDataLoaderAPIKeyStr != "" {+ c.environments.OpenDataLoaderAPIKey = OpenDataLoaderAPIKeyStr+ }++ PaddleOCRBaseURLStr := common.GetEnv(common.EnvPaddleOCRBaseUrl)+ if PaddleOCRBaseURLStr != "" {+ c.environments.PaddleOCRBaseURL = PaddleOCRBaseURLStr+ }++ PaddleOCRAPIURLStr := common.GetEnv(common.EnvPaddleOCRAPIURL)+ if PaddleOCRAPIURLStr != "" {+ c.environments.PaddleOCRAPIURL = PaddleOCRAPIURLStr+ }++ PaddleOCRAccessTokenStr := common.GetEnv(common.EnvPaddleOCRAccessToken)+ if PaddleOCRAccessTokenStr != "" {+ c.environments.PaddleOCRAccessToken = PaddleOCRAccessTokenStr+ }++ PaddleOCRAlgorithmStr := common.GetEnv(common.EnvPaddleOCRAlgorithm)+ if PaddleOCRAlgorithmStr != "" {+ c.environments.PaddleOCRAlgorithm = PaddleOCRAlgorithmStr+ }++ SOMarkBaseURLStr := common.GetEnv(common.EnvSOMarkBaseUrl)+ if SOMarkBaseURLStr != "" {+ c.environments.SOMarkBaseURL = SOMarkBaseURLStr+ }++ SOMarkAPIKeyStr := common.GetEnv(common.EnvSOMarkAPIKey)+ if SOMarkAPIKeyStr != "" {+ c.environments.SOMarkAPIKey = SOMarkAPIKeyStr+ }++ SOMarkImageFormatStr := common.GetEnv(common.EnvSOMarkImageFormat)+ if SOMarkImageFormatStr != "" {+ c.environments.SOMarkImageFormat = SOMarkImageFormatStr+ }++ SOMarkFormulaFormatStr := common.GetEnv(common.EnvSOMarkFormulaFormat)+ if SOMarkFormulaFormatStr != "" {+ c.environments.SOMarkFormulaFormat = SOMarkFormulaFormatStr+ }++ SOMarkTableFormatStr := common.GetEnv(common.EnvSOMarkTableFormat)+ if SOMarkTableFormatStr != "" {+ c.environments.SOMarkTableFormat = SOMarkTableFormatStr+ }++ SOMarkCSFormatStr := common.GetEnv(common.EnvSOMarkCSFormat)+ if SOMarkCSFormatStr != "" {+ c.environments.SOMarkCSFormat = SOMarkCSFormatStr+ }++ SOMarkEnableTextCrossPageStr := common.GetEnv(common.EnvSOMarkEnableTextCrossPage)+ if SOMarkEnableTextCrossPageStr != "" {+ c.environments.SOMarkEnableTextCrossPage = strings.ToLower(SOMarkEnableTextCrossPageStr) == "true"+ }++ SOMarkEnableTableCrossPageStr := common.GetEnv(common.EnvSOMarkEnableTableCrossPage)+ if SOMarkEnableTableCrossPageStr != "" {+ c.environments.SOMarkEnableTableCrossPage = strings.ToLower(SOMarkEnableTableCrossPageStr) == "true"+ }++ SOMarkTitleLevelRecognitionStr := common.GetEnv(common.EnvSOMarkEnableTitleLevelRecognition)+ if SOMarkTitleLevelRecognitionStr != "" {+ c.environments.SOMarkEnableTitleLevelRecognition = strings.ToLower(SOMarkTitleLevelRecognitionStr) == "true"+ }++ SOMarkEnableInlineImageStr := common.GetEnv(common.EnvSOMarkEnableInlineImage)+ if SOMarkEnableInlineImageStr != "" {+ c.environments.SOMarkEnableInlineImage = strings.ToLower(SOMarkEnableInlineImageStr) == "true"+ }++ SOMarkEnableTableImageStr := common.GetEnv(common.EnvSOMarkEnableTableImage)+ if SOMarkEnableTableImageStr != "" {+ c.environments.SOMarkEnableTableImage = strings.ToLower(SOMarkEnableTableImageStr) == "true"+ }++ SOMarkEnableImageUnderstandingStr := common.GetEnv(common.EnvSOMarkEnableImageUnderstanding)+ if SOMarkEnableImageUnderstandingStr != "" {+ c.environments.SOMarkEnableImageUnderstanding = strings.ToLower(SOMarkEnableImageUnderstandingStr) == "true"+ }++ SOMarkKeepHeaderFooterStr := common.GetEnv(common.EnvSOMarkKeepHeaderFooter)+ if SOMarkKeepHeaderFooterStr != "" {+ c.environments.SOMarkKeepHeaderFooter = strings.ToLower(SOMarkKeepHeaderFooterStr) == "true"+ }++ TCADPAPIServerURLStr := common.GetEnv(common.EnvTCADPAPIServerURL)+ if TCADPAPIServerURLStr != "" {+ c.environments.TCADPAPIServerURL = TCADPAPIServerURLStr+ }++ TCADPAPIKeyStr := common.GetEnv(common.EnvTCADPAPIKey)+ if TCADPAPIKeyStr != "" {+ c.environments.TCADPAPIKey = TCADPAPIKeyStr+ }++ TEIModelStr := common.GetEnv(common.EnvTEIModel)+ if TEIModelStr != "" {+ c.environments.TEIModel = TEIModelStr+ }++ TEIComposeProfilesStr := common.GetEnv(common.EnvComposeProfiles)+ if TEIComposeProfilesStr != "" {+ c.environments.TEIComposeProfiles = TEIComposeProfilesStr+ }++ TEIBaseURLStr := common.GetEnv(common.EnvTEIBaseURL)+ if TEIBaseURLStr != "" {+ c.environments.TEIBaseURL = TEIBaseURLStr+ }++ DoclingServerURLStr := common.GetEnv(common.EnvDoclingServerURL)+ if DoclingServerURLStr != "" {+ c.environments.DoclingServerURL = DoclingServerURLStr+ }++ DoclingAPIKeyStr := common.GetEnv(common.EnvDoclingAPIKey)+ if DoclingAPIKeyStr != "" {+ c.environments.DoclingAPIKey = DoclingAPIKeyStr+ }++ MinerUAPIServerStr := common.GetEnv(common.EnvMineruAPIServer)+ if MinerUAPIServerStr != "" {+ c.environments.MinerUAPIServer = MinerUAPIServerStr+ }++ MinerUAPIKeyStr := common.GetEnv(common.EnvMineruAPIKey)+ if MinerUAPIKeyStr != "" {+ c.environments.MinerUAPIKey = MinerUAPIKeyStr+ }++ MinerUBackendStr := common.GetEnv(common.EnvMineruBackend)+ if MinerUBackendStr != "" {+ c.environments.MinerUBackend = MinerUBackendStr+ }++ TavilyAPIKeyStr := common.GetEnv(common.EnvTavilyAPIKey)+ if TavilyAPIKeyStr != "" {+ c.environments.TavilyAPIKey = TavilyAPIKeyStr+ }++ QueritAPIKeyStr := common.GetEnv(common.EnvQueritAPIKey)+ if QueritAPIKeyStr != "" {+ c.environments.QueritAPIKey = QueritAPIKeyStr+ }++ KeenableAPIURLStr := common.GetEnv(common.EnvKeenableAPIURL)+ if KeenableAPIURLStr != "" {+ c.environments.KeenableAPIURL = KeenableAPIURLStr+ }return nil}@@ -155,8 +564,6 @@ func GetLanguage() string {lang = common.GetEnv(common.EnvLanguage)}- lang = strings.ToLower(lang)-if strings.Contains(lang, "zh_") ||strings.Contains(lang, "zh-") ||strings.HasPrefix(lang, "zh") {@@ -169,3 +576,265 @@ func GetLanguage() string {func (c *Config) GetSecretKey() string {return c.environments.SecretKey}++func (c *Config) GetEnvLanguage() string {+ return c.environments.Language+}++func (c *Config) GetEnvEnableRegister() bool {+ return *c.environments.EnableRegister+}++func (c *Config) GetEnvDisablePasswordLogin() bool {+ return *c.environments.DisablePasswordLogin+}++func (c *Config) GetEnvDocumentEngineType() string {+ return c.environments.DocumentEngineType+}++func (c *Config) GetEnvDatabaseType() string {+ return c.environments.DatabaseType+}++func (c *Config) GetEnvStorageType() string {+ return c.environments.StorageType+}++func (c *Config) GetEnvMinioHost() string {+ return c.environments.MinioHost+}++func (c *Config) GetEnvMinioRegion() string {+ return c.environments.MinioRegion+}++func (c *Config) GetEnvDefaultSuperUserEmail() string {+ return c.environments.DefaultSuperUser.Email+}++func (c *Config) GetEnvDefaultSuperUserNick() string {+ return c.environments.DefaultSuperUser.Email+}++func (c *Config) GetEnvDictionaryPath() string {+ return c.environments.DictionaryPath+}++func (c *Config) GetEnvDeviceType() string {+ return c.environments.DeviceType+}++func (c *Config) GetInfinityURL() string {+ return c.environments.InfinityURL+}++func (c *Config) GetConfigPath() string {+ return c.environments.RAGFLowConfPath+}++func (c *Config) GetProjectBase() string {+ return c.environments.RAGFlowProjectBase+}++func (c *Config) GetDeployBase() string {+ return c.environments.RAGFlowDeployBase+}++func (c *Config) GetSPACYModelPath() string {+ return c.environments.SPACYModelPath+}++func (c *Config) GetDictionaryPath() string { return c.environments.DictionaryPath }++func (c *Config) GetTTSCacheTTLSeconds() time.Duration { return c.environments.TTSCacheTTLSeconds }++func (c *Config) GetMaxFileNumPerUser() int { return c.environments.MAXFileNumberPerUser }++func (c *Config) GetMaxContentLength() int { return c.environments.MAXContentLength }++func (c *Config) GetHomePath() string { return c.environments.HomePath }++func (c *Config) GetUserProfile() string { return c.environments.UserProfile }++func (c *Config) GetHTTPProxy() string { return c.environments.HTTPProxy }++func (c *Config) GetHTTPSProxy() string { return c.environments.HTTPSProxy }++func (c *Config) LogAPITiming() bool { return c.environments.LOGAPITiming }++func (c *Config) ChunkFeedbackEnabled() bool { return c.environments.ChunkFeedbackEnabled }++func (c *Config) GetChunkFeedbackWeighting() string { return c.environments.ChunkFeedbackWeighting }++func (c *Config) GetBoxWebOauthRedirectURL() string { return c.environments.BoxWebOauthRedirectURL }++func (c *Config) GetGmailWebOAuthRedirectURL() string { return c.environments.GmailWebOAuthRedirectURL }++func (c *Config) GetGoogleDriveWebOAuthRedirectURL() string {+ return c.environments.GoogleDriveWebOAuthRedirectURL+}++func (c *Config) GetDeepDocURL() string {+ return c.environments.DeepDocURL+}++func (c *Config) GetTensorRTDLAServer() string {+ return c.environments.TensorRTDLAServer+}++func (c *Config) GetOSSDeepDocURL() string {+ return c.environments.OSSDeepDocURL+}++func (c *Config) GetDeepDocBatchSingle() string {+ return c.environments.DeepDocBatchSingle+}++func (c *Config) GetDeepDocBatchCount() int {+ return c.environments.DeepDocBatchCount+}++func (c *Config) GetDeepDocBatchLogLevel() string {+ return c.environments.DeepDocBatchLogLevel+}++func (c *Config) GetDeepDocBatchSkipOCR() bool {+ return c.environments.DeepDocSkipOCR+}++func (c *Config) GetDeepDocCompareOnly() bool {+ return c.environments.DeepDocCompareOnly+}++func (c *Config) GetDeepDocCompareFilter() string {+ return c.environments.DeepDocCompareFilter+}++func (c *Config) GetDeepDocCompareCSV() string {+ return c.environments.DeepDocCompareCSV+}++func (c *Config) GetDeepDocBatchCSV() string {+ return c.environments.DeepDocBatchCSV+}++func (c *Config) GetOpenDataLoaderAPIServer() string {+ return c.environments.OpenDataLoaderAPIServer+}++func (c *Config) GetOpenDataLoaderAPIKey() string {+ return c.environments.OpenDataLoaderAPIKey+}++func (c *Config) GetPaddleOCRBaseURL() string {+ return c.environments.PaddleOCRBaseURL+}++func (c *Config) GetPaddleOCRAPIURL() string {+ return c.environments.PaddleOCRAPIURL+}++func (c *Config) GetPaddleOCRAccessToken() string {+ return c.environments.PaddleOCRAccessToken+}++func (c *Config) GetPaddleOCRAlgorithm() string {+ return c.environments.PaddleOCRAlgorithm+}++func (c *Config) GetSOMarkBaseURL() string {+ return c.environments.SOMarkBaseURL+}++func (c *Config) GetSOMarkAPIKey() string {+ return c.environments.SOMarkAPIKey+}++func (c *Config) GetSOMarkImageFormat() string {+ return c.environments.SOMarkImageFormat+}++func (c *Config) GetSOMarkFormulaFormat() string {+ return c.environments.SOMarkFormulaFormat+}++func (c *Config) GetSOMarkTableFormat() string {+ return c.environments.SOMarkTableFormat+}++func (c *Config) GetSOMarkCSFormatStr() string {+ return c.environments.SOMarkCSFormat+}++func (c *Config) GetSOMarkEnableTextCrossPage() bool {+ return c.environments.SOMarkEnableTextCrossPage+}++func (c *Config) GetSOMarkEnableTableCrossPage() bool {+ return c.environments.SOMarkEnableTableCrossPage+}++func (c *Config) GetSOMarkEnableInlineImage() bool {+ return c.environments.SOMarkEnableInlineImage+}++func (c *Config) GetSOMarkEnableTableImage() bool {+ return c.environments.SOMarkEnableTableImage+}++func (c *Config) GetSOMarkEnableImageUnderstanding() bool {+ return c.environments.SOMarkEnableImageUnderstanding+}++func (c *Config) GetSOMarkKeepHeaderFooter() bool {+ return c.environments.SOMarkKeepHeaderFooter+}++func (c *Config) GetTCADPAPIServerURL() string {+ return c.environments.TCADPAPIServerURL+}++func (c *Config) GetTCADPAPIKey() string {+ return c.environments.TCADPAPIKey+}++func (c *Config) GetTEIModel() string {+ return c.environments.TEIModel+}++func (c *Config) GetTEIComposeProfiles() string {+ return c.environments.TEIComposeProfiles+}++func (c *Config) GetTEIBaseURL() string {+ return c.environments.TEIBaseURL+}++func (c *Config) GetDoclingServerURL() string {+ return c.environments.DoclingServerURL+}++func (c *Config) GetDoclingAPIKey() string {+ return c.environments.DoclingAPIKey+}++func (c *Config) GetMinerUAPIServer() string {+ return c.environments.MinerUAPIServer+}++func (c *Config) GetMinerUAPIKey() string {+ return c.environments.MinerUAPIKey+}++func (c *Config) GetMinerUBackend() string {+ return c.environments.MinerUBackend+}++func (c *Config) GetQueritAPIKey() string {+ return c.environments.QueritAPIKey+}++func (c *Config) GetKeenableAPIURL() string {+ return c.environments.KeenableAPIURL+}diff --git a/internal/service/model_service.go b/internal/service/model_service.goindex 483b902a12..a7eb487350 100644--- a/internal/service/model_service.go+++ b/internal/service/model_service.go@@ -1838,14 +1838,14 @@ func (m *ModelProviderService) ensureOpenDataLoaderFromEnv(ctx context.Context,// Mirrors common/constants.py MINERU_ENV_KEYS, PADDLEOCR_ENV_KEYS, OPENDATALOADER_ENV_KEYS.var (mineruEnvKeys = []string{- common.EnvMineruApiServer,+ common.EnvMineruAPIServer,"MINERU_OUTPUT_DIR",common.EnvMineruBackend,"MINERU_SERVER_URL","MINERU_DELETE_OUTPUT",}mineruDefaultConfig = map[string]interface{}{- common.EnvMineruApiServer: "",+ common.EnvMineruAPIServer: "","MINERU_OUTPUT_DIR": "",common.EnvMineruBackend: "pipeline","MINERU_SERVER_URL": "",@@ -1853,21 +1853,21 @@ var (}paddleOCREnvKeys = []string{common.EnvPaddleOCRBaseUrl,- common.EnvPaddleOCRApiURL,+ common.EnvPaddleOCRAPIURL,common.EnvPaddleOCRAccessToken,common.EnvPaddleOCRAlgorithm,}paddleOCRDefaultConfig = map[string]interface{}{common.EnvPaddleOCRBaseUrl: "",- common.EnvPaddleOCRApiURL: "",+ common.EnvPaddleOCRAPIURL: "",common.EnvPaddleOCRAccessToken: nil,common.EnvPaddleOCRAlgorithm: "PaddleOCR-VL",}openDataLoaderEnvKeys = []string{- common.EnvOpenDataLoaderApiServer,+ common.EnvOpenDataLoaderAPIServer,}openDataLoaderDefaultConfig = map[string]interface{}{- common.EnvOpenDataLoaderApiServer: "",+ common.EnvOpenDataLoaderAPIServer: "",})diff --git a/internal/service/system.go b/internal/service/system.goindex aec429f0ca..95423bade8 100644--- a/internal/service/system.go+++ b/internal/service/system.go@@ -478,8 +478,10 @@ func (s *SystemService) ListAllConfigs() ([]map[string]interface{}, error) {func (s *SystemService) ListEnvironments() ([]map[string]interface{}, error) {result := make([]map[string]interface{}, 0)+ globalConfig := server.GetConfig()+// DOC_ENGINE- docEngine := common.GetEnv(common.EnvDocEngine)+ docEngine := globalConfig.GetEnvDocumentEngineType()if docEngine == "" {docEngine = "elasticsearch"}diff --git a/internal/utility/path.go b/internal/utility/path.goindex 7fb034b4c5..8d1ca1f1f0 100644--- a/internal/utility/path.go+++ b/internal/utility/path.go@@ -30,10 +30,10 @@ func GetProjectRoot() string {if confDir := common.GetEnv(common.EnvRAGFlowConfDir); confDir != "" {return confDir}- if d := common.GetEnv(common.EnvRAGProjectBaseURL); d != "" {+ if d := common.GetEnv(common.EnvRAGProjectBase); d != "" {return d}- if d := common.GetEnv(common.EnvRAGDeployBaseURL); d != "" {+ if d := common.GetEnv(common.EnvRAGDeployBase); d != "" {return d}@@ -64,14 +64,14 @@ func GetProjectRoot() string {func FindConfFileInProject(fileName string) (*string, error) {var filePath string- if projDir := common.GetEnv(common.EnvRAGProjectBaseURL); projDir != "" {+ if projDir := common.GetEnv(common.EnvRAGProjectBase); projDir != "" {filePath = filepath.Join(projDir, "conf", fileName)if _, err := os.Stat(filePath); err == nil {return &filePath, nil}}- if projDir := common.GetEnv(common.EnvRAGDeployBaseURL); projDir != "" {+ if projDir := common.GetEnv(common.EnvRAGDeployBase); projDir != "" {filePath = filepath.Join(projDir, "conf", fileName)if _, err := os.Stat(filePath); err == nil {return &filePath, nil