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:
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue