This commit is contained in:
saloui 2024-01-24 12:08:07 +01:00
parent c8b5dc815b
commit 164239936f
4 changed files with 42 additions and 41 deletions

13
app.py
View File

@ -175,18 +175,7 @@ if __name__ == "__main__":
#webbrowser.open(f"http://{config['host']}:{6523}") # needed for debug (to be removed in production)
uvicorn.run(app, host=config.host, port=config.port)
if sio.reboot:
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info(" ╔══════════════════════════════════════════════════╗")
ASCIIColors.info(" ║ Restarting backend ║")
ASCIIColors.info(" ╚══════════════════════════════════════════════════╝")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
lollmsElfServer.run_restart_script(args)
except Exception as ex:
trace_exception(ex)

View File

@ -34,36 +34,47 @@ async def get_lollms_webui_version():
@router.get("/restart_program")
async def restart_program():
"""Restart the program."""
# Stop the socketIO server
run_async(lollmsElfServer.sio.shutdown)
# Sleep for 1 second before rebooting
time.sleep(1)
# Reboot the program
lollmsElfServer.sio.reboot = True
"""Restart the program."""
lollmsElfServer.ShowBlockingMessage("Restarting program.\nPlease stand by...")
# Stop the socketIO server
run_async(lollmsElfServer.sio.shutdown)
# Sleep for 1 second before rebooting
time.sleep(1)
lollmsElfServer.HideBlockingMessage()
# Reboot the program
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info(" ╔══════════════════════════════════════════════════╗")
ASCIIColors.info(" ║ Restarting backend ║")
ASCIIColors.info(" ╚══════════════════════════════════════════════════╝")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
lollmsElfServer.run_restart_script(lollmsElfServer.args)
@router.get("/update_software")
async def update_software():
"""Update the software."""
# Display an informative message
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("╔══════════════════════════════════════════════════╗")
ASCIIColors.info("║ Updating backend ║")
ASCIIColors.info("╚══════════════════════════════════════════════════╝")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
# Stop the socketIO server
await lollmsElfServer.sio.shutdown()
# Sleep for 1 second before rebooting
time.sleep(1)
"""Update the software."""
# Display an informative message
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("╔══════════════════════════════════════════════════╗")
ASCIIColors.info("║ Updating backend ║")
ASCIIColors.info("╚══════════════════════════════════════════════════╝")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
# Stop the socketIO server
await lollmsElfServer.sio.shutdown()
# Sleep for 1 second before rebooting
time.sleep(1)
# Run the update script using the provided arguments
lollmsElfServer.run_update_script(lollmsElfServer.args)
# Exit the program after successful update
sys.exit()
# Run the update script using the provided arguments
lollmsElfServer.run_update_script(lollmsElfServer.args)
# Exit the program after successful update
sys.exit()
@router.get("/check_update")

View File

@ -106,8 +106,9 @@ async def text2Audio(request: Request):
@router.get("/install_xtts")
def install_xtts():
try:
from lollms.services.xtts.lollms_xtts import install_xtts
lollmsElfServer.ShowBlockingMessage("Installing xTTS api server\nPlease stand by")
PackageManager.install_package("xtts-api-server")
install_xtts(lollmsElfServer)
lollmsElfServer.HideBlockingMessage()
return {"status":True}
except Exception as ex:

@ -1 +1 @@
Subproject commit 1e1fd5444c92e4e5dccd93061c01cbe677f30404
Subproject commit f4e5aa3d7af0cd20f3af69fa1fae16bbe0342f2f