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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
[Lindorm VDB] Add the QUERY_TIMEOUT parameter to force the search query to fail. (#18613)
Jiang37e2f7390911
diff --git a/api/.env.example b/api/.env.exampleindex b5820fcdc27..2cc6410cdde 100644--- a/api/.env.example+++ b/api/.env.example@@ -297,6 +297,7 @@ LINDORM_URL=http://ld-*******************-proxy-search-pub.lindorm.aliyuncs.com:LINDORM_USERNAME=adminLINDORM_PASSWORD=adminUSING_UGC_INDEX=False+LINDORM_QUERY_TIMEOUT=1# OceanBase Vector configurationOCEANBASE_VECTOR_HOST=127.0.0.1diff --git a/api/configs/middleware/vdb/lindorm_config.py b/api/configs/middleware/vdb/lindorm_config.pyindex 95e1d1cfca4..e80e3f4a35c 100644--- a/api/configs/middleware/vdb/lindorm_config.py+++ b/api/configs/middleware/vdb/lindorm_config.py@@ -32,3 +32,4 @@ class LindormConfig(BaseSettings):description="Using UGC index will store the same type of Index in a single index but can retrieve separately.",default=False,)+ LINDORM_QUERY_TIMEOUT: Optional[float] = Field(description="The lindorm search request timeout (s)", default=2.0)diff --git a/api/core/rag/datasource/vdb/lindorm/lindorm_vector.py b/api/core/rag/datasource/vdb/lindorm/lindorm_vector.pyindex 643ac2df4eb..e9ff1ce43d5 100644--- a/api/core/rag/datasource/vdb/lindorm/lindorm_vector.py+++ b/api/core/rag/datasource/vdb/lindorm/lindorm_vector.py@@ -32,6 +32,7 @@ class LindormVectorStoreConfig(BaseModel):username: Optional[str] = Nonepassword: Optional[str] = Noneusing_ugc: Optional[bool] = False+ request_timeout: Optional[float] = 1.0 # timeout units: s@model_validator(mode="before")@classmethod@@ -251,9 +252,9 @@ class LindormVectorStore(BaseVector):query = default_vector_search_query(query_vector=query_vector, k=top_k, filters=filters, **kwargs)try:- params = {}+ params = {"timeout": self._client_config.request_timeout}if self._using_ugc:- params["routing"] = self._routing+ params["routing"] = self._routing # type: ignoreresponse = self._client.search(index=self._collection_name, body=query, params=params)except Exception:logger.exception(f"Error executing vector search, query: {query}")@@ -304,8 +305,8 @@ class LindormVectorStore(BaseVector):routing=routing,routing_field=self._routing_field,)-- response = self._client.search(index=self._collection_name, body=full_text_query)+ params = {"timeout": self._client_config.request_timeout}+ response = self._client.search(index=self._collection_name, body=full_text_query, params=params)docs = []for hit in response["hits"]["hits"]:docs.append(@@ -554,6 +555,7 @@ class LindormVectorStoreFactory(AbstractVectorFactory):username=dify_config.LINDORM_USERNAME,password=dify_config.LINDORM_PASSWORD,using_ugc=dify_config.USING_UGC_INDEX,+ request_timeout=dify_config.LINDORM_QUERY_TIMEOUT,)using_ugc = dify_config.USING_UGC_INDEXif using_ugc is None:diff --git a/docker/.env.example b/docker/.env.exampleindex 102aba3e8df..5c5ee4b5486 100644--- a/docker/.env.example+++ b/docker/.env.example@@ -562,6 +562,7 @@ VIKINGDB_SOCKET_TIMEOUT=30LINDORM_URL=http://lindorm:30070LINDORM_USERNAME=lindormLINDORM_PASSWORD=lindorm+LINDORM_QUERY_TIMEOUT=1# OceanBase Vector configuration, only available when VECTOR_STORE is `oceanbase`OCEANBASE_VECTOR_HOST=oceanbasediff --git a/docker/docker-compose.yaml b/docker/docker-compose.yamlindex eb1a13f8190..c8b7a006e90 100644--- a/docker/docker-compose.yaml+++ b/docker/docker-compose.yaml@@ -257,6 +257,7 @@ x-shared-env: &shared-api-worker-envLINDORM_URL: ${LINDORM_URL:-http://lindorm:30070}LINDORM_USERNAME: ${LINDORM_USERNAME:-lindorm}LINDORM_PASSWORD: ${LINDORM_PASSWORD:-lindorm}+ LINDORM_QUERY_TIMEOUT: ${LINDORM_QUERY_TIMEOUT:-1}OCEANBASE_VECTOR_HOST: ${OCEANBASE_VECTOR_HOST:-oceanbase}OCEANBASE_VECTOR_PORT: ${OCEANBASE_VECTOR_PORT:-2881}OCEANBASE_VECTOR_USER: ${OCEANBASE_VECTOR_USER:-root@test}