mirror of https://github.com/langgenius/dify.git
add nltk punkt resource (#7063)
This commit is contained in:
parent
34a9dbe826
commit
169cde6c3c
|
@ -55,6 +55,9 @@ ENV VIRTUAL_ENV=/app/api/.venv
|
||||||
COPY --from=packages ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
COPY --from=packages ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
||||||
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
|
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
|
||||||
|
|
||||||
|
# Download nltk data
|
||||||
|
RUN python -c "import nltk; nltk.download('punkt')"
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY . /app/api/
|
COPY . /app/api/
|
||||||
|
|
||||||
|
|
|
@ -159,10 +159,9 @@ class WeightRerankRunner:
|
||||||
if 'score' in document.metadata:
|
if 'score' in document.metadata:
|
||||||
query_vector_scores.append(document.metadata['score'])
|
query_vector_scores.append(document.metadata['score'])
|
||||||
else:
|
else:
|
||||||
content_vector = document.metadata['vector']
|
|
||||||
# transform to NumPy
|
# transform to NumPy
|
||||||
vec1 = np.array(query_vector)
|
vec1 = np.array(query_vector)
|
||||||
vec2 = np.array(document.metadata['vector'])
|
vec2 = np.array(document.vector)
|
||||||
|
|
||||||
# calculate dot product
|
# calculate dot product
|
||||||
dot_product = np.dot(vec1, vec2)
|
dot_product = np.dot(vec1, vec2)
|
||||||
|
|
Loading…
Reference in New Issue