mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-09 09:46:55 +08:00
fix: MySQL adds SSL configuration
This commit is contained in:
@@ -121,6 +121,7 @@ class DatasourceConf(BaseModel):
|
||||
mode: str = ''
|
||||
timeout: int = 30
|
||||
lowVersion: bool = False
|
||||
ssl: bool = False
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
@@ -136,7 +137,8 @@ class DatasourceConf(BaseModel):
|
||||
"sheets": self.sheets,
|
||||
"mode": self.mode,
|
||||
"timeout": self.timeout,
|
||||
"lowVersion": self.lowVersion
|
||||
"lowVersion": self.lowVersion,
|
||||
"ssl": self.ssl
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -155,7 +155,8 @@ def get_engine(ds: CoreDatasource, timeout: int = 0) -> Engine:
|
||||
elif equals_ignore_case(ds.type, 'oracle'):
|
||||
engine = create_engine(get_uri(ds), poolclass=NullPool)
|
||||
elif equals_ignore_case(ds.type, 'mysql'): # mysql
|
||||
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout, "ssl": {"require": True}}, poolclass=NullPool)
|
||||
ssl_mode = {"require": True} if conf.ssl else None
|
||||
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout, "ssl": ssl_mode}, poolclass=NullPool)
|
||||
else: # ck
|
||||
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout}, poolclass=NullPool)
|
||||
return engine
|
||||
|
||||
@@ -144,6 +144,7 @@ async def mcp_question(session: SessionDep, chat: McpQuestion):
|
||||
in_chat=False, stream=chat.stream)
|
||||
|
||||
|
||||
# Cordys crm
|
||||
@router.post("/mcp_assistant", operation_id="mcp_assistant")
|
||||
async def mcp_assistant(session: SessionDep, chat: McpAssistant):
|
||||
session_user = BaseUserDTO(**{
|
||||
|
||||
Reference in New Issue
Block a user