Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions backend/common/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
BeforeValidator,
PostgresDsn,
computed_field,
field_validator
)
from pydantic_core import MultiHostUrl
from pydantic_settings import BaseSettings, SettingsConfigDict
Expand Down Expand Up @@ -113,5 +114,23 @@ def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn | str:

ORACLE_CLIENT_PATH: str = '/opt/sqlbot/db_client/oracle_instant_client'

@field_validator('SQL_DEBUG',
'EMBEDDING_ENABLED',
'GENERATE_SQL_QUERY_LIMIT_ENABLED',
'PARSE_REASONING_BLOCK_ENABLED',
'PG_POOL_PRE_PING',
'TABLE_EMBEDDING_ENABLED',
mode='before')
@classmethod
def lowercase_bool(cls, v: Any) -> Any:
"""将字符串形式的布尔值转换为Python布尔值"""
if isinstance(v, str):
v_lower = v.lower().strip()
if v_lower == 'true':
return True
elif v_lower == 'false':
return False
return v


settings = Settings() # type: ignore