mirror of
https://github.com/open-webui/open-webui
synced 2025-02-23 21:53:37 +00:00
refac
This commit is contained in:
parent
8daa549146
commit
689317c5b5
@ -41,20 +41,22 @@ async def export_config(user=Depends(get_admin_user)):
|
|||||||
############################
|
############################
|
||||||
|
|
||||||
|
|
||||||
class DirectAPIConfigForm(BaseModel):
|
class DirectConnectionsConfigForm(BaseModel):
|
||||||
ENABLE_DIRECT_CONNECTIONS: bool
|
ENABLE_DIRECT_CONNECTIONS: bool
|
||||||
|
|
||||||
|
|
||||||
@router.get("/direct_connections", response_model=DirectAPIConfigForm)
|
@router.get("/direct_connections", response_model=DirectConnectionsConfigForm)
|
||||||
async def get_direct_connections_config(request: Request, user=Depends(get_admin_user)):
|
async def get_direct_connections_config(request: Request, user=Depends(get_admin_user)):
|
||||||
return {
|
return {
|
||||||
"ENABLE_DIRECT_CONNECTIONS": request.app.state.config.ENABLE_DIRECT_CONNECTIONS,
|
"ENABLE_DIRECT_CONNECTIONS": request.app.state.config.ENABLE_DIRECT_CONNECTIONS,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@router.post("/direct_connections", response_model=DirectAPIConfigForm)
|
@router.post("/direct_connections", response_model=DirectConnectionsConfigForm)
|
||||||
async def set_direct_connections_config(
|
async def set_direct_connections_config(
|
||||||
request: Request, form_data: DirectAPIConfigForm, user=Depends(get_admin_user)
|
request: Request,
|
||||||
|
form_data: DirectConnectionsConfigForm,
|
||||||
|
user=Depends(get_admin_user),
|
||||||
):
|
):
|
||||||
request.app.state.config.ENABLE_DIRECT_CONNECTIONS = (
|
request.app.state.config.ENABLE_DIRECT_CONNECTIONS = (
|
||||||
form_data.ENABLE_DIRECT_CONNECTIONS
|
form_data.ENABLE_DIRECT_CONNECTIONS
|
||||||
|
Loading…
Reference in New Issue
Block a user