File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 66 BeforeValidator ,
77 PostgresDsn ,
88 computed_field ,
9+ field_validator
910)
1011from pydantic_core import MultiHostUrl
1112from pydantic_settings import BaseSettings , SettingsConfigDict
@@ -113,5 +114,23 @@ def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn | str:
113114
114115 ORACLE_CLIENT_PATH : str = '/opt/sqlbot/db_client/oracle_instant_client'
115116
117+ @field_validator ('SQL_DEBUG' ,
118+ 'EMBEDDING_ENABLED' ,
119+ 'GENERATE_SQL_QUERY_LIMIT_ENABLED' ,
120+ 'PARSE_REASONING_BLOCK_ENABLED' ,
121+ 'PG_POOL_PRE_PING' ,
122+ 'TABLE_EMBEDDING_ENABLED' ,
123+ mode = 'before' )
124+ @classmethod
125+ def lowercase_bool (cls , v : Any ) -> Any :
126+ """将字符串形式的布尔值转换为Python布尔值"""
127+ if isinstance (v , str ):
128+ v_lower = v .lower ().strip ()
129+ if v_lower == 'true' :
130+ return True
131+ elif v_lower == 'false' :
132+ return False
133+ return v
134+
116135
117136settings = Settings () # type: ignore
You can’t perform that action at this time.
0 commit comments