diff --git a/.env b/.env index 9d756ff..3b4a563 100644 --- a/.env +++ b/.env @@ -58,9 +58,10 @@ TEI_MAX_CLIENT_BATCH_SIZE=8 BACKEND_PROXY_URL=http://127.0.0.1:6002 # ===== test env connectivity overrides (2026-04-12) ===== -REDIS_HOST=127.0.0.1 +REDIS_HOST=localhost REDIS_PORT=6479 REDIS_PASSWORD=BMfv5aI31kgHWtlx +REDIS_DB=6 DB_HOST=120.79.247.228 DB_PORT=3316 DB_DATABASE=saas diff --git a/.env.example b/.env.example index cab8be8..f248b88 100644 --- a/.env.example +++ b/.env.example @@ -12,6 +12,8 @@ ES_PASSWORD= # Redis (生产默认 10.200.16.14:6479,密码见 docs/QUICKSTART.md §1.6) REDIS_HOST=10.200.16.14 REDIS_PORT=6479 +# 逻辑库编号(与 config.yaml infrastructure.redis.snapshot_db 一致;测试可与生产共用实例时用不同 db 隔离) +REDIS_DB=0 REDIS_PASSWORD= # DeepL Translation API diff --git a/config/environments/test.yaml b/config/environments/test.yaml index 1c8a357..d3b062f 100644 --- a/config/environments/test.yaml +++ b/config/environments/test.yaml @@ -1,13 +1,4 @@ -query_config: - enable_text_embedding: true - text_embedding_field: title_embedding - zh_to_en_model: deepl - en_to_zh_model: deepl - default_translation_model: deepl - zh_to_en_model__source_not_in_index: deepl - en_to_zh_model__source_not_in_index: deepl - default_translation_model__source_not_in_index: deepl - +# 仅覆盖与主干不同的测试环境项;query / translation / redis 等与 config.yaml 一致处不写在此文件中。 infrastructure: elasticsearch: host: http://127.0.0.1:19200 @@ -28,24 +19,6 @@ services: model_id: BAAI/bge-m3 timeout_sec: 60 max_client_batch_size: 8 - translation: - service_url: http://127.0.0.1:6006 - default_model: deepl - default_scene: general - timeout_sec: 10.0 - capabilities: - qwen-mt: - enabled: false - llm: - enabled: false - deepl: - enabled: true - nllb-200-distilled-600m: - enabled: false - opus-mt-zh-en: - enabled: false - opus-mt-en-zh: - enabled: false fine_rank: enabled: false diff --git a/config/loader.py b/config/loader.py index 5306f8c..16a4fc9 100644 --- a/config/loader.py +++ b/config/loader.py @@ -822,6 +822,13 @@ class AppConfigLoader: def _build_infrastructure_config(self, environment: str) -> InfrastructureConfig: del environment + _redis_db_raw = os.getenv("REDIS_DB") or os.getenv("REDIS_SNAPSHOT_DB") + _redis_db = 0 + if _redis_db_raw is not None and str(_redis_db_raw).strip() != "": + try: + _redis_db = int(str(_redis_db_raw).strip()) + except ValueError: + _redis_db = 0 return InfrastructureConfig( elasticsearch=ElasticsearchSettings( host=os.getenv("ES_HOST", "http://localhost:9200"), @@ -831,7 +838,7 @@ class AppConfigLoader: redis=RedisSettings( host=os.getenv("REDIS_HOST", "localhost"), port=int(os.getenv("REDIS_PORT", 6479)), - snapshot_db=int(os.getenv("REDIS_SNAPSHOT_DB", 0)), + snapshot_db=_redis_db, password=os.getenv("REDIS_PASSWORD"), socket_timeout=int(os.getenv("REDIS_SOCKET_TIMEOUT", 1)), socket_connect_timeout=int(os.getenv("REDIS_SOCKET_CONNECT_TIMEOUT", 1)), diff --git a/embeddings/redis_embedding_cache.py b/embeddings/redis_embedding_cache.py index ed1b2c3..11f31d8 100644 --- a/embeddings/redis_embedding_cache.py +++ b/embeddings/redis_embedding_cache.py @@ -53,6 +53,7 @@ class RedisEmbeddingCache: client = redis.Redis( host=redis_config.host, port=redis_config.port, + db=redis_config.snapshot_db, password=redis_config.password, decode_responses=False, socket_timeout=redis_config.socket_timeout, diff --git a/indexer/product_enrich.py b/indexer/product_enrich.py index c3397fb..084c910 100644 --- a/indexer/product_enrich.py +++ b/indexer/product_enrich.py @@ -124,6 +124,7 @@ try: _anchor_redis = redis.Redis( host=_REDIS_CONFIG.host, port=_REDIS_CONFIG.port, + db=_REDIS_CONFIG.snapshot_db, password=_REDIS_CONFIG.password, decode_responses=True, socket_timeout=_REDIS_CONFIG.socket_timeout, diff --git a/models b/models deleted file mode 120000 index 8592557..0000000 --- a/models +++ /dev/null @@ -1 +0,0 @@ -/data-model/saas-search/models \ No newline at end of file diff --git a/translation/cache.py b/translation/cache.py index 23bc550..0352fd6 100644 --- a/translation/cache.py +++ b/translation/cache.py @@ -87,6 +87,7 @@ class TranslationCache: client = redis.Redis( host=redis_config.host, port=redis_config.port, + db=redis_config.snapshot_db, password=redis_config.password, decode_responses=True, socket_timeout=redis_config.socket_timeout, -- libgit2 0.21.2