diff --git a/scripts/on_env_start.bat b/scripts/on_env_start.bat index 0871973f..43f7e2b7 100644 --- a/scripts/on_env_start.bat +++ b/scripts/on_env_start.bat @@ -68,6 +68,7 @@ if "%update_branch%"=="" ( @copy sd-ui-files\scripts\on_sd_start.bat scripts\ /Y @copy sd-ui-files\scripts\check_modules.py scripts\ /Y @copy sd-ui-files\scripts\get_config.py scripts\ /Y +@copy sd-ui-files\scripts\config.yaml.sample scripts\ /Y @copy "sd-ui-files\scripts\Start Stable Diffusion UI.cmd" . /Y @copy "sd-ui-files\scripts\Developer Console.cmd" . /Y diff --git a/scripts/on_env_start.sh b/scripts/on_env_start.sh index d936924e..02428ce5 100755 --- a/scripts/on_env_start.sh +++ b/scripts/on_env_start.sh @@ -51,6 +51,7 @@ cp sd-ui-files/scripts/on_sd_start.sh scripts/ cp sd-ui-files/scripts/bootstrap.sh scripts/ cp sd-ui-files/scripts/check_modules.py scripts/ cp sd-ui-files/scripts/get_config.py scripts/ +cp sd-ui-files/scripts/config.yaml.sample scripts/ cp sd-ui-files/scripts/start.sh . cp sd-ui-files/scripts/developer_console.sh . cp sd-ui-files/scripts/functions.sh scripts/ diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index 860361d4..3a8a2961 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -6,6 +6,7 @@ @copy sd-ui-files\scripts\on_env_start.bat scripts\ /Y @copy sd-ui-files\scripts\check_modules.py scripts\ /Y @copy sd-ui-files\scripts\get_config.py scripts\ /Y +@copy sd-ui-files\scripts\config.yaml.sample scripts\ /Y if exist "%cd%\profile" ( set HF_HOME=%cd%\profile\.cache\huggingface diff --git a/scripts/on_sd_start.sh b/scripts/on_sd_start.sh index be5161d4..e54c72bc 100755 --- a/scripts/on_sd_start.sh +++ b/scripts/on_sd_start.sh @@ -5,6 +5,7 @@ cp sd-ui-files/scripts/on_env_start.sh scripts/ cp sd-ui-files/scripts/bootstrap.sh scripts/ cp sd-ui-files/scripts/check_modules.py scripts/ cp sd-ui-files/scripts/get_config.py scripts/ +cp sd-ui-files/scripts/config.yaml.sample scripts/ source ./scripts/functions.sh diff --git a/ui/easydiffusion/app.py b/ui/easydiffusion/app.py index a098a554..8350ce8d 100644 --- a/ui/easydiffusion/app.py +++ b/ui/easydiffusion/app.py @@ -145,6 +145,18 @@ def setConfig(config): try: # config.yaml config_yaml_path = os.path.join(CONFIG_DIR, "config.yaml") yaml = YAML() + + if not hasattr(config, "_yaml_comment"): + config_yaml_sample_path = os.path.join(CONFIG_DIR, "config.yaml.sample") + + if os.path.exists(config_yaml_sample_path): + with open(config_yaml_sample_path, "r", encoding="utf-8") as f: + commented_config = yaml.load(f) + + for k in config: + commented_config[k] = config[k] + + config = commented_config yaml.indent(mapping=2, sequence=4, offset=2) with open(config_yaml_path, "w", encoding="utf-8") as f: yaml.dump(config, f)