feat: add config metadata_created_by

This commit is contained in:
Manuel Schmid 2024-01-15 23:04:02 +01:00
parent 6662381931
commit 7b9deb17ee
No known key found for this signature in database
GPG Key ID: 32C4F7569B40B84B
2 changed files with 14 additions and 0 deletions

View File

@ -856,6 +856,10 @@ def worker():
metadata |= {
'software': f'Fooocus v{fooocus_version.version}',
}
if modules.config.metadata_created_by != 'None':
metadata |= {
'created_by': modules.config.metadata_created_by
}
metadata_string = json.dumps(metadata, ensure_ascii=False)
elif save_metadata_to_images and metadata_schema == 'a1111':
generation_params = {
@ -871,6 +875,11 @@ def worker():
"Version": f'Fooocus v{fooocus_version.version}'
}
if modules.config.metadata_created_by != 'None':
generation_params |= {
'Created By': quote(modules.config.metadata_created_by)
}
generation_params_text = ", ".join([k if k == v else f'{k}: {quote(v)}' for k, v in generation_params.items() if v is not None])
positive_prompt_resolved = ', '.join(task['positive'])
negative_prompt_resolved = ', '.join(task['negative'])

View File

@ -325,6 +325,11 @@ default_metadata_schema = get_config_item_or_set_default(
default_value='fooocus',
validator=lambda x: x in [y[1] for y in modules.flags.metadata_schema if y[1] == x]
)
metadata_created_by = get_config_item_or_set_default(
key='metadata_created_by',
default_value='',
validator=lambda x: isinstance(x, str)
)
example_inpaint_prompts = [[x] for x in example_inpaint_prompts]