mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-19 21:00:14 +08:00
make it so that if an option from infotext conflicts with an argument from API, the latter overrides the former
This commit is contained in:
parent
ba92135a2b
commit
8b08b78c03
@ -339,6 +339,7 @@ class Api:
|
|||||||
if not request.infotext:
|
if not request.infotext:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
set_fields = request.model_dump(exclude_unset=True) if hasattr(request, "request") else request.dict(exclude_unset=True) # pydantic v1/v2 have differenrt names for this
|
||||||
params = generation_parameters_copypaste.parse_generation_parameters(request.infotext)
|
params = generation_parameters_copypaste.parse_generation_parameters(request.infotext)
|
||||||
|
|
||||||
handled_fields = {}
|
handled_fields = {}
|
||||||
@ -346,6 +347,9 @@ class Api:
|
|||||||
if not field.api:
|
if not field.api:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if field.api in set_fields:
|
||||||
|
continue
|
||||||
|
|
||||||
value = field.function(params) if field.function else params.get(field.label)
|
value = field.function(params) if field.function else params.get(field.label)
|
||||||
target_type = request.__fields__[field.api].type_
|
target_type = request.__fields__[field.api].type_
|
||||||
|
|
||||||
@ -376,7 +380,7 @@ class Api:
|
|||||||
script_runner.initialize_scripts(False)
|
script_runner.initialize_scripts(False)
|
||||||
ui.create_ui()
|
ui.create_ui()
|
||||||
|
|
||||||
infotext_params = self.apply_infotext(txt2imgreq, "txt2img")
|
self.apply_infotext(txt2imgreq, "txt2img")
|
||||||
|
|
||||||
if not self.default_script_arg_txt2img:
|
if not self.default_script_arg_txt2img:
|
||||||
self.default_script_arg_txt2img = self.init_default_script_args(script_runner)
|
self.default_script_arg_txt2img = self.init_default_script_args(script_runner)
|
||||||
|
Loading…
Reference in New Issue
Block a user