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,21 +319,21 @@ def getIPConfig():
|
|||||||
|
|
||||||
|
|
||||||
def open_browser():
|
def open_browser():
|
||||||
|
from easydiffusion.backend_manager import backend
|
||||||
|
|
||||||
config = getConfig()
|
config = getConfig()
|
||||||
ui = config.get("ui", {})
|
ui = config.get("ui", {})
|
||||||
net = config.get("net", {})
|
net = config.get("net", {})
|
||||||
port = net.get("listen_port", 9000)
|
port = net.get("listen_port", 9000)
|
||||||
|
|
||||||
if ui.get("open_browser_on_start", True):
|
|
||||||
import webbrowser
|
|
||||||
|
|
||||||
log.info("Opening browser..")
|
|
||||||
|
|
||||||
webbrowser.open(f"http://localhost:{port}")
|
|
||||||
|
|
||||||
from easydiffusion.backend_manager import backend
|
|
||||||
|
|
||||||
if backend.is_installed():
|
if backend.is_installed():
|
||||||
|
if ui.get("open_browser_on_start", True):
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
log.info("Opening browser..")
|
||||||
|
|
||||||
|
webbrowser.open(f"http://localhost:{port}")
|
||||||
|
|
||||||
Console().print(
|
Console().print(
|
||||||
Panel(
|
Panel(
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -9,6 +9,7 @@ import shutil
|
|||||||
|
|
||||||
from easydiffusion.app import ROOT_DIR, getConfig
|
from easydiffusion.app import ROOT_DIR, getConfig
|
||||||
from easydiffusion.model_manager import get_model_dirs
|
from easydiffusion.model_manager import get_model_dirs
|
||||||
|
from easydiffusion.utils import log
|
||||||
|
|
||||||
from . import impl
|
from . import impl
|
||||||
from .impl import (
|
from .impl import (
|
||||||
@ -100,6 +101,8 @@ def start_backend():
|
|||||||
if not os.path.exists(BACKEND_DIR):
|
if not os.path.exists(BACKEND_DIR):
|
||||||
install_backend()
|
install_backend()
|
||||||
|
|
||||||
|
was_still_installing = not is_installed()
|
||||||
|
|
||||||
if backend_config.get("auto_update", True):
|
if backend_config.get("auto_update", True):
|
||||||
run_in_conda(["git", "add", "-A", "."], cwd=WEBUI_DIR)
|
run_in_conda(["git", "add", "-A", "."], cwd=WEBUI_DIR)
|
||||||
run_in_conda(["git", "stash"], cwd=WEBUI_DIR)
|
run_in_conda(["git", "stash"], cwd=WEBUI_DIR)
|
||||||
@ -124,6 +127,17 @@ def start_backend():
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
impl.ping(timeout=1)
|
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
|
has_started = True
|
||||||
except (TimeoutError, ConnectionError):
|
except (TimeoutError, ConnectionError):
|
||||||
if has_started: # process probably died
|
if has_started: # process probably died
|
||||||
|
Loading…
x
Reference in New Issue
Block a user