- 创建 download_sparse_model.py 脚本用于下载稀疏模型到本地 - 添加 SPARSE_MODEL_PATH 和 SPARSE_MODEL_NAME 配置 - 修改 retriever.py 和 index_builder.py 使用 cache_dir - 更新 .gitignore 排除 models/ 目录 - 更新 Dockerfile 在构建时下载稀疏模型
This commit is contained in:
@@ -50,6 +50,12 @@ ENV BACKEND_PORT=8079
|
||||
ENV MEMORY_SUMMARIZE_INTERVAL=10
|
||||
ENV ENABLE_GRAPH_TRACE=false
|
||||
|
||||
# =============================================================================
|
||||
# 稀疏模型配置
|
||||
# =============================================================================
|
||||
ENV SPARSE_MODEL_PATH=/app/models/sparse
|
||||
ENV SPARSE_MODEL_NAME=Qdrant/bm25
|
||||
|
||||
# =============================================================================
|
||||
# 日志配置(生产环境默认值)
|
||||
# =============================================================================
|
||||
@@ -74,6 +80,14 @@ RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
COPY backend/requirements.txt .
|
||||
RUN pip install --no-cache-dir --default-timeout=300 -r requirements.txt
|
||||
|
||||
# =============================================================================
|
||||
# 下载稀疏模型(关键步骤:在构建阶段下载到固定目录)
|
||||
# =============================================================================
|
||||
RUN mkdir -p /app/models/sparse
|
||||
COPY download_sparse_model.py .
|
||||
RUN python download_sparse_model.py --cache-dir /app/models/sparse --model-name Qdrant/bm25 && \
|
||||
rm -f download_sparse_model.py
|
||||
|
||||
# =============================================================================
|
||||
# 复制项目代码
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user