|
7 | 7 |
|
8 | 8 | from invokeai.app.util.metaenum import MetaEnum
|
9 | 9 | from invokeai.backend.image_util.segment_anything.shared import BoundingBox
|
10 |
| -from invokeai.backend.model_manager.taxonomy import BaseModelType, ClipVariantType, ModelType, ModelVariantType |
| 10 | +from invokeai.backend.model_manager.taxonomy import ( |
| 11 | + BaseModelType, |
| 12 | + ClipVariantType, |
| 13 | + ModelFormat, |
| 14 | + ModelType, |
| 15 | + ModelVariantType, |
| 16 | +) |
11 | 17 | from invokeai.backend.util.logging import InvokeAILogger
|
12 | 18 |
|
13 | 19 | logger = InvokeAILogger.get_logger()
|
@@ -413,6 +419,7 @@ class InputFieldJSONSchemaExtra(BaseModel):
|
413 | 419 | ui_model_base: Optional[list[BaseModelType]] = None
|
414 | 420 | ui_model_type: Optional[list[ModelType]] = None
|
415 | 421 | ui_model_variant: Optional[list[ClipVariantType | ModelVariantType]] = None
|
| 422 | + ui_model_format: Optional[list[ModelFormat]] = None |
416 | 423 |
|
417 | 424 | model_config = ConfigDict(
|
418 | 425 | validate_assignment=True,
|
@@ -508,6 +515,7 @@ def InputField(
|
508 | 515 | ui_model_base: Optional[BaseModelType | list[BaseModelType]] = None,
|
509 | 516 | ui_model_type: Optional[ModelType | list[ModelType]] = None,
|
510 | 517 | ui_model_variant: Optional[ClipVariantType | ModelVariantType | list[ClipVariantType | ModelVariantType]] = None,
|
| 518 | + ui_model_format: Optional[ModelFormat | list[ModelFormat]] = None, |
511 | 519 | ) -> Any:
|
512 | 520 | """
|
513 | 521 | Creates an input field for an invocation.
|
@@ -545,8 +553,13 @@ def InputField(
|
545 | 553 | )
|
546 | 554 |
|
547 | 555 | if ui_type is not None:
|
548 |
| - if ui_model_base is not None or ui_model_type is not None or ui_model_variant is not None: |
549 |
| - logger.warning("Use either ui_type or ui_model_[base|type|variant]. Ignoring ui_type.") |
| 556 | + if ( |
| 557 | + ui_model_base is not None |
| 558 | + or ui_model_type is not None |
| 559 | + or ui_model_variant is not None |
| 560 | + or ui_model_format is not None |
| 561 | + ): |
| 562 | + logger.warning("InputField: Use either ui_type or ui_model_[base|type|variant]. Ignoring ui_type.") |
550 | 563 | # Map old-style UIType to new-style ui_model_[base|type|variant]
|
551 | 564 | elif ui_type is UIType.MainModel:
|
552 | 565 | json_schema_extra_.ui_model_type = [ModelType.Main]
|
@@ -649,6 +662,11 @@ def InputField(
|
649 | 662 | json_schema_extra_.ui_model_variant = ui_model_variant
|
650 | 663 | else:
|
651 | 664 | json_schema_extra_.ui_model_variant = [ui_model_variant]
|
| 665 | + if ui_model_format is not None: |
| 666 | + if isinstance(ui_model_format, list): |
| 667 | + json_schema_extra_.ui_model_format = ui_model_format |
| 668 | + else: |
| 669 | + json_schema_extra_.ui_model_format = [ui_model_format] |
652 | 670 |
|
653 | 671 | """
|
654 | 672 | There is a conflict between the typing of invocation definitions and the typing of an invocation's
|
|
0 commit comments