diff --git a/api/configs/middleware/vdb/tidb_on_qdrant_config.py b/api/configs/middleware/vdb/tidb_on_qdrant_config.py index 98268798ef..d2625af264 100644 --- a/api/configs/middleware/vdb/tidb_on_qdrant_config.py +++ b/api/configs/middleware/vdb/tidb_on_qdrant_config.py @@ -63,3 +63,8 @@ class TidbOnQdrantConfig(BaseSettings): description="Tidb project id", default=None, ) + + TIDB_SPEND_LIMIT: Optional[int] = Field( + description="Tidb spend limit", + default=100, + ) diff --git a/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py b/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py index f10d6339ee..0cd2a46460 100644 --- a/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py +++ b/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py @@ -4,6 +4,7 @@ import uuid import requests from requests.auth import HTTPDigestAuth +from configs import dify_config from extensions.ext_database import db from extensions.ext_redis import redis_client from models.dataset import TidbAuthBinding @@ -208,7 +209,7 @@ class TidbService: } spending_limit = { - "monthly": 10, + "monthly": dify_config.TIDB_SPEND_LIMIT, } password = str(uuid.uuid4()).replace("-", "")[:16] display_name = str(uuid.uuid4()).replace("-", "")