Commit 8b08b78c authored by AUTOMATIC1111's avatar AUTOMATIC1111

make it so that if an option from infotext conflicts with an argument from...

make it so that if an option from infotext conflicts with an argument from API, the latter overrides the former
parent ba92135a
......@@ -339,6 +339,7 @@ class Api:
if not request.infotext:
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)
handled_fields = {}
......@@ -346,6 +347,9 @@ class Api:
if not field.api:
continue
if field.api in set_fields:
continue
value = field.function(params) if field.function else params.get(field.label)
target_type = request.__fields__[field.api].type_
......@@ -376,7 +380,7 @@ class Api:
script_runner.initialize_scripts(False)
ui.create_ui()
infotext_params = self.apply_infotext(txt2imgreq, "txt2img")
self.apply_infotext(txt2imgreq, "txt2img")
if not self.default_script_arg_txt2img:
self.default_script_arg_txt2img = self.init_default_script_args(script_runner)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment