From 600409682e8ef1f88aa7728a0260c29b355dd1b2 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 27 Aug 2024 15:30:57 +0200 Subject: [PATCH] refac: do not change default behaviour --- backend/apps/rag/main.py | 8 ++++---- backend/config.py | 24 ++++++++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/backend/apps/rag/main.py b/backend/apps/rag/main.py index 1803ff8d4..78e43d9e7 100644 --- a/backend/apps/rag/main.py +++ b/backend/apps/rag/main.py @@ -95,8 +95,8 @@ from config import ( TIKA_SERVER_URL, RAG_TOP_K, RAG_RELEVANCE_THRESHOLD, - RAG_MAX_FILE_SIZE, - RAG_MAX_FILE_COUNT, + RAG_FILE_MAX_SIZE, + RAG_FILE_MAX_COUNT, RAG_EMBEDDING_ENGINE, RAG_EMBEDDING_MODEL, RAG_EMBEDDING_MODEL_AUTO_UPDATE, @@ -145,8 +145,8 @@ app.state.config = AppConfig() app.state.config.TOP_K = RAG_TOP_K app.state.config.RELEVANCE_THRESHOLD = RAG_RELEVANCE_THRESHOLD -app.state.config.MAX_FILE_SIZE = RAG_MAX_FILE_SIZE -app.state.config.MAX_FILE_COUNT = RAG_MAX_FILE_COUNT +app.state.config.MAX_FILE_SIZE = RAG_FILE_MAX_SIZE +app.state.config.MAX_FILE_COUNT = RAG_FILE_MAX_COUNT app.state.config.ENABLE_RAG_HYBRID_SEARCH = ENABLE_RAG_HYBRID_SEARCH app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION = ( diff --git a/backend/config.py b/backend/config.py index a4d5d4464..9cdcbe474 100644 --- a/backend/config.py +++ b/backend/config.py @@ -1005,16 +1005,24 @@ ENABLE_RAG_HYBRID_SEARCH = PersistentConfig( os.environ.get("ENABLE_RAG_HYBRID_SEARCH", "").lower() == "true", ) -RAG_MAX_FILE_COUNT = PersistentConfig( - "RAG_MAX_FILE_COUNT", - "rag.max_file_count", - int(os.environ.get("RAG_MAX_FILE_COUNT", "5")), +RAG_FILE_MAX_COUNT = PersistentConfig( + "RAG_FILE_MAX_COUNT", + "rag.file.max_count", + ( + int(os.environ.get("RAG_FILE_MAX_COUNT")) + if os.environ.get("RAG_FILE_MAX_COUNT") + else None + ), ) -RAG_MAX_FILE_SIZE = PersistentConfig( - "RAG_MAX_FILE_SIZE", - "rag.max_file_size", - int(os.environ.get("RAG_MAX_FILE_SIZE", "10")), +RAG_FILE_MAX_SIZE = PersistentConfig( + "RAG_FILE_MAX_SIZE", + "rag.file.max_size", + ( + int(os.environ.get("RAG_FILE_MAX_SIZE")) + if os.environ.get("RAG_FILE_MAX_SIZE") + else None + ), ) ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION = PersistentConfig(