mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-09 17:57:06 +08:00
perf: Assistant switch online
This commit is contained in:
@@ -35,9 +35,10 @@ def get_assistant_ds(llm_service) -> list[dict]:
|
||||
config: dict[any] = json.loads(configuration)
|
||||
oid: str = config['oid']
|
||||
stmt = select(CoreDatasource.id, CoreDatasource.name, CoreDatasource.description).where(CoreDatasource.oid == oid)
|
||||
private_list:list[int] = config.get('private_list') or None
|
||||
if private_list:
|
||||
stmt.where(~CoreDatasource.id.in_(private_list))
|
||||
if not assistant.online:
|
||||
private_list:list[int] = config.get('private_list') or None
|
||||
if private_list:
|
||||
stmt = stmt.where(~CoreDatasource.id.in_(private_list))
|
||||
db_ds_list = session.exec(stmt)
|
||||
|
||||
result_list = [
|
||||
|
||||
@@ -25,6 +25,9 @@ async def get_current_assistant(request: Request) -> AssistantHeader | None:
|
||||
if request.headers.get("X-SQLBOT-ASSISTANT-CERTIFICATE"):
|
||||
entry_certificate = request.headers['X-SQLBOT-ASSISTANT-CERTIFICATE']
|
||||
base_assistant.certificate = unquote(base64.b64decode(entry_certificate).decode('utf-8'))
|
||||
if request.headers.get("X-SQLBOT-ASSISTANT-ONLINE"):
|
||||
entry_online = request.headers['X-SQLBOT-ASSISTANT-ONLINE']
|
||||
base_assistant.online = str(entry_online).lower() == 'true' if entry_online else False
|
||||
return base_assistant
|
||||
|
||||
CurrentAssistant = Annotated[AssistantHeader, Depends(get_current_assistant)]
|
||||
|
||||
Reference in New Issue
Block a user