From c0c2a1068013b5eb6e74632d79137acffaf2fc53 Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Wed, 29 Oct 2025 09:45:28 +0800 Subject: [PATCH] Feat: allow initialize Redis without password (#10856) ### What problem does this PR solve? Allow initialize Redis without password. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- api/apps/llm_app.py | 2 +- rag/llm/cv_model.py | 2 +- rag/settings.py | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/apps/llm_app.py b/api/apps/llm_app.py index 3f5357cfa..d14f6fa15 100644 --- a/api/apps/llm_app.py +++ b/api/apps/llm_app.py @@ -264,7 +264,7 @@ def add_llm(): try: image_data = test_image m, tc = mdl.describe(image_data) - if not m and not tc: + if not tc and m.find("**ERROR**:") >= 0: raise Exception(m) except Exception as e: msg += f"\nFail to access model({factory}/{mdl_nm})." + str(e) diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.py index cd3163f02..2ef0cb54a 100644 --- a/rag/llm/cv_model.py +++ b/rag/llm/cv_model.py @@ -526,7 +526,7 @@ class OllamaCV(Base): try: response = self.client.generate( model=self.model_name, - prompt=prompt[0]["content"][0]["text"], + prompt=prompt[0]["content"], images=[image], ) ans = response["response"].strip() diff --git a/rag/settings.py b/rag/settings.py index 06d09f21f..6c2017dc1 100644 --- a/rag/settings.py +++ b/rag/settings.py @@ -54,8 +54,10 @@ elif STORAGE_IMPL_TYPE == 'OSS': try: REDIS = decrypt_database_config(name="redis") except Exception: - REDIS = {} - pass + try: + REDIS = get_base_config("redis", {}) + except Exception: + REDIS = {} DOC_MAXIMUM_SIZE = int(os.environ.get("MAX_CONTENT_LENGTH", 128 * 1024 * 1024)) DOC_BULK_SIZE = int(os.environ.get("DOC_BULK_SIZE", 4)) EMBEDDING_BATCH_SIZE = int(os.environ.get("EMBEDDING_BATCH_SIZE", 16))