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: fix failed test (#33241)

wangxiaolei27f9cdedadd0
diff --git a/api/core/rag/extractor/extract_processor.py b/api/core/rag/extractor/extract_processor.py
index 6d28ce25bc3..449be6a448f 100644
--- a/api/core/rag/extractor/extract_processor.py
+++ b/api/core/rag/extractor/extract_processor.py
@@ -74,7 +74,8 @@ class ExtractProcessor:
else:
suffix = ""
# https://stackoverflow.com/questions/26541416/generate-temporary-file-names-without-creating-actual-file-in-python#comment90414256_26541521
- file_path = f"{temp_dir}/{tempfile.gettempdir()}{suffix}"
+ # Generate a temporary filename under the created temp_dir and ensure the directory exists
+ file_path = f"{temp_dir}/{next(tempfile._get_candidate_names())}{suffix}" # type: ignore
Path(file_path).write_bytes(response.content)
extract_setting = ExtractSetting(datasource_type=DatasourceType.FILE, document_model="text_model")
if return_text:
diff --git a/api/services/human_input_delivery_test_service.py b/api/services/human_input_delivery_test_service.py
index 7b43c496865..80deb37a56f 100644
--- a/api/services/human_input_delivery_test_service.py
+++ b/api/services/human_input_delivery_test_service.py
@@ -245,5 +245,6 @@ class EmailDeliveryTestHandler:
)
if token:
substitutions["form_token"] = token
- substitutions["form_link"] = _build_form_link(token) or ""
+ link = _build_form_link(token)
+ substitutions["form_link"] = link if link is not None else f"/form/{token}"
return substitutions