[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2026-04-14 08:27:24 +00:00 committed by GitHub
parent 99ef50e6f0
commit d13bb0d9d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 19 deletions

View File

@ -24,9 +24,7 @@ _tidb_http_client: httpx.Client = get_pooled_http_client(
class TidbService: class TidbService:
@staticmethod @staticmethod
def fetch_qdrant_endpoint( def fetch_qdrant_endpoint(api_url: str, public_key: str, private_key: str, cluster_id: str) -> str | None:
api_url: str, public_key: str, private_key: str, cluster_id: str
) -> str | None:
"""Fetch the qdrant endpoint for a cluster by calling the Get Cluster API. """Fetch the qdrant endpoint for a cluster by calling the Get Cluster API.
The Get Cluster response contains ``status.connection_strings.standard.host`` The Get Cluster response contains ``status.connection_strings.standard.host``
@ -34,9 +32,7 @@ class TidbService:
as an ``https://`` URL. as an ``https://`` URL.
""" """
try: try:
cluster_response = TidbService.get_tidb_serverless_cluster( cluster_response = TidbService.get_tidb_serverless_cluster(api_url, public_key, private_key, cluster_id)
api_url, public_key, private_key, cluster_id
)
if not cluster_response: if not cluster_response:
return None return None
# v1beta: status.connection_strings.standard.host # v1beta: status.connection_strings.standard.host
@ -100,9 +96,7 @@ class TidbService:
cluster_response = TidbService.get_tidb_serverless_cluster(api_url, public_key, private_key, cluster_id) cluster_response = TidbService.get_tidb_serverless_cluster(api_url, public_key, private_key, cluster_id)
if cluster_response["state"] == "ACTIVE": if cluster_response["state"] == "ACTIVE":
user_prefix = cluster_response["userPrefix"] user_prefix = cluster_response["userPrefix"]
qdrant_endpoint = TidbService.fetch_qdrant_endpoint( qdrant_endpoint = TidbService.fetch_qdrant_endpoint(api_url, public_key, private_key, cluster_id)
api_url, public_key, private_key, cluster_id
)
return { return {
"cluster_id": cluster_id, "cluster_id": cluster_id,
"cluster_name": display_name, "cluster_name": display_name,

View File

@ -468,7 +468,9 @@ class TidbOnQdrantVectorFactory(AbstractVectorFactory):
else: else:
TIDB_ON_QDRANT_API_KEY = f"{tidb_auth_binding.account}:{tidb_auth_binding.password}" TIDB_ON_QDRANT_API_KEY = f"{tidb_auth_binding.account}:{tidb_auth_binding.password}"
qdrant_url = (tidb_auth_binding.qdrant_endpoint if tidb_auth_binding else None) or dify_config.TIDB_ON_QDRANT_URL or "" qdrant_url = (
(tidb_auth_binding.qdrant_endpoint if tidb_auth_binding else None) or dify_config.TIDB_ON_QDRANT_URL or ""
)
if dataset.index_struct_dict: if dataset.index_struct_dict:
class_prefix: str = dataset.index_struct_dict["vector_store"]["class_prefix"] class_prefix: str = dataset.index_struct_dict["vector_store"]["class_prefix"]

View File

@ -24,9 +24,7 @@ _tidb_http_client: httpx.Client = get_pooled_http_client(
class TidbService: class TidbService:
@staticmethod @staticmethod
def fetch_qdrant_endpoint( def fetch_qdrant_endpoint(api_url: str, public_key: str, private_key: str, cluster_id: str) -> str | None:
api_url: str, public_key: str, private_key: str, cluster_id: str
) -> str | None:
"""Fetch the qdrant endpoint for a cluster by calling the Get Cluster API. """Fetch the qdrant endpoint for a cluster by calling the Get Cluster API.
The Get Cluster response contains ``status.connection_strings.standard.host`` The Get Cluster response contains ``status.connection_strings.standard.host``
@ -34,9 +32,7 @@ class TidbService:
as an ``https://`` URL. as an ``https://`` URL.
""" """
try: try:
cluster_response = TidbService.get_tidb_serverless_cluster( cluster_response = TidbService.get_tidb_serverless_cluster(api_url, public_key, private_key, cluster_id)
api_url, public_key, private_key, cluster_id
)
if not cluster_response: if not cluster_response:
return None return None
# v1beta: status.connection_strings.standard.host # v1beta: status.connection_strings.standard.host
@ -100,9 +96,7 @@ class TidbService:
cluster_response = TidbService.get_tidb_serverless_cluster(api_url, public_key, private_key, cluster_id) cluster_response = TidbService.get_tidb_serverless_cluster(api_url, public_key, private_key, cluster_id)
if cluster_response["state"] == "ACTIVE": if cluster_response["state"] == "ACTIVE":
user_prefix = cluster_response["userPrefix"] user_prefix = cluster_response["userPrefix"]
qdrant_endpoint = TidbService.fetch_qdrant_endpoint( qdrant_endpoint = TidbService.fetch_qdrant_endpoint(api_url, public_key, private_key, cluster_id)
api_url, public_key, private_key, cluster_id
)
return { return {
"cluster_id": cluster_id, "cluster_id": cluster_id,
"cluster_name": display_name, "cluster_name": display_name,