From 7a866cbe216a46b97de9a8f931d1338aebe763c9 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 3 Mar 2025 11:48:43 +0100 Subject: [PATCH 1/8] Update run_with_gunicorn.py --- lightrag/api/run_with_gunicorn.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lightrag/api/run_with_gunicorn.py b/lightrag/api/run_with_gunicorn.py index 903c5c17..f27ddd61 100644 --- a/lightrag/api/run_with_gunicorn.py +++ b/lightrag/api/run_with_gunicorn.py @@ -9,7 +9,10 @@ import signal import pipmaster as pm from lightrag.api.utils_api import parse_args, display_splash_screen from lightrag.kg.shared_storage import initialize_share_data, finalize_share_data +from dotenv import load_dotenv +# Load environment variables from .env file +load_dotenv() def check_and_install_dependencies(): """Check and install required dependencies""" From ff3f29d2406c27d1d28e74ec96a8311858009bda Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 3 Mar 2025 12:13:01 +0100 Subject: [PATCH 2/8] Update run_with_gunicorn.py --- lightrag/api/run_with_gunicorn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lightrag/api/run_with_gunicorn.py b/lightrag/api/run_with_gunicorn.py index f27ddd61..e7143a39 100644 --- a/lightrag/api/run_with_gunicorn.py +++ b/lightrag/api/run_with_gunicorn.py @@ -12,6 +12,7 @@ from lightrag.kg.shared_storage import initialize_share_data, finalize_share_dat from dotenv import load_dotenv # Load environment variables from .env file +print("Current folder: {}".format(os.getcwd())) load_dotenv() def check_and_install_dependencies(): From e87feb76bc86a94c97d7407dda7f329455936e0c Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 3 Mar 2025 12:21:15 +0100 Subject: [PATCH 3/8] Update run_with_gunicorn.py --- lightrag/api/run_with_gunicorn.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lightrag/api/run_with_gunicorn.py b/lightrag/api/run_with_gunicorn.py index e7143a39..50dd195d 100644 --- a/lightrag/api/run_with_gunicorn.py +++ b/lightrag/api/run_with_gunicorn.py @@ -12,8 +12,9 @@ from lightrag.kg.shared_storage import initialize_share_data, finalize_share_dat from dotenv import load_dotenv # Load environment variables from .env file -print("Current folder: {}".format(os.getcwd())) +print(f"Current folder: {os.getcwd()}") load_dotenv() +print(f"Check: {os.getenv('LLM_MODEL')}") def check_and_install_dependencies(): """Check and install required dependencies""" From bda931e1d2abc934b7418e0c2ad4e73734d2366d Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 3 Mar 2025 12:21:50 +0100 Subject: [PATCH 4/8] Update run_with_gunicorn.py --- lightrag/api/run_with_gunicorn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightrag/api/run_with_gunicorn.py b/lightrag/api/run_with_gunicorn.py index 50dd195d..71844fe0 100644 --- a/lightrag/api/run_with_gunicorn.py +++ b/lightrag/api/run_with_gunicorn.py @@ -13,7 +13,7 @@ from dotenv import load_dotenv # Load environment variables from .env file print(f"Current folder: {os.getcwd()}") -load_dotenv() +load_dotenv(".env") print(f"Check: {os.getenv('LLM_MODEL')}") def check_and_install_dependencies(): From 52bedc9118892d1ad214cda7ed6164d06f27e574 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 3 Mar 2025 12:22:37 +0100 Subject: [PATCH 5/8] Update run_with_gunicorn.py --- lightrag/api/run_with_gunicorn.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lightrag/api/run_with_gunicorn.py b/lightrag/api/run_with_gunicorn.py index 71844fe0..4e5353bf 100644 --- a/lightrag/api/run_with_gunicorn.py +++ b/lightrag/api/run_with_gunicorn.py @@ -11,10 +11,8 @@ from lightrag.api.utils_api import parse_args, display_splash_screen from lightrag.kg.shared_storage import initialize_share_data, finalize_share_data from dotenv import load_dotenv -# Load environment variables from .env file -print(f"Current folder: {os.getcwd()}") +# Updated to use the .env that is inside the current folder load_dotenv(".env") -print(f"Check: {os.getenv('LLM_MODEL')}") def check_and_install_dependencies(): """Check and install required dependencies""" From 7b3e39473065935570466537a0c4b7139fb3d176 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 3 Mar 2025 12:23:47 +0100 Subject: [PATCH 6/8] Update run_with_gunicorn.py --- lightrag/api/run_with_gunicorn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lightrag/api/run_with_gunicorn.py b/lightrag/api/run_with_gunicorn.py index 4e5353bf..231a1727 100644 --- a/lightrag/api/run_with_gunicorn.py +++ b/lightrag/api/run_with_gunicorn.py @@ -12,6 +12,7 @@ from lightrag.kg.shared_storage import initialize_share_data, finalize_share_dat from dotenv import load_dotenv # Updated to use the .env that is inside the current folder +# This update allows the user to put a different.env file for each lightrag folder load_dotenv(".env") def check_and_install_dependencies(): From 5680e9ef11ef8403f65823af59a7d52c29548d15 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 3 Mar 2025 12:24:49 +0100 Subject: [PATCH 7/8] Update lightrag_server.py --- lightrag/api/lightrag_server.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index 5f2c437f..637595d3 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -20,7 +20,7 @@ from ascii_colors import ASCIIColors from fastapi.middleware.cors import CORSMiddleware from contextlib import asynccontextmanager from dotenv import load_dotenv -from .utils_api import ( +from lightrag.api.utils_api import ( get_api_key_dependency, parse_args, get_default_host, @@ -30,14 +30,14 @@ from lightrag import LightRAG from lightrag.types import GPTKeywordExtractionFormat from lightrag.api import __api_version__ from lightrag.utils import EmbeddingFunc -from .routers.document_routes import ( +from lightrag.api.routers.document_routes import ( DocumentManager, create_document_routes, run_scanning_process, ) -from .routers.query_routes import create_query_routes -from .routers.graph_routes import create_graph_routes -from .routers.ollama_api import OllamaAPI +from lightrag.api.routers.query_routes import create_query_routes +from lightrag.api.routers.graph_routes import create_graph_routes +from lightrag.api.routers.ollama_api import OllamaAPI from lightrag.utils import logger, set_verbose_debug from lightrag.kg.shared_storage import ( @@ -48,7 +48,9 @@ from lightrag.kg.shared_storage import ( ) # Load environment variables -load_dotenv(override=True) +# Updated to use the .env that is inside the current folder +# This update allows the user to put a different.env file for each lightrag folder +load_dotenv(".env", override=True) # Initialize config parser config = configparser.ConfigParser() From f1ad55244abb482bef83ef2a9b340ef305e025de Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Tue, 4 Mar 2025 14:44:12 +0100 Subject: [PATCH 8/8] linting --- lightrag/api/run_with_gunicorn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lightrag/api/run_with_gunicorn.py b/lightrag/api/run_with_gunicorn.py index 231a1727..cf9b3b91 100644 --- a/lightrag/api/run_with_gunicorn.py +++ b/lightrag/api/run_with_gunicorn.py @@ -15,6 +15,7 @@ from dotenv import load_dotenv # This update allows the user to put a different.env file for each lightrag folder load_dotenv(".env") + def check_and_install_dependencies(): """Check and install required dependencies""" required_packages = [