diff --git a/lollms/server/endpoints/lollms_configuration_infos.py b/lollms/server/endpoints/lollms_configuration_infos.py index 2cb9a34..a4046ab 100644 --- a/lollms/server/endpoints/lollms_configuration_infos.py +++ b/lollms/server/endpoints/lollms_configuration_infos.py @@ -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} \ No newline at end of file diff --git a/lollms/server/endpoints/lollms_infos.py b/lollms/server/endpoints/lollms_infos.py index 3cfbd28..e372bd2 100644 --- a/lollms/server/endpoints/lollms_infos.py +++ b/lollms/server/endpoints/lollms_infos.py @@ -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): """