feat: VECTOR_STORE supports seekdb (#29658)
This commit is contained in:
@@ -107,7 +107,7 @@ class KeywordStoreConfig(BaseSettings):
|
|||||||
|
|
||||||
class DatabaseConfig(BaseSettings):
|
class DatabaseConfig(BaseSettings):
|
||||||
# Database type selector
|
# Database type selector
|
||||||
DB_TYPE: Literal["postgresql", "mysql", "oceanbase"] = Field(
|
DB_TYPE: Literal["postgresql", "mysql", "oceanbase", "seekdb"] = Field(
|
||||||
description="Database type to use. OceanBase is MySQL-compatible.",
|
description="Database type to use. OceanBase is MySQL-compatible.",
|
||||||
default="postgresql",
|
default="postgresql",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ def _get_retrieval_methods_by_vector_type(vector_type: str | None, is_mock: bool
|
|||||||
VectorType.COUCHBASE,
|
VectorType.COUCHBASE,
|
||||||
VectorType.OPENGAUSS,
|
VectorType.OPENGAUSS,
|
||||||
VectorType.OCEANBASE,
|
VectorType.OCEANBASE,
|
||||||
|
VectorType.SEEKDB,
|
||||||
VectorType.TABLESTORE,
|
VectorType.TABLESTORE,
|
||||||
VectorType.HUAWEI_CLOUD,
|
VectorType.HUAWEI_CLOUD,
|
||||||
VectorType.TENCENT,
|
VectorType.TENCENT,
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ class Vector:
|
|||||||
from core.rag.datasource.vdb.lindorm.lindorm_vector import LindormVectorStoreFactory
|
from core.rag.datasource.vdb.lindorm.lindorm_vector import LindormVectorStoreFactory
|
||||||
|
|
||||||
return LindormVectorStoreFactory
|
return LindormVectorStoreFactory
|
||||||
case VectorType.OCEANBASE:
|
case VectorType.OCEANBASE | VectorType.SEEKDB:
|
||||||
from core.rag.datasource.vdb.oceanbase.oceanbase_vector import OceanBaseVectorFactory
|
from core.rag.datasource.vdb.oceanbase.oceanbase_vector import OceanBaseVectorFactory
|
||||||
|
|
||||||
return OceanBaseVectorFactory
|
return OceanBaseVectorFactory
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class VectorType(StrEnum):
|
|||||||
UPSTASH = "upstash"
|
UPSTASH = "upstash"
|
||||||
TIDB_ON_QDRANT = "tidb_on_qdrant"
|
TIDB_ON_QDRANT = "tidb_on_qdrant"
|
||||||
OCEANBASE = "oceanbase"
|
OCEANBASE = "oceanbase"
|
||||||
|
SEEKDB = "seekdb"
|
||||||
OPENGAUSS = "opengauss"
|
OPENGAUSS = "opengauss"
|
||||||
TABLESTORE = "tablestore"
|
TABLESTORE = "tablestore"
|
||||||
HUAWEI_CLOUD = "huawei_cloud"
|
HUAWEI_CLOUD = "huawei_cloud"
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ def timezone(timezone_string):
|
|||||||
def convert_datetime_to_date(field, target_timezone: str = ":tz"):
|
def convert_datetime_to_date(field, target_timezone: str = ":tz"):
|
||||||
if dify_config.DB_TYPE == "postgresql":
|
if dify_config.DB_TYPE == "postgresql":
|
||||||
return f"DATE(DATE_TRUNC('day', {field} AT TIME ZONE 'UTC' AT TIME ZONE {target_timezone}))"
|
return f"DATE(DATE_TRUNC('day', {field} AT TIME ZONE 'UTC' AT TIME ZONE {target_timezone}))"
|
||||||
elif dify_config.DB_TYPE == "mysql":
|
elif dify_config.DB_TYPE in ["mysql", "oceanbase", "seekdb"]:
|
||||||
return f"DATE(CONVERT_TZ({field}, 'UTC', {target_timezone}))"
|
return f"DATE(CONVERT_TZ({field}, 'UTC', {target_timezone}))"
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(f"Unsupported database type: {dify_config.DB_TYPE}")
|
raise NotImplementedError(f"Unsupported database type: {dify_config.DB_TYPE}")
|
||||||
|
|||||||
Reference in New Issue
Block a user