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) #webbrowser.open(f"http://{config['host']}:{6523}") # needed for debug (to be removed in production)
uvicorn.run(app, host=config.host, port=config.port) 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: except Exception as ex:
trace_exception(ex) trace_exception(ex)

View File

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

View File

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

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