Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

add nltk punkt resource (#7063)

Jyong169cde6c3cb8
diff --git a/api/Dockerfile b/api/Dockerfile
index adf9173f970..06a6f43631e 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -55,6 +55,9 @@ ENV VIRTUAL_ENV=/app/api/.venv
COPY --from=packages ${VIRTUAL_ENV} ${VIRTUAL_ENV}
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
+# Download nltk data
+RUN python -c "import nltk; nltk.download('punkt')"
+
# Copy source code
COPY . /app/api/
diff --git a/api/core/rag/rerank/weight_rerank.py b/api/core/rag/rerank/weight_rerank.py
index d07f94adb77..d8a78739826 100644
--- a/api/core/rag/rerank/weight_rerank.py
+++ b/api/core/rag/rerank/weight_rerank.py
@@ -159,10 +159,9 @@ class WeightRerankRunner:
if 'score' in document.metadata:
query_vector_scores.append(document.metadata['score'])
else:
- content_vector = document.metadata['vector']
# transform to NumPy
vec1 = np.array(query_vector)
- vec2 = np.array(document.metadata['vector'])
+ vec2 = np.array(document.vector)
# calculate dot product
dot_product = np.dot(vec1, vec2)