added few things

This commit is contained in:
Saifeddine ALOUI 2024-01-08 00:22:03 +01:00
parent c7ebbb1228
commit fc1598a2f5
2 changed files with 22 additions and 11 deletions

View File

@ -29,6 +29,17 @@ lollmsElfServer = LOLLMSElfServer.get_instance()
# ----------------------------------- Settings -----------------------------------------
@router.get("/get_config")
def get_config():
"""
Get the configuration of the Lollms server.
Returns:
Config: The configuration object as a Pydantic model.
"""
return lollmsElfServer.config.to_dict()
@router.post("/update_setting")
async def update_setting(request: Request):
"""
@ -140,3 +151,14 @@ async def apply_settings(request: Request):
trace_exception(ex)
lollmsElfServer.error(ex)
return {"status":False,"error":str(ex)}
@router.post("/save_settings")
def save_settings():
lollmsElfServer.config.save_config()
if lollmsElfServer.config["debug"]:
print("Configuration saved")
# Tell that the setting was changed
lollmsElfServer.socketio.emit('save_settings', {"status":True})
return {"status":True}

View File

@ -34,17 +34,6 @@ def get_version():
return {"version": version}
@router.get("/get_config")
def get_config():
"""
Get the configuration of the Lollms server.
Returns:
Config: The configuration object as a Pydantic model.
"""
return lollmsElfServer.config.to_dict()
@router.get("/get_server_address")
def get_server_address(request:Request):
"""