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.

add qdrant client timeout limit (#1894)

Jyong5ca4c4a44d45
diff --git a/api/config.py b/api/config.py
index 290c9c7b798..e14e8abfe8e 100644
--- a/api/config.py
+++ b/api/config.py
@@ -197,6 +197,7 @@ class Config:
# qdrant settings
self.QDRANT_URL = get_env('QDRANT_URL')
self.QDRANT_API_KEY = get_env('QDRANT_API_KEY')
+ self.QDRANT_CLIENT_TIMEOUT = get_env('QDRANT_CLIENT_TIMEOUT')
# milvus / zilliz setting
self.MILVUS_HOST = get_env('MILVUS_HOST')
diff --git a/api/core/index/vector_index/qdrant_vector_index.py b/api/core/index/vector_index/qdrant_vector_index.py
index fdb0b49bb1c..e797134036e 100644
--- a/api/core/index/vector_index/qdrant_vector_index.py
+++ b/api/core/index/vector_index/qdrant_vector_index.py
@@ -18,6 +18,7 @@ from models.dataset import Dataset, DatasetCollectionBinding
class QdrantConfig(BaseModel):
endpoint: str
api_key: Optional[str]
+ timeout: float = 20
root_path: Optional[str]
def to_qdrant_params(self):
@@ -33,6 +34,7 @@ class QdrantConfig(BaseModel):
return {
'url': self.endpoint,
'api_key': self.api_key,
+ 'timeout': self.timeout
}
diff --git a/api/core/index/vector_index/vector_index.py b/api/core/index/vector_index/vector_index.py
index 614f23a2912..fe93fad1103 100644
--- a/api/core/index/vector_index/vector_index.py
+++ b/api/core/index/vector_index/vector_index.py
@@ -49,7 +49,8 @@ class VectorIndex:
config=QdrantConfig(
endpoint=config.get('QDRANT_URL'),
api_key=config.get('QDRANT_API_KEY'),
- root_path=current_app.root_path
+ root_path=current_app.root_path,
+ timeout=config.get('QDRANT_CLIENT_TIMEOUT')
),
embeddings=embeddings
)