mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 12:06:42 +08:00
Fix: pipeline ignore MinerU backend config and vllm module is missing (#11955)
### What problem does this PR solve? Fix pipeline ignore MinerU backend config and vllm module is missing. #11944, #11947. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -34,18 +34,28 @@ class MinerUOcrModel(Base, MinerUParser):
|
||||
|
||||
def __init__(self, key: str | dict, model_name: str, **kwargs):
|
||||
Base.__init__(self, key, model_name, **kwargs)
|
||||
config = {}
|
||||
raw_config = {}
|
||||
if key:
|
||||
try:
|
||||
config = json.loads(key)
|
||||
raw_config = json.loads(key)
|
||||
except Exception:
|
||||
config = {}
|
||||
config = config["api_key"]
|
||||
self.mineru_api = config.get("mineru_apiserver", os.environ.get("MINERU_APISERVER", ""))
|
||||
self.mineru_output_dir = config.get("mineru_output_dir", os.environ.get("MINERU_OUTPUT_DIR", ""))
|
||||
self.mineru_backend = config.get("mineru_backend", os.environ.get("MINERU_BACKEND", "pipeline"))
|
||||
self.mineru_server_url = config.get("mineru_server_url", os.environ.get("MINERU_SERVER_URL", ""))
|
||||
self.mineru_delete_output = bool(int(config.get("mineru_delete_output", os.environ.get("MINERU_DELETE_OUTPUT", 1))))
|
||||
raw_config = {}
|
||||
|
||||
# nested {"api_key": {...}} from UI
|
||||
# flat {"MINERU_*": "..."} payload auto-provisioned from env vars
|
||||
config = raw_config.get("api_key", raw_config)
|
||||
if not isinstance(config, dict):
|
||||
config = {}
|
||||
|
||||
def _resolve_config(key: str, env_key: str, default=""):
|
||||
# lower-case keys (UI), upper-case MINERU_* (env auto-provision), env vars
|
||||
return config.get(key, config.get(env_key, os.environ.get(env_key, default)))
|
||||
|
||||
self.mineru_api = _resolve_config("mineru_apiserver", "MINERU_APISERVER", "")
|
||||
self.mineru_output_dir = _resolve_config("mineru_output_dir", "MINERU_OUTPUT_DIR", "")
|
||||
self.mineru_backend = _resolve_config("mineru_backend", "MINERU_BACKEND", "pipeline")
|
||||
self.mineru_server_url = _resolve_config("mineru_server_url", "MINERU_SERVER_URL", "")
|
||||
self.mineru_delete_output = bool(int(_resolve_config("mineru_delete_output", "MINERU_DELETE_OUTPUT", 1)))
|
||||
self.mineru_executable = os.environ.get("MINERU_EXECUTABLE", "mineru")
|
||||
|
||||
logging.info(f"Parsed MinerU config: {config}")
|
||||
|
||||
Reference in New Issue
Block a user