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.

delete segment not commit (#309)

Jyong35a2beb1951c
diff --git a/api/tasks/clean_document_task.py b/api/tasks/clean_document_task.py
index 63d66e4ea62..2d8a4fa75e6 100644
--- a/api/tasks/clean_document_task.py
+++ b/api/tasks/clean_document_task.py
@@ -43,7 +43,7 @@ def clean_document_task(document_id: str, dataset_id: str):
for segment in segments:
db.session.delete(segment)
-
+ db.session.commit()
end_at = time.perf_counter()
logging.info(
click.style('Cleaned document when document deleted: {} latency: {}'.format(document_id, end_at - start_at), fg='green'))
diff --git a/api/tasks/document_indexing_update_task.py b/api/tasks/document_indexing_update_task.py
index 493c05505a6..2aa98fb7b7d 100644
--- a/api/tasks/document_indexing_update_task.py
+++ b/api/tasks/document_indexing_update_task.py
@@ -59,7 +59,7 @@ def document_indexing_update_task(dataset_id: str, document_id: str):
for segment in segments:
db.session.delete(segment)
-
+ db.session.commit()
end_at = time.perf_counter()
logging.info(
click.style('Cleaned document when document update data source or process rule: {} latency: {}'.format(document_id, end_at - start_at), fg='green'))