From a7920e17d2c4bbb4dd781a612acf3b71c7d0a928 Mon Sep 17 00:00:00 2001 From: tangwang Date: Fri, 6 Mar 2026 17:32:37 +0800 Subject: [PATCH] 项目名称和部署路径修改 --- .cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.md | 14 +++++++------- .cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.基于ES_fuction_score原生能力优化.md | 10 +++++----- .github/workflows/test.yml | 2 +- CHANGES.md | 2 +- CLAUDE.md | 18 ++++++++++-------- CLIP_SERVICE_README.md | 18 ++++++++++-------- README.md | 24 ++++++++++++++++-------- activate.sh | 5 ++++- api/indexer_app.py | 2 +- config/env_config.py | 4 ++-- data/wanbang/README.md | 4 ++-- data/wanbang/使用说明.md | 4 ++-- docs/CNCLIP_SERVICE说明文档.md | 2 +- docs/ES/ES_9 | 4 ++-- docs/Usage-Guide.md | 20 +++++++++++++------- docs/向量化模块和API说明文档.md | 15 ++++++++------- docs/测试Pipeline说明.md | 2 +- docs/环境配置说明.md | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- docs/翻译模块说明.md | 4 ++-- embeddings/CLOUD_EMBEDDING_README.md | 4 ++-- embeddings/server.py | 2 +- frontend/README.md | 2 +- frontend/index.html | 2 +- frontend/static/css/style.css | 2 +- frontend/static/js/app.js | 2 +- indexer/ANCHORS_AND_SEMANTIC_ATTRIBUTES.md | 20 ++++++++++---------- indexer/README.md | 2 +- main.py | 4 ++-- requirements.txt | 4 +++- reranker/server.py | 2 +- restart.sh | 4 ++-- run.sh | 4 ++-- scripts/frontend_server.py | 2 +- scripts/indexer__old_2025_11/ingest.sh | 2 +- scripts/mock_data.sh | 5 +++-- scripts/start.sh | 4 ++-- scripts/start_backend.sh | 3 ++- scripts/start_clip_service.sh | 9 +++++---- scripts/start_cnclip_service.sh | 11 ++++++----- scripts/start_embedding_service.sh | 5 +++-- scripts/start_frontend.sh | 3 ++- scripts/start_indexer.sh | 3 ++- scripts/start_servers.py | 4 ++-- scripts/stop_clip_service.sh | 2 +- scripts/stop_cnclip_service.sh | 2 +- scripts/tenant3__csv_to_shoplazza_xlsx.sh | 3 ++- setup.sh | 10 ++++------ tests/__init__.py | 2 +- third-party/xinference/activate.sh | 3 ++- third-party/xinference/test.sh | 3 ++- 50 files changed, 202 insertions(+), 135 deletions(-) diff --git a/.cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.md b/.cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.md index 20ed290..86d2b72 100644 --- a/.cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.md +++ b/.cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.md @@ -48,7 +48,7 @@ ### 2. 文件修改清单 -#### `/home/tw/SearchEngine/search/multilang_query_builder.py` +#### `/home/tw/saas-search/search/multilang_query_builder.py` **修改 `build_multilang_query` 方法**(约156-190行): @@ -165,9 +165,9 @@ def _build_score_functions(self) -> List[Dict[str, Any]]: return functions ``` -#### `/home/tw/SearchEngine/search/ranking_engine.py` +#### `/home/tw/saas-search/search/ranking_engine.py` -**重命名为** `/home/tw/SearchEngine/search/rerank_engine.py` +**重命名为** `/home/tw/saas-search/search/rerank_engine.py` **修改类名和文档**: @@ -194,7 +194,7 @@ class RerankEngine: self.parsed_terms = self._parse_expression(ranking_expression) ``` -#### `/home/tw/SearchEngine/search/__init__.py` +#### `/home/tw/saas-search/search/__init__.py` 更新导入: @@ -202,7 +202,7 @@ class RerankEngine: from .rerank_engine import RerankEngine # 原 RankingEngine ``` -#### `/home/tw/SearchEngine/search/searcher.py` +#### `/home/tw/saas-search/search/searcher.py` **修改初始化**(约88行): @@ -245,7 +245,7 @@ if enable_rerank and self.rerank_engine.enabled: ) ``` -#### `/home/tw/SearchEngine/config/schema/tenant1/config.yaml` +#### `/home/tw/saas-search/config/schema/tenant1/config.yaml` **添加配置项**(254行后): @@ -274,7 +274,7 @@ function_score: weight: 1.1 ``` -#### `/home/tw/SearchEngine/config/tenant_config.py` +#### `/home/tw/saas-search/config/tenant_config.py` **更新配置类**: diff --git a/.cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.基于ES_fuction_score原生能力优化.md b/.cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.基于ES_fuction_score原生能力优化.md index 7dea756..3d97ef2 100644 --- a/.cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.基于ES_fuction_score原生能力优化.md +++ b/.cursor/plans/es-query-25a9f060.plan.检索表达式优化.ES_function表达式.基于ES_fuction_score原生能力优化.md @@ -30,7 +30,7 @@ ## 配置设计(简化版) -### `/home/tw/SearchEngine/config/schema/tenant1/config.yaml` +### `/home/tw/saas-search/config/schema/tenant1/config.yaml` ```yaml # Function Score配置(ES层打分规则) @@ -131,7 +131,7 @@ rerank: ### 1. 定义配置模型 -**文件**: `/home/tw/SearchEngine/config/models.py`(新建或更新tenant_config.py) +**文件**: `/home/tw/saas-search/config/models.py`(新建或更新tenant_config.py) ```python from dataclasses import dataclass, field @@ -186,7 +186,7 @@ class RerankConfig: ### 2. 修改 MultiLanguageQueryBuilder -**文件**: `/home/tw/SearchEngine/search/multilang_query_builder.py` +**文件**: `/home/tw/saas-search/search/multilang_query_builder.py` **修改 init 方法**: @@ -276,13 +276,13 @@ if fs_config and fs_config.max_boost: ### 3. 更新配置加载器 -**文件**: `/home/tw/SearchEngine/config/__init__.py` 或 `config/loader.py` +**文件**: `/home/tw/saas-search/config/__init__.py` 或 `config/loader.py` 确保正确加载 `function_score` 和 `rerank` 配置段 ### 4. 更新示例配置 -**文件**: `/home/tw/SearchEngine/config/schema/tenant1/config.yaml` +**文件**: `/home/tw/saas-search/config/schema/tenant1/config.yaml` 在 `ranking` 配置后添加新配置(参见上面完整YAML) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 218db5a..d638cb9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: SearchEngine Test Pipeline +name: saas-search Test Pipeline on: push: diff --git a/CHANGES.md b/CHANGES.md index 107f395..e0e0dde 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,7 @@ 2025-12-05 ## 🎯 更新目标 -为 SearchEngine 项目添加基于阿里云 DashScope API 的云端文本向量化功能。 +为 saas-search 项目添加基于阿里云 DashScope API 的云端文本向量化功能。 ## 📝 新增文件 diff --git a/CLAUDE.md b/CLAUDE.md index c617e62..a60aa3d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -23,11 +23,12 @@ This is a **production-ready Multi-Tenant E-Commerce Search SaaS** platform spec ## Development Environment -**Required Environment Setup:** +**Required Environment Setup:** Use project root `activate.sh` (activates conda env `searchengine` and loads `.env`). On a new machine, set `CONDA_ROOT` if conda is not at default path. ```bash -source /home/tw/miniconda3/etc/profile.d/conda.sh -conda activate searchengine +# Optional on new machine: if conda is ~/anaconda3/bin/conda → export CONDA_ROOT=$HOME/anaconda3 +source activate.sh ``` +See `docs/环境配置说明.md` for first-time env creation (`conda env create -f environment.yml` or `pip install -r requirements.txt`). **Database Configuration:** ```yaml @@ -48,11 +49,12 @@ password: P89cZHS5d7dFyc9R ### Environment Setup ```bash -# Complete environment setup -./setup.sh +# Activate environment (canonical: use activate.sh) +source activate.sh -# Install Python dependencies -pip install -r requirements.txt +# First-time / new machine: create env and install deps +./setup.sh # or: conda env create -f environment.yml +# If pip-only: pip install -r requirements.txt ``` ### Data Management @@ -109,7 +111,7 @@ python main.py search "query" --tenant-id 1 --size 10 ### Core Components ``` -/data/tw/SearchEngine/ +/data/tw/saas-search/ ├── api/ # FastAPI REST API service (port 6002) ├── config/ # Configuration management system ├── indexer/ # MySQL → Elasticsearch data pipeline diff --git a/CLIP_SERVICE_README.md b/CLIP_SERVICE_README.md index e44bda9..5c682a9 100644 --- a/CLIP_SERVICE_README.md +++ b/CLIP_SERVICE_README.md @@ -14,8 +14,9 @@ 推荐使用 Conda 新建一个专用环境(与本项目的 `searchengine` 环境隔离): ```bash -# 1)加载 conda -source /home/tw/miniconda3/etc/profile.d/conda.sh +# 1)加载 conda(你的 conda 是 ~/anaconda3/bin/conda → CONDA_ROOT=~/anaconda3) +export CONDA_ROOT=${CONDA_ROOT:-$HOME/anaconda3} # 或你的 Conda 安装路径 +source "$CONDA_ROOT/etc/profile.d/conda.sh" # 2)创建 clip 向量服务专用环境 conda create -n clip_service python=3.9 -y @@ -46,14 +47,14 @@ chmod +x scripts/stop_clip_service.sh ### 2.1 启动服务 ```bash -cd /home/tw/SearchEngine +cd /data/saas-search ./scripts/start_clip_service.sh ``` 脚本行为: -- 自动 `cd` 到仓库根目录 `/home/tw/SearchEngine` -- 尝试加载 `/home/tw/miniconda3/etc/profile.d/conda.sh` 并激活 `clip_service` 环境 +- 自动 `cd` 到仓库根目录 +- 尝试加载 `$CONDA_ROOT/etc/profile.d/conda.sh` 并激活 `clip_service` 环境(可通过 `export CONDA_ROOT=...` 适配新机器) - 使用 `nohup python -m clip_server` 启动服务到后台 - 将日志写入 `logs/clip_service.log` - 将进程号写入 `logs/clip_service.pid` @@ -65,7 +66,7 @@ cd /home/tw/SearchEngine ### 2.2 停止服务 ```bash -cd /home/tw/SearchEngine +cd /data/saas-search ./scripts/stop_clip_service.sh ``` @@ -101,7 +102,8 @@ cd /home/tw/SearchEngine 1. 确认 `clip_service` 环境创建并安装成功: ```bash - source /home/tw/miniconda3/etc/profile.d/conda.sh + export CONDA_ROOT=${CONDA_ROOT:-$HOME/anaconda3} + source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate clip_service python -c "import jina; print('jina version:', jina.__version__)" ``` @@ -109,7 +111,7 @@ cd /home/tw/SearchEngine 2. 启动服务并查看日志: ```bash - cd /home/tw/SearchEngine + cd /data/saas-search ./scripts/start_clip_service.sh tail -f logs/clip_service.log ``` diff --git a/README.md b/README.md index 3fa9fc2..34768fc 100644 --- a/README.md +++ b/README.md @@ -100,16 +100,23 @@ localhost替换为 ## 项目环境 -source /home/tw/miniconda3/etc/profile.d/conda.sh -conda activate searchengine -source .env + +以项目根目录的 **`activate.sh`** 为准(会激活 Conda 环境 `searchengine` 并加载 `.env`): + +```bash +# 若在新机器且 Conda 不在默认路径,先设置: +# - 你的 conda 是 ~/anaconda3/bin/conda,则:export CONDA_ROOT=$HOME/anaconda3 +source activate.sh +``` + +新机器首次需创建环境,见 `docs/环境配置说明.md`(`conda env create -f environment.yml` 或 `pip install -r requirements.txt`)。 ## 测试pipeline 1. 店铺1 tenant_id=162: fake数据 生成商品导入数据 提交到店匠的店铺: -cd /home/tw/SearchEngine && source /home/tw/miniconda3/etc/profile.d/conda.sh && conda activate searchengine && python scripts/csv_to_excel_multi_variant.py --output with_colors.xlsx +cd /data/saas-search && source activate.sh && python scripts/csv_to_excel_multi_variant.py --output with_colors.xlsx 店铺2 tenant_id= @@ -143,7 +150,7 @@ python scripts/recreate_and_import.py \ | 步骤 | 去哪里看 | 摘要 | |------|---------|------| -| 1. 准备环境 | `环境配置说明.md` / `Usage-Guide.md` | Conda/依赖、Elasticsearch、MySQL、必需变量 | +| 1. 准备环境 | `docs/环境配置说明.md` / `Usage-Guide.md` | Conda、`activate.sh`、依赖、ES/MySQL、`.env` | | 2. 构造测试数据 | `测试数据指南.md` | Tenant1 Mock、Tenant2 CSV、`mock_data.sh` / `ingest.sh` | | 3. 启动与验证 | `Usage-Guide.md` | `run.sh` 一键启动、分步脚本、日志与健康检查 | | 4. 理解架构 | `系统设计文档.md` | 数据流、配置系统、查询/搜索/索引模块 | @@ -155,8 +162,9 @@ python scripts/recreate_and_import.py \ ### Runtimes & 命令示例 ```bash -# 1. 安装依赖与准备服务 -pip install -r requirements.txt # 详见 USAGE_GUIDE.md +# 1. 安装依赖与准备服务(环境创建见 docs/环境配置说明.md) +source activate.sh # 或先 export CONDA_ROOT=你的conda路径 +pip install -r requirements.txt # 若用 environment.yml 创建环境可省略 docker run -d --name es -p 9200:9200 elasticsearch:8.11.0 # 2. 构造测试数据并导入 MySQL @@ -187,7 +195,7 @@ curl -X POST http://localhost:6002/search/ \ | 文档 | 内容提要 | 适用场景 | |------|----------|----------| -| `环境配置说明.md` | 系统要求、Conda/依赖、外部服务账号、常用端口 | 首次部署、环境核对 | +| `docs/环境配置说明.md` | 系统要求、`activate.sh`、Conda/依赖、外部服务、CONDA_ROOT | 首次部署、新机器环境 | | `Usage-Guide.md` | 环境准备、服务启动、配置、日志、验证手册 | 日常运维、调试 | | `基础配置指南.md` | 统一硬编码配置说明、索引结构、查询配置 | 了解系统配置、修改配置 | | `测试数据指南.md` | 两个租户的模拟/CSV 数据构造 & MySQL→ES 流程 | 数据准备、联调 | diff --git a/activate.sh b/activate.sh index 317b5f4..e2c8aa3 100644 --- a/activate.sh +++ b/activate.sh @@ -1,5 +1,8 @@ #!/bin/bash -source /home/tw/miniconda3/etc/profile.d/conda.sh +# 新机器部署:可设置 CONDA_ROOT 指向本机 Conda 路径 +# 例如你的 conda 是 ~/anaconda3/bin/conda,则 export CONDA_ROOT=$HOME/anaconda3 +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate searchengine # 如果需要加载 .env 中的环境变量 diff --git a/api/indexer_app.py b/api/indexer_app.py index 914ae39..1401f39 100644 --- a/api/indexer_app.py +++ b/api/indexer_app.py @@ -140,7 +140,7 @@ def init_indexer_service(es_host: str = "http://localhost:9200"): app = FastAPI( title="E-Commerce Indexer API", - description="Dedicated indexing service for SearchEngine", + description="Dedicated indexing service for saas-search", version="1.0.0", docs_url="/docs", redoc_url="/redoc", diff --git a/config/env_config.py b/config/env_config.py index 2e3c4d1..398a767 100644 --- a/config/env_config.py +++ b/config/env_config.py @@ -1,5 +1,5 @@ """ -Centralized configuration management for SearchEngine. +Centralized configuration management for saas-search. Loads configuration from environment variables and .env file. This module provides a single point for loading .env and setting defaults. @@ -80,7 +80,7 @@ DB_CONFIG = { def print_config(): """Print current configuration (with sensitive data masked).""" print("=" * 60) - print("SearchEngine Configuration") + print("saas-search Configuration") print("=" * 60) print("\nElasticsearch:") diff --git a/data/wanbang/README.md b/data/wanbang/README.md index 4285456..b0880f6 100644 --- a/data/wanbang/README.md +++ b/data/wanbang/README.md @@ -37,7 +37,7 @@ pip install requests ### 2. 测试运行(推荐先测试) ```bash -cd /home/tw/SearchEngine/data_crawling +cd /home/tw/saas-search/data_crawling python test_crawler.py ``` @@ -177,7 +177,7 @@ cat shopee_results/summary.json #### 方法1:使用配置文件(推荐) ```bash -cd /home/tw/SearchEngine/data_crawling +cd /home/tw/saas-search/data_crawling cp config.example.py config.py # 编辑 config.py,填入你的API密钥 ``` diff --git a/data/wanbang/使用说明.md b/data/wanbang/使用说明.md index 4d3b900..c693cc7 100644 --- a/data/wanbang/使用说明.md +++ b/data/wanbang/使用说明.md @@ -39,7 +39,7 @@ data_crawling/ ### 1. 测试运行(推荐) ```bash -cd /home/tw/SearchEngine/data_crawling +cd /home/tw/saas-search/data_crawling python test_crawler.py ``` @@ -233,7 +233,7 @@ COUNTRY = '.sg' # 改为新加坡站 # 联系万邦API开通Shopee接口 # 步骤2: 测试 -cd /home/tw/SearchEngine/data_crawling +cd /home/tw/saas-search/data_crawling python test_crawler.py # 步骤3: 检查测试结果 diff --git a/docs/CNCLIP_SERVICE说明文档.md b/docs/CNCLIP_SERVICE说明文档.md index d2725af..c9ca65e 100644 --- a/docs/CNCLIP_SERVICE说明文档.md +++ b/docs/CNCLIP_SERVICE说明文档.md @@ -170,7 +170,7 @@ print(result.shape) # (3, 1024) ## 查看日志 ```bash -tail -f /data/tw/SearchEngine/logs/cnclip_service.log +tail -f /data/tw/saas-search/logs/cnclip_service.log ``` ## 常见问题 diff --git a/docs/ES/ES_9 b/docs/ES/ES_9 index 96fe5ea..7a45ec0 100644 --- a/docs/ES/ES_9 +++ b/docs/ES/ES_9 @@ -236,9 +236,9 @@ http://:5601 --- -### 9. 与现有 SearchEngine 项目集成 +### 9. 与现有 saas-search 项目集成 -在这台新机器上跑你的 SearchEngine 项目时: +在这台新机器上跑你的 saas-search 项目时: - 环境变量或配置里的 ES 地址需要指向这台机器,例如: - `ES_HOST=http://127.0.0.1:9200` diff --git a/docs/Usage-Guide.md b/docs/Usage-Guide.md index ef7371b..4f51214 100644 --- a/docs/Usage-Guide.md +++ b/docs/Usage-Guide.md @@ -1,4 +1,4 @@ -# 使用指南 - SearchEngine +# 使用指南 - saas-search 本文档提供完整的使用指南,包括环境准备、服务启动、配置说明、日志查看等。 @@ -25,13 +25,19 @@ ### 安装依赖 -#### 1. 安装Python依赖 +#### 1. 安装 Python 依赖与激活环境 + +**推荐**:使用项目根目录的 `activate.sh` 激活环境(会加载 `.env`)。新机器部署时若 Conda 不在默认路径,请先设置 `CONDA_ROOT`(例如你的 conda 是 `~/anaconda3/bin/conda`,则 `export CONDA_ROOT=$HOME/anaconda3`)。详见 `docs/环境配置说明.md`。 ```bash -cd /home/tw/SearchEngine -pip install -r requirements.txt +cd /data/saas-search +source activate.sh ``` +首次在新机器创建环境时,可任选其一: +- `conda env create -f environment.yml`(推荐,与 environment.yml 一致) +- 或创建 env 后 `pip install -r requirements.txt` + #### 2. 启动Elasticsearch **方式1: 使用Docker(推荐)** @@ -91,7 +97,7 @@ API_PORT=6002 ### 方式1: 一键启动(推荐) ```bash -cd /home/tw/SearchEngine +cd /data/saas-search ./run.sh ``` @@ -451,7 +457,7 @@ curl "https://api.yourdomain.com/search/suggestions?q=iph&size=5&language=en&wit #### UAT 环境(索引前缀 uat_) ```bash -cd /home/tw/SearchEngine +cd /data/saas-search # 1. 切换到 UAT 环境配置 cp .env.uat .env @@ -475,7 +481,7 @@ curl -X POST "http://localhost:6004/indexer/reindex" \ #### PROD 环境(无前缀) ```bash -cd /home/tw/SearchEngine +cd /data/saas-search # 1. 切换到 PROD 环境配置 cp .env.prod .env diff --git a/docs/向量化模块和API说明文档.md b/docs/向量化模块和API说明文档.md index d6d2b66..4a3f803 100644 --- a/docs/向量化模块和API说明文档.md +++ b/docs/向量化模块和API说明文档.md @@ -1,6 +1,6 @@ # 向量化模块和API说明文档 -本文档详细说明SearchEngine项目中的向量化模块架构、API接口、配置方法和使用指南。 +本文档详细说明saas-search项目中的向量化模块架构、API接口、配置方法和使用指南。 ## 目录 @@ -62,7 +62,7 @@ ### 1.1 向量化模块简介 -SearchEngine项目实现了完整的文本和图片向量化能力,支持两种部署方式: +saas-search项目实现了完整的文本和图片向量化能力,支持两种部署方式: 1. **本地向量化服务**:独立部署的微服务,基于本地GPU/CPU运行BGE-M3和CN-CLIP模型 2. **云端向量化服务**:集成阿里云DashScope API,按使用量付费 @@ -117,7 +117,7 @@ SearchEngine项目实现了完整的文本和图片向量化能力,支持两 ``` ┌─────────────────────────────────────┐ -│ SearchEngine Main Service │ +│ saas-search Main Service │ │ (uses CloudTextEncoder) │ └──────────────┬──────────────────────┘ │ @@ -169,9 +169,10 @@ SearchEngine项目实现了完整的文本和图片向量化能力,支持两 #### 方式2:手动启动 ```bash -# 激活环境 -source /home/tw/miniconda3/etc/profile.d/conda.sh -conda activate searchengine +# 激活环境(推荐使用项目根目录 activate.sh;新机器按需 export CONDA_ROOT) +# 例如你的 conda 是 ~/anaconda3/bin/conda,则 export CONDA_ROOT=$HOME/anaconda3 +cd /data/saas-search +source activate.sh # 启动服务 python -m uvicorn embeddings.server:app \ @@ -1419,6 +1420,6 @@ python scripts/benchmark_embeddings.py 如有问题或建议,请联系项目维护者。 -**项目仓库**: `/data/tw/SearchEngine` +**项目仓库**: `/data/saas-search` **相关文档目录**: `docs/` diff --git a/docs/测试Pipeline说明.md b/docs/测试Pipeline说明.md index ee254cb..8cd054f 100644 --- a/docs/测试Pipeline说明.md +++ b/docs/测试Pipeline说明.md @@ -152,7 +152,7 @@ pytest tests/integration/test_api_integration.py -v #### 5.1 启动 Indexer 服务 ```bash -cd /home/tw/SearchEngine +cd /home/tw/saas-search ./scripts/stop.sh # 停掉已有进程(可选) ./scripts/start_indexer.sh # 启动专用 indexer 服务,默认端口 6004 ``` diff --git a/docs/环境配置说明.md b/docs/环境配置说明.md index 841674a..50c1a15 100644 --- a/docs/环境配置说明.md +++ b/docs/环境配置说明.md @@ -1,18 +1,50 @@ +## 1. 系统要求 +- **操作系统**:Linux(推荐 Ubuntu 18.04+) +- **Conda**:Miniconda3 或 Anaconda(用于 Python 环境隔离) +- **Python**:3.10(由 Conda 环境提供) +- **内存**:建议 8GB+(含模型与 ES) +- **磁盘**:10GB+(含模型与索引) + +--- ## 2. Python 运行环境 +**推荐方式(与项目脚本一致)**:使用项目根目录下的 `activate.sh` 激活环境,会自动加载当前目录下的 `.env`(忽略注释与空行): + ```bash -# 1. 激活 Conda -source /home/tw/miniconda3/etc/profile.d/conda.sh -conda activate searchengine +cd /data/saas-search +source activate.sh +``` -# 如果部署到新机器,不存在 searchengine 环境时,需要初始化环境: -cd /home/tw/SearchEngine -pip install -r requirements.txt +`activate.sh` 会激活 Conda 环境 `searchengine`。若在新机器上部署,请先设置本机 Conda 路径再执行: + +```bash +# 你的 conda 在 ~/anaconda3/bin/conda,则 CONDA_ROOT=~/anaconda3 +export CONDA_ROOT=$HOME/anaconda3 # 或你的 Conda 安装路径(如 /home/ubuntu/anaconda3) +source activate.sh ``` +**新机器首次部署(创建环境)**:若本机尚未创建 `searchengine` 环境,任选其一: + +- **方式 A(推荐,与 environment.yml 一致)**: + ```bash + cd /data/saas-search + export CONDA_ROOT=$HOME/anaconda3 # 或你的 Conda 安装路径 + conda env create -f environment.yml + source activate.sh + ``` +- **方式 B(仅 pip)**: + ```bash + conda create -n searchengine python=3.10 -y + conda activate searchengine + cd /data/saas-search + pip install -r requirements.txt + ``` + +之后日常使用执行 `source activate.sh` 即可(如需可先 `export CONDA_ROOT=...`)。 + --- ## 3. 外部服务与端口 @@ -83,7 +115,7 @@ API_PORT=6002 ## 6. 店匠数据源说明 -SearchEngine 以 MySQL 中的店匠标准表为权威数据源: +saas-search 以 MySQL 中的店匠标准表为权威数据源: - `shoplazza_product_spu`:SPU 商品主表 - `shoplazza_product_sku`:SKU 变体表 @@ -114,10 +146,13 @@ SearchEngine 以 MySQL 中的店匠标准表为权威数据源: ## 7. 相关脚本 +- **`activate.sh`**(项目根目录):激活 Conda 环境 `searchengine` 并加载 `.env`,**日常开发/部署以本脚本为准**。 - `scripts/mock_data.sh`:一次性生成 Tenant1 Mock + Tenant2 CSV 数据并导入 MySQL - `scripts/ingest.sh [recreate]`:从 MySQL 写入 Elasticsearch -- `run.sh` / `restart.sh`:服务启动/重启 +- `run.sh` / `restart.sh`:服务启动/重启(内部会调用 `start_backend.sh` 等,同样使用 `CONDA_ROOT`) + +**新机器部署**:若 Conda 未安装在默认路径(如 `/home/tw/miniconda3`),请在执行上述脚本前设置 `CONDA_ROOT`。例如你的 conda 是 `~/anaconda3/bin/conda`(即 `/home/ubuntu/anaconda3/bin/conda`),则设置:`export CONDA_ROOT=$HOME/anaconda3`。可将该行写入 `~/.bashrc` 或部署说明。 -更多脚本参数、日志与验证命令参见 `USAGE_GUIDE.md` 与 `TEST_DATA_GUIDE.md`。 +更多脚本参数、日志与验证命令参见 `Usage-Guide.md` 与 `测试数据指南.md`。 diff --git a/docs/翻译模块说明.md b/docs/翻译模块说明.md index dd3718d..64e0732 100644 --- a/docs/翻译模块说明.md +++ b/docs/翻译模块说明.md @@ -51,14 +51,14 @@ TRANSLATION_MODEL=qwen # 或 deepl 推荐(热更新): ```bash -cd /home/tw/SearchEngine +cd /home/tw/saas-search uvicorn api.translator_app:app --host 0.0.0.0 --port 6006 --reload ``` 指定默认模型(不传请求 `model` 时生效): ```bash -cd /home/tw/SearchEngine +cd /home/tw/saas-search export TRANSLATION_MODEL=qwen # 或 deepl uvicorn api.translator_app:app --host 0.0.0.0 --port 6006 --reload ``` diff --git a/embeddings/CLOUD_EMBEDDING_README.md b/embeddings/CLOUD_EMBEDDING_README.md index 3036c09..96d5204 100644 --- a/embeddings/CLOUD_EMBEDDING_README.md +++ b/embeddings/CLOUD_EMBEDDING_README.md @@ -2,7 +2,7 @@ ## 📝 概述 -本次更新为 SearchEngine 项目添加了基于阿里云 DashScope API 的云端文本向量化功能,使用 `text-embedding-v4` 模型。 +本次更新为 saas-search 项目添加了基于阿里云 DashScope API 的云端文本向量化功能,使用 `text-embedding-v4` 模型。 ## 🎯 主要功能 @@ -25,7 +25,7 @@ ## 📁 文件结构 ``` -SearchEngine/ +saas-search/ ├── embeddings/ │ ├── cloud_text_encoder.py # 云端向量化编码器(新增) │ ├── text_encoder.py # 本地编码器(现有) diff --git a/embeddings/server.py b/embeddings/server.py index 9a5bbf1..d7bf9b8 100644 --- a/embeddings/server.py +++ b/embeddings/server.py @@ -19,7 +19,7 @@ from embeddings.clip_model import ClipImageModel logger = logging.getLogger(__name__) -app = FastAPI(title="SearchEngine Embedding Service", version="1.0.0") +app = FastAPI(title="saas-search Embedding Service", version="1.0.0") # Models are loaded at startup, not lazily _text_model: Optional[BgeTextModel] = None diff --git a/frontend/README.md b/frontend/README.md index 8eac773..85db218 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -77,7 +77,7 @@ 1. **启动后端服务**: ```bash -cd /home/tw/SearchEngine +cd /home/tw/saas-search bash scripts/start_backend.sh ``` diff --git a/frontend/index.html b/frontend/index.html index 00855cd..0faf099 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -194,7 +194,7 @@
-

SearchEngine © 2025 | API: Loading...

+

saas-search © 2025 | API: Loading...

diff --git a/frontend/static/css/style.css b/frontend/static/css/style.css index f2ab340..87a3f11 100644 --- a/frontend/static/css/style.css +++ b/frontend/static/css/style.css @@ -1,4 +1,4 @@ -/* SearchEngine - Modern Clean UI */ +/* saas-search - Modern Clean UI */ * { margin: 0; diff --git a/frontend/static/js/app.js b/frontend/static/js/app.js index 995f64b..cf232ef 100644 --- a/frontend/static/js/app.js +++ b/frontend/static/js/app.js @@ -1,4 +1,4 @@ -// SearchEngine Frontend - Modern UI (Multi-Tenant) +// saas-search Frontend - Modern UI (Multi-Tenant) const API_BASE_URL = window.API_BASE_URL || 'http://localhost:6002'; if (document.getElementById('apiUrl')) { diff --git a/indexer/ANCHORS_AND_SEMANTIC_ATTRIBUTES.md b/indexer/ANCHORS_AND_SEMANTIC_ATTRIBUTES.md index d88b23e..9625658 100644 --- a/indexer/ANCHORS_AND_SEMANTIC_ATTRIBUTES.md +++ b/indexer/ANCHORS_AND_SEMANTIC_ATTRIBUTES.md @@ -18,7 +18,7 @@ - **Mapping 位置**:`mappings/search_products.json` 中的 `qanchors` 对象。 - **结构**(与 `title.{lang}` 一致): -```140:182:/home/tw/SearchEngine/mappings/search_products.json +```140:182:/home/tw/saas-search/mappings/search_products.json "qanchors": { "type": "object", "properties": { @@ -48,7 +48,7 @@ - **Mapping 位置**:`mappings/search_products.json`,追加的 nested 字段。 - **结构**: -```1392:1410:/home/tw/SearchEngine/mappings/search_products.json +```1392:1410:/home/tw/saas-search/mappings/search_products.json "semantic_attributes": { "type": "nested", "properties": { @@ -89,7 +89,7 @@ - **文件**:`indexer/process_products.py` - **函数签名**: -```365:392:/home/tw/SearchEngine/indexer/process_products.py +```365:392:/home/tw/saas-search/indexer/process_products.py def analyze_products( products: List[Dict[str, str]], target_lang: str = "zh", @@ -108,7 +108,7 @@ def analyze_products( - **支持的输出语言**(在同文件中定义): -```54:62:/home/tw/SearchEngine/indexer/process_products.py +```54:62:/home/tw/saas-search/indexer/process_products.py LANG_LABELS: Dict[str, str] = { "zh": "中文", "en": "英文", @@ -148,7 +148,7 @@ SUPPORTED_LANGS = set(LANG_LABELS.keys()) - Prompt 中会明确要求“**所有输出内容使用目标语言**”,并给出中英文示例: -```65:81:/home/tw/SearchEngine/indexer/process_products.py +```65:81:/home/tw/saas-search/indexer/process_products.py def create_prompt(products: List[Dict[str, str]], target_lang: str = "zh") -> str: """创建LLM提示词(根据目标语言输出)""" lang_label = LANG_LABELS.get(target_lang, "对应语言") @@ -170,7 +170,7 @@ def create_prompt(products: List[Dict[str, str]], target_lang: str = "zh") -> st - 返回格式固定为 Markdown 表格,首行头为: -```89:91:/home/tw/SearchEngine/indexer/process_products.py +```89:91:/home/tw/saas-search/indexer/process_products.py | 序号 | 商品标题 | 品类路径 | 细分标签 | 适用人群 | 使用场景 | 适用季节 | 关键属性 | 材质说明 | 功能特点 | 商品卖点 | 锚文本 | |----|----|----|----|----|----|----|----|----|----|----|----| ``` @@ -185,7 +185,7 @@ def create_prompt(products: List[Dict[str, str]], target_lang: str = "zh") -> st 在 `SPUDocumentTransformer.transform_spu_to_doc(...)` 的末尾,在所有基础字段(多语言文本、类目、SKU/规格、价格、库存等)填充完成后,会调用: -```96:101:/home/tw/SearchEngine/indexer/document_transformer.py +```96:101:/home/tw/saas-search/indexer/document_transformer.py # 文本字段处理(翻译等) self._fill_text_fields(doc, spu_row, primary_lang) @@ -206,7 +206,7 @@ def create_prompt(products: List[Dict[str, str]], target_lang: str = "zh") -> st 在 `_fill_llm_attributes` 内部: -```148:164:/home/tw/SearchEngine/indexer/document_transformer.py +```148:164:/home/tw/saas-search/indexer/document_transformer.py try: index_langs = self.tenant_config.get("index_languages") or ["en", "zh"] except Exception: @@ -232,7 +232,7 @@ def create_prompt(products: List[Dict[str, str]], target_lang: str = "zh") -> st 核心逻辑(简化描述): -```164:210:/home/tw/SearchEngine/indexer/document_transformer.py +```164:210:/home/tw/saas-search/indexer/document_transformer.py spu_id = str(spu_row.get("id") or "").strip() title = str(spu_row.get("title") or "").strip() if not spu_id or not title: @@ -365,7 +365,7 @@ def create_prompt(products: List[Dict[str, str]], target_lang: str = "zh") -> st 现有 `suggestion/builder.py` 已经支持从 `qanchors.{lang}` 中提取候选: -```249:287:/home/tw/SearchEngine/suggestion/builder.py +```249:287:/home/tw/saas-search/suggestion/builder.py # Step 1: product title/qanchors hits = self._scan_products(tenant_id, batch_size=batch_size) ... diff --git a/indexer/README.md b/indexer/README.md index 2c79081..a173256 100644 --- a/indexer/README.md +++ b/indexer/README.md @@ -7,7 +7,7 @@ - 负责**商品/店铺/类目等基础数据同步**(写 MySQL)。 - 负责**多租户环境下的全量/增量索引调度**,但不再关心具体 doc 字段细节。 -- **Python 索引富化模块(本项目 SearchEngine / indexer)** +- **Python 索引富化模块(本项目 saas-search / indexer)** - 负责“**如何把 MySQL 基础数据变成符合 ES mapping 的 doc**”,包括: - 多语言字段组织; - 翻译调用与缓存; diff --git a/main.py b/main.py index 18b7a7a..a1a65a6 100755 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Main entry point for SearchEngine operations. +Main entry point for saas-search operations. Provides a unified CLI for common operations: - serve: Start API service (search + admin routes) @@ -146,7 +146,7 @@ def cmd_build_suggestions(args): def main(): """Main CLI entry point.""" parser = argparse.ArgumentParser( - description='SearchEngine - E-Commerce Search SaaS', + description='saas-search - E-Commerce Search SaaS', formatter_class=argparse.RawDescriptionHelpFormatter ) diff --git a/requirements.txt b/requirements.txt index 83ea318..b05cf2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -# Python dependencies for SearchEngine +# Python dependencies for saas-search # Core pyyaml>=6.0 @@ -27,6 +27,8 @@ fastapi>=0.100.0 uvicorn[standard]>=0.23.0 pydantic>=2.0.0 python-multipart>=0.0.6 +slowapi>=0.1.9 +anyio>=3.7.0 # Translation requests>=2.31.0 diff --git a/reranker/server.py b/reranker/server.py index f792996..3f0ea54 100644 --- a/reranker/server.py +++ b/reranker/server.py @@ -31,7 +31,7 @@ logging.basicConfig( ) logger = logging.getLogger("reranker.service") -app = FastAPI(title="SearchEngine Reranker Service", version="1.0.0") +app = FastAPI(title="saas-search Reranker Service", version="1.0.0") _reranker: Optional[BGEReranker] = None diff --git a/restart.sh b/restart.sh index 2092901..2def532 100755 --- a/restart.sh +++ b/restart.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Restart script for SearchEngine services +# Restart script for saas-search services # This script stops all services first, then starts them again cd "$(dirname "$0")" @@ -11,7 +11,7 @@ RED='\033[0;31m' NC='\033[0m' echo -e "${GREEN}========================================${NC}" -echo -e "${GREEN}SearchEngine服务重启脚本${NC}" +echo -e "${GREEN}saas-search服务重启脚本${NC}" echo -e "${GREEN}========================================${NC}" # Step 1: Stop all services diff --git a/run.sh b/run.sh index 97fab3d..6f0d785 100755 --- a/run.sh +++ b/run.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Production startup script for SearchEngine services +# Production startup script for saas-search services # This script starts frontend and backend services (no data ingestion) cd "$(dirname "$0")" @@ -11,7 +11,7 @@ RED='\033[0;31m' NC='\033[0m' echo -e "${GREEN}========================================${NC}" -echo -e "${GREEN}SearchEngine服务启动脚本${NC}" +echo -e "${GREEN}saas-search服务启动脚本${NC}" echo -e "${GREEN}========================================${NC}" # Create logs directory if it doesn't exist diff --git a/scripts/frontend_server.py b/scripts/frontend_server.py index 58d241a..749fe41 100755 --- a/scripts/frontend_server.py +++ b/scripts/frontend_server.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Simple HTTP server for SearchEngine frontend. +Simple HTTP server for saas-search frontend. """ import http.server diff --git a/scripts/indexer__old_2025_11/ingest.sh b/scripts/indexer__old_2025_11/ingest.sh index a420fe3..42db69a 100755 --- a/scripts/indexer__old_2025_11/ingest.sh +++ b/scripts/indexer__old_2025_11/ingest.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Unified data ingestion script for SearchEngine +# Unified data ingestion script for saas-search # Ingests data from MySQL to Elasticsearch cd "$(dirname "$0")/.." diff --git a/scripts/mock_data.sh b/scripts/mock_data.sh index 1184447..401c85f 100755 --- a/scripts/mock_data.sh +++ b/scripts/mock_data.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============================================================================ -# Mock Data Script for SearchEngine +# Mock Data Script for saas-search # ============================================================================ # # 功能说明: @@ -20,7 +20,8 @@ # ============================================================================ cd "$(dirname "$0")/.." -source /home/tw/miniconda3/etc/profile.d/conda.sh +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate searchengine GREEN='\033[0;32m' diff --git a/scripts/start.sh b/scripts/start.sh index 594a6fb..bfbb7c2 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Unified startup script for SearchEngine services +# Unified startup script for saas-search services # This script starts both frontend and backend services cd "$(dirname "$0")/.." @@ -11,7 +11,7 @@ RED='\033[0;31m' NC='\033[0m' echo -e "${GREEN}========================================${NC}" -echo -e "${GREEN}SearchEngine服务启动脚本${NC}" +echo -e "${GREEN}saas-search服务启动脚本${NC}" echo -e "${GREEN}========================================${NC}" # Create logs directory if it doesn't exist diff --git a/scripts/start_backend.sh b/scripts/start_backend.sh index 93e4738..919e6da 100755 --- a/scripts/start_backend.sh +++ b/scripts/start_backend.sh @@ -5,7 +5,8 @@ set -e cd "$(dirname "$0")/.." -source /home/tw/miniconda3/etc/profile.d/conda.sh +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate searchengine GREEN='\033[0;32m' diff --git a/scripts/start_clip_service.sh b/scripts/start_clip_service.sh index c42561f..856d219 100755 --- a/scripts/start_clip_service.sh +++ b/scripts/start_clip_service.sh @@ -10,7 +10,7 @@ set -e cd "$(dirname "$0")/.." -LOG_DIR="/home/tw/SearchEngine/logs" +LOG_DIR="$(pwd)/logs" mkdir -p "${LOG_DIR}" PID_FILE="${LOG_DIR}/clip_service.pid" LOG_FILE="${LOG_DIR}/clip_service.log" @@ -20,16 +20,17 @@ echo "Starting CLIP vector service (clip-server)" echo "========================================" # Load conda and activate dedicated environment, if available -if [ -f "/home/tw/miniconda3/etc/profile.d/conda.sh" ]; then +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +if [ -f "$CONDA_ROOT/etc/profile.d/conda.sh" ]; then # shellcheck disable=SC1091 - source /home/tw/miniconda3/etc/profile.d/conda.sh + source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate clip_service || { echo "Failed to activate conda env 'clip_service'. Please create it first." >&2 echo "See CLIP_SERVICE_README.md for setup instructions." >&2 exit 1 } else - echo "Warning: /home/tw/miniconda3/etc/profile.d/conda.sh not found." >&2 + echo "Warning: $CONDA_ROOT/etc/profile.d/conda.sh not found." >&2 echo "Please activate the 'clip_service' environment manually before running this script." >&2 fi diff --git a/scripts/start_cnclip_service.sh b/scripts/start_cnclip_service.sh index 6057f8b..513ed45 100755 --- a/scripts/start_cnclip_service.sh +++ b/scripts/start_cnclip_service.sh @@ -45,8 +45,8 @@ DEFAULT_MODEL_NAME="CN-CLIP/ViT-H-14" # DEFAULT_MODEL_NAME="CN-CLIP/ViT-L-14-336" DEFAULT_REPLICAS=1 # 副本数 -# 项目路径 -PROJECT_ROOT="/data/tw/SearchEngine" +# 项目路径(以仓库实际路径为准,避免写死 /data/tw/...) +PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)" CLIP_SERVER_DIR="${PROJECT_ROOT}/third-party/clip-as-service/server" LOG_DIR="${PROJECT_ROOT}/logs" PID_FILE="${LOG_DIR}/cnclip_service.pid" @@ -180,12 +180,13 @@ if [ -z "${CONDA_DEFAULT_ENV}" ] || [ "${CONDA_DEFAULT_ENV}" != "clip_service" ] echo -e "${YELLOW}警告: 当前未激活 clip_service 环境${NC}" echo -e "${YELLOW}正在激活环境...${NC}" - if [ -f "/home/tw/miniconda3/etc/profile.d/conda.sh" ]; then - source "/home/tw/miniconda3/etc/profile.d/conda.sh" + CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" + if [ -f "$CONDA_ROOT/etc/profile.d/conda.sh" ]; then + source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate clip_service echo -e "${GREEN}✓ 环境已激活${NC}" else - echo -e "${RED}错误: 无法找到 conda 初始化脚本${NC}" + echo -e "${RED}错误: 无法找到 conda 初始化脚本: $CONDA_ROOT/etc/profile.d/conda.sh${NC}" exit 1 fi else diff --git a/scripts/start_embedding_service.sh b/scripts/start_embedding_service.sh index 117b1b1..0a678d6 100755 --- a/scripts/start_embedding_service.sh +++ b/scripts/start_embedding_service.sh @@ -13,8 +13,9 @@ set -e cd "$(dirname "$0")/.." # Load conda env if available (keep consistent with other scripts) -if [ -f "/home/tw/miniconda3/etc/profile.d/conda.sh" ]; then - source /home/tw/miniconda3/etc/profile.d/conda.sh +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +if [ -f "$CONDA_ROOT/etc/profile.d/conda.sh" ]; then + source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate searchengine fi diff --git a/scripts/start_frontend.sh b/scripts/start_frontend.sh index e8fce2e..837a7ba 100755 --- a/scripts/start_frontend.sh +++ b/scripts/start_frontend.sh @@ -5,7 +5,8 @@ set -e cd "$(dirname "$0")/.." -source /home/tw/miniconda3/etc/profile.d/conda.sh +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate searchengine GREEN='\033[0;32m' diff --git a/scripts/start_indexer.sh b/scripts/start_indexer.sh index fa3ade2..3a03bdb 100755 --- a/scripts/start_indexer.sh +++ b/scripts/start_indexer.sh @@ -5,7 +5,8 @@ set -e cd "$(dirname "$0")/.." -source /home/tw/miniconda3/etc/profile.d/conda.sh +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate searchengine GREEN='\033[0;32m' diff --git a/scripts/start_servers.py b/scripts/start_servers.py index 50db5dc..23cc16c 100755 --- a/scripts/start_servers.py +++ b/scripts/start_servers.py @@ -178,12 +178,12 @@ def main(): """Main function to start all servers.""" global manager - parser = argparse.ArgumentParser(description='Start SearchEngine servers (multi-tenant)') + parser = argparse.ArgumentParser(description='Start saas-search servers (multi-tenant)') parser.add_argument('--es-host', default='http://localhost:9200', help='Elasticsearch host') parser.add_argument('--check-dependencies', action='store_true', help='Check dependencies before starting') args = parser.parse_args() - logger.info("Starting SearchEngine servers (multi-tenant)...") + logger.info("Starting saas-search servers (multi-tenant)...") logger.info(f"Elasticsearch: {args.es_host}") # Check dependencies if requested diff --git a/scripts/stop_clip_service.sh b/scripts/stop_clip_service.sh index 59977cc..81deb3c 100755 --- a/scripts/stop_clip_service.sh +++ b/scripts/stop_clip_service.sh @@ -4,7 +4,7 @@ # set -e -LOG_DIR="/home/tw/SearchEngine/logs" +LOG_DIR="/home/tw/saas-search/logs" PID_FILE="${LOG_DIR}/clip_service.pid" echo "========================================" diff --git a/scripts/stop_cnclip_service.sh b/scripts/stop_cnclip_service.sh index 0a01344..3cc3877 100755 --- a/scripts/stop_cnclip_service.sh +++ b/scripts/stop_cnclip_service.sh @@ -21,7 +21,7 @@ BLUE='\033[0;34m' NC='\033[0m' # No Color # 项目路径 -PROJECT_ROOT="/data/tw/SearchEngine" +PROJECT_ROOT="/data/tw/saas-search" LOG_DIR="${PROJECT_ROOT}/logs" PID_FILE="${LOG_DIR}/cnclip_service.pid" diff --git a/scripts/tenant3__csv_to_shoplazza_xlsx.sh b/scripts/tenant3__csv_to_shoplazza_xlsx.sh index bf93793..c3b042d 100755 --- a/scripts/tenant3__csv_to_shoplazza_xlsx.sh +++ b/scripts/tenant3__csv_to_shoplazza_xlsx.sh @@ -1,5 +1,6 @@ # 激活环境 -source /home/tw/miniconda3/etc/profile.d/conda.sh +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate searchengine # # 基本使用(生成所有数据) diff --git a/setup.sh b/setup.sh index fa035e1..28e0d2c 100755 --- a/setup.sh +++ b/setup.sh @@ -1,8 +1,9 @@ #!/bin/bash -source /home/tw/miniconda3/etc/profile.d/conda.sh +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +source "$CONDA_ROOT/etc/profile.d/conda.sh" -# SearchEngine Setup and Startup Script +# saas-search Setup and Startup Script # This script sets up the environment and starts all services set -e # Exit on error @@ -14,7 +15,7 @@ YELLOW='\033[1;33m' NC='\033[0m' # No Color echo -e "${GREEN}========================================${NC}" -echo -e "${GREEN}SearchEngine Setup Script${NC}" +echo -e "${GREEN}saas-search Setup Script${NC}" echo -e "${GREEN}========================================${NC}" # Change to project directory @@ -28,9 +29,6 @@ if ! command -v conda &> /dev/null; then exit 1 fi -# Source conda -source /home/tw/miniconda3/etc/profile.d/conda.sh - # Check if environment exists if conda env list | grep -q "searchengine"; then echo -e "${GREEN}Environment 'searchengine' already exists${NC}" diff --git a/tests/__init__.py b/tests/__init__.py index 1801088..67819ff 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ """ -SearchEngine测试模块 +saas-search测试模块 提供完整的自动化测试流水线,包括: - 单元测试 diff --git a/third-party/xinference/activate.sh b/third-party/xinference/activate.sh index 5c9413a..ab38170 100755 --- a/third-party/xinference/activate.sh +++ b/third-party/xinference/activate.sh @@ -1,4 +1,5 @@ #!/bin/bash -source /home/tw/miniconda3/etc/profile.d/conda.sh +CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" +source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate xinference diff --git a/third-party/xinference/test.sh b/third-party/xinference/test.sh index f22c096..4a2b4f9 100644 --- a/third-party/xinference/test.sh +++ b/third-party/xinference/test.sh @@ -1,6 +1,7 @@ if [ "$CONDA_DEFAULT_ENV" != "tw" ]; then echo "当前环境不是 tw,正在激活 tw 环境..." - source /home/tw/miniconda3/etc/profile.d/conda.sh + CONDA_ROOT="${CONDA_ROOT:-/home/tw/miniconda3}" + source "$CONDA_ROOT/etc/profile.d/conda.sh" conda activate tw echo "已激活 tw 环境" else -- libgit2 0.21.2