use config.json instead of config.bat

This commit is contained in:
JeLuF 2023-01-10 23:40:35 +01:00
parent d5e76e662f
commit 192fd223b4
2 changed files with 6 additions and 5 deletions

View File

@ -37,7 +37,7 @@ CORE_UI_PLUGINS_DIR = os.path.abspath(os.path.join(SD_UI_DIR, 'plugins', 'ui'))
UI_PLUGINS_SOURCES = ((CORE_UI_PLUGINS_DIR, 'core'), (USER_UI_PLUGINS_DIR, 'user'))
OUTPUT_DIRNAME = "Stable Diffusion UI" # in the user's home folder
PRESERVE_CONFIG_VARS = ['FORCE_SAVE_PATH', 'FORCE_FULL_PRECISION']
PRESERVE_CONFIG_VARS = ['FORCE_FULL_PRECISION']
TASK_TTL = 15 * 60 # Discard last session's task timeout
APP_CONFIG_DEFAULTS = {
# auto: selects the cuda device with the most free memory, cuda: use the currently active cuda device.

View File

@ -128,13 +128,13 @@ def read_web_data_internal(key:str=None):
elif key == 'system_info':
config = app.getConfig()
output_dir = os.path.join(os.path.expanduser("~"), app.OUTPUT_DIRNAME) if os.getenv('FORCE_SAVE_PATH') is None else os.getenv('FORCE_SAVE_PATH')
output_dir = config.get('force_save_path', os.path.join(os.path.expanduser("~"), app.OUTPUT_DIRNAME))
system_info = {
'devices': task_manager.get_devices(),
'hosts': app.getIPConfig(),
'default_output_dir': output_dir,
'enforce_output_dir': (os.getenv('FORCE_SAVE_PATH') is not None),
'enforce_output_dir': ('force_save_path' in config),
}
system_info['devices']['config'] = config.get('render_devices', "auto")
return JSONResponse(system_info, headers=NOCACHE_HEADERS)
@ -165,8 +165,9 @@ def render_internal(req: dict):
task_data: TaskData = TaskData.parse_obj(req)
# Overwrite user specified save path
if os.getenv('FORCE_SAVE_PATH') is not None:
task_data.save_to_disk_path = os.getenv('FORCE_SAVE_PATH')
config=app.getConfig
if 'force_save_path' in config:
task_data.save_to_disk_path = config['force_save_path']
render_req.init_image_mask = req.get('mask') # hack: will rename this in the HTTP API in a future revision