mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-19 17:39:16 +02:00
Don't open the browser while webui is still installing. wait until the webui actually starts up.
This commit is contained in:
parent
05cf4be89b
commit
dfa552585e
@ -319,11 +319,14 @@ def getIPConfig():
|
||||
|
||||
|
||||
def open_browser():
|
||||
from easydiffusion.backend_manager import backend
|
||||
|
||||
config = getConfig()
|
||||
ui = config.get("ui", {})
|
||||
net = config.get("net", {})
|
||||
port = net.get("listen_port", 9000)
|
||||
|
||||
if backend.is_installed():
|
||||
if ui.get("open_browser_on_start", True):
|
||||
import webbrowser
|
||||
|
||||
@ -331,9 +334,6 @@ def open_browser():
|
||||
|
||||
webbrowser.open(f"http://localhost:{port}")
|
||||
|
||||
from easydiffusion.backend_manager import backend
|
||||
|
||||
if backend.is_installed():
|
||||
Console().print(
|
||||
Panel(
|
||||
"\n"
|
||||
|
@ -9,6 +9,7 @@ import shutil
|
||||
|
||||
from easydiffusion.app import ROOT_DIR, getConfig
|
||||
from easydiffusion.model_manager import get_model_dirs
|
||||
from easydiffusion.utils import log
|
||||
|
||||
from . import impl
|
||||
from .impl import (
|
||||
@ -100,6 +101,8 @@ def start_backend():
|
||||
if not os.path.exists(BACKEND_DIR):
|
||||
install_backend()
|
||||
|
||||
was_still_installing = not is_installed()
|
||||
|
||||
if backend_config.get("auto_update", True):
|
||||
run_in_conda(["git", "add", "-A", "."], cwd=WEBUI_DIR)
|
||||
run_in_conda(["git", "stash"], cwd=WEBUI_DIR)
|
||||
@ -124,6 +127,17 @@ def start_backend():
|
||||
while True:
|
||||
try:
|
||||
impl.ping(timeout=1)
|
||||
|
||||
if was_still_installing and not has_started: # first start
|
||||
ui = config.get("ui", {})
|
||||
|
||||
if ui.get("open_browser_on_start", True):
|
||||
import webbrowser
|
||||
|
||||
log.info("Opening browser..")
|
||||
|
||||
webbrowser.open(f"http://localhost:{port}")
|
||||
|
||||
has_started = True
|
||||
except (TimeoutError, ConnectionError):
|
||||
if has_started: # process probably died
|
||||
|
Loading…
x
Reference in New Issue
Block a user