fix: 调整环境变量加载顺序,修复未顺利加载问题

This commit is contained in:
zstar 2025-06-12 19:43:24 +08:00
parent 4116579f17
commit be2259f91c
3 changed files with 19 additions and 14 deletions

View File

@ -14,5 +14,15 @@
# limitations under the License.
#
from pathlib import Path
from beartype.claw import beartype_this_package
from dotenv import load_dotenv
from api.root_path import get_root_folder
beartype_this_package()
# 初始化加载环境变量
env_path = Path(get_root_folder()) / "docker" / ".env"
load_dotenv(env_path)

View File

@ -13,23 +13,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging
import binascii
import time
import logging
import re
import time
from copy import deepcopy
from timeit import default_timer as timer
from api import settings
from api.db import LLMType, ParserType, StatusEnum
from api.db.db_models import Dialog, DB
from api.db.db_models import DB, Dialog
from api.db.services.common_service import CommonService
from api.db.services.knowledgebase_service import KnowledgebaseService
from api.db.services.llm_service import TenantLLMService, LLMBundle
from api import settings
from api.db.services.llm_service import LLMBundle, TenantLLMService
from rag.app.resume import forbidden_select_fields4resume
from rag.app.tag import label_question
from rag.nlp.search import index_name
from rag.prompts import kb_prompt, message_fit_in, llm_id2llm_type, keyword_extraction, chunks_format, citation_prompt
from rag.utils import rmSpace, num_tokens_from_string
from rag.prompts import chunks_format, citation_prompt, kb_prompt, keyword_extraction, llm_id2llm_type, message_fit_in
from rag.utils import num_tokens_from_string, rmSpace
from .database import MINIO_CONFIG

View File

@ -6,9 +6,7 @@ import threading
import time
import traceback
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from dotenv import load_dotenv
from werkzeug.serving import run_simple
from api import settings, utils
@ -17,17 +15,12 @@ from api.db.db_models import init_database_tables as init_web_db
from api.db.init_data import init_llm_factory
from api.db.runtime_config import RuntimeConfig
from api.db.services.document_service import DocumentService
from api.root_path import get_root_folder
from api.utils import show_configs
from api.utils.log_utils import initRootLogger
from api.versions import get_ragflow_version
from rag.settings import print_rag_settings
from rag.utils.redis_conn import RedisDistributedLock
# 加载环境变量
env_path = Path(get_root_folder()) / "docker" / ".env"
load_dotenv(env_path)
initRootLogger("ragflow_server")
stop_event = threading.Event()