Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
refactor: optimize storage configuration priority and VLM configuration check logic
begoniezhao20049d034a57
diff --git a/services/docreader/src/parser/caption.py b/services/docreader/src/parser/caption.pyindex bd51290aa..d84bf6d8c 100644--- a/services/docreader/src/parser/caption.py+++ b/services/docreader/src/parser/caption.py@@ -177,7 +177,7 @@ class Caption:self.prompt = """简单凝炼的描述图片的主要内容"""# Use provided VLM config if available, otherwise fall back to environment variables- if vlm_config:+ if vlm_config and vlm_config.get("base_url") and vlm_config.get("model_name"):self.completion_url = vlm_config.get("base_url", "") + "/chat/completions"self.model = vlm_config.get("model_name", "")self.api_key = vlm_config.get("api_key", "")diff --git a/services/docreader/src/parser/storage.py b/services/docreader/src/parser/storage.pyindex e21ed2e9c..433a39306 100644--- a/services/docreader/src/parser/storage.py+++ b/services/docreader/src/parser/storage.py@@ -203,22 +203,22 @@ class MinioStorage(Storage):prefer those values to override envs."""try:- endpoint = os.getenv("MINIO_ENDPOINT")- access_key = os.getenv("MINIO_ACCESS_KEY_ID")- secret_key = os.getenv("MINIO_SECRET_ACCESS_KEY")- bucket_name = os.getenv("MINIO_BUCKET_NAME")- use_ssl = os.getenv("MINIO_USE_SSL", "false").lower() == "true"- path_prefix = os.getenv("MINIO_PATH_PREFIX", "").strip().strip("/")-- # Attempt to override with new generic storage fields- if self.storage_config:+ if self.storage_config and self.storage_config.get("endpoint") and self.storage_config.get("bucket_name"):storage_config = self.storage_config# Direct fields- endpoint = storage_config.get("endpoint", endpoint)- bucket_name = storage_config.get("bucket_name", bucket_name)- path_prefix = storage_config.get("path_prefix", path_prefix).strip().strip("/")- access_key = storage_config.get("access_key_id", access_key)- secret_key = storage_config.get("secret_access_key", secret_key)+ endpoint = storage_config.get("endpoint")+ bucket_name = storage_config.get("bucket_name")+ path_prefix = storage_config.get("path_prefix").strip().strip("/")+ access_key = storage_config.get("access_key_id")+ secret_key = storage_config.get("secret_access_key")+ else:+ endpoint = os.getenv("MINIO_ENDPOINT")+ access_key = os.getenv("MINIO_ACCESS_KEY_ID")+ secret_key = os.getenv("MINIO_SECRET_ACCESS_KEY")+ bucket_name = os.getenv("MINIO_BUCKET_NAME")+ use_ssl = os.getenv("MINIO_USE_SSL", "false").lower() == "true"+ path_prefix = os.getenv("MINIO_PATH_PREFIX", "").strip().strip("/")+if not all([endpoint, access_key, secret_key, bucket_name]):logger.error("Incomplete MinIO configuration, missing required environment variables")