Merge branch 'develop' of http://47.106.207.27:3000/AI260626/Mutual_Fund into develop_feature_customer
# Conflicts: # .gitignore # api/deps.py # api/router.py # main.py # tests/test_customer_agent_router.py # tests/test_knowledge_router.py
This commit is contained in:
@@ -34,6 +34,16 @@ def client() -> AsyncMilvusClient:
|
||||
return _client
|
||||
|
||||
|
||||
async def ensure_database(milvus_client: AsyncMilvusClient | None = None) -> None:
|
||||
"""Create the configured project database only when it does not exist."""
|
||||
target = milvus_client or client()
|
||||
database_name = settings.milvus.db_name
|
||||
if not database_name:
|
||||
raise RuntimeError("MILVUS_DB must be configured")
|
||||
if database_name not in await target.list_databases():
|
||||
await target.create_database(database_name)
|
||||
|
||||
|
||||
async def init_db() -> None:
|
||||
client() # 急切建连;失败由注册表重试(config/database/__init__.py)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user