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: notion_indexing_estimate embedding_model_instance NPE (#1907)

takatosta938e1f184f4
diff --git a/api/core/indexing_runner.py b/api/core/indexing_runner.py
index 1c87432c4cd..f4ccb7d7658 100644
--- a/api/core/indexing_runner.py
+++ b/api/core/indexing_runner.py
@@ -382,13 +382,15 @@ class IndexingRunner:
)
total_segments += len(documents)
- embedding_model_type_instance = embedding_model_instance.model_type_instance
- embedding_model_type_instance = cast(TextEmbeddingModel, embedding_model_type_instance)
+ embedding_model_type_instance = None
+ if embedding_model_instance:
+ embedding_model_type_instance = embedding_model_instance.model_type_instance
+ embedding_model_type_instance = cast(TextEmbeddingModel, embedding_model_type_instance)
for document in documents:
if len(preview_texts) < 5:
preview_texts.append(document.page_content)
- if indexing_technique == 'high_quality' or embedding_model_instance:
+ if indexing_technique == 'high_quality' and embedding_model_type_instance:
tokens += embedding_model_type_instance.get_num_tokens(
model=embedding_model_instance.model,
credentials=embedding_model_instance.credentials,