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.

fix nltk averaged_perceptron_tagger download and fix score limit is none (#7582)

Jyong7ae728a9a3bd
diff --git a/api/.idea/vcs.xml b/api/.idea/vcs.xml
index eaa7c25c601..b7af618884a 100644
--- a/api/.idea/vcs.xml
+++ b/api/.idea/vcs.xml
@@ -12,5 +12,6 @@
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
diff --git a/api/Dockerfile b/api/Dockerfile
index 10a3dc2eed4..cca6488679c 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -65,7 +65,7 @@ COPY --from=packages ${VIRTUAL_ENV} ${VIRTUAL_ENV}
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
# Download nltk data
-RUN python -c "import nltk; nltk.download('punkt')"
+RUN python -c "import nltk; nltk.download('punkt'); nltk.download('averaged_perceptron_tagger')"
# Copy source code
COPY . /app/api/
diff --git a/api/core/rag/retrieval/dataset_retrieval.py b/api/core/rag/retrieval/dataset_retrieval.py
index fc6d231f8e0..c970e3dafaa 100644
--- a/api/core/rag/retrieval/dataset_retrieval.py
+++ b/api/core/rag/retrieval/dataset_retrieval.py
@@ -616,6 +616,7 @@ class DatasetRetrieval:
for document in all_documents:
if score_threshold is None or document.metadata['score'] >= score_threshold:
filter_documents.append(document)
+
if not filter_documents:
return []
filter_documents = sorted(filter_documents, key=lambda x: x.metadata['score'], reverse=True)