DB-GPT/dbgpt/serve/datasource/api/schemas.py
2024-04-20 09:41:16 +08:00

40 lines
1.6 KiB
Python

from typing import Optional
from dbgpt._private.pydantic import BaseModel, ConfigDict, Field
from ..config import SERVE_APP_NAME_HUMP
class DatasourceServeRequest(BaseModel):
"""name: knowledge space name"""
"""vector_type: vector type"""
id: Optional[int] = Field(None, description="The datasource id")
db_type: str = Field(..., description="Database type, e.g. sqlite, mysql, etc.")
db_name: str = Field(..., description="Database name.")
db_path: str = Field("", description="File path for file-based database.")
db_host: str = Field("", description="Database host.")
db_port: int = Field(0, description="Database port.")
db_user: str = Field("", description="Database user.")
db_pwd: str = Field("", description="Database password.")
comment: str = Field("", description="Comment for the database.")
class DatasourceServeResponse(BaseModel):
"""Flow response model"""
model_config = ConfigDict(title=f"ServeResponse for {SERVE_APP_NAME_HUMP}")
"""name: knowledge space name"""
"""vector_type: vector type"""
id: int = Field(None, description="The datasource id")
db_type: str = Field(..., description="Database type, e.g. sqlite, mysql, etc.")
db_name: str = Field(..., description="Database name.")
db_path: str = Field("", description="File path for file-based database.")
db_host: str = Field("", description="Database host.")
db_port: int = Field(0, description="Database port.")
db_user: str = Field("", description="Database user.")
db_pwd: str = Field("", description="Database password.")
comment: str = Field("", description="Comment for the database.")