Commit Graph

3452 Commits

Author SHA1 Message Date
psychedelicious
4395ee3c03 feat: parse config before importing anything else
We need to parse the config before doing anything related to invocations to ensure that the invocations union picks up on denied nodes.

- Move that to the top of api_app and cli_app
- Wrap subsequent imports in `if True:`, as a hack to satisfy flake8 and not have to noqa every line or the whole file
- Add tests to ensure graph validation fails when using a denied node, and that the invocations union does not have denied nodes (this indirectly provides confidence that the generated OpenAPI schema will not include denied nodes)
2023-09-08 13:24:37 -04:00
psychedelicious
1d2636aa90 feat: ignore unknown args
Do not throw when parsing unknown args, instead parse only known args print the unknown ones (supersedes #4216)
2023-09-08 13:24:37 -04:00
psychedelicious
24d9357fdc feat(ui): truncate error messages in toasts to 128 characters 2023-09-08 13:24:37 -04:00
psychedelicious
74cc409c72 feat(ui): add nodesAllowlist to config 2023-09-08 13:24:37 -04:00
Eugene Brodsky
cc92ce3da5 feat(backend): allow/deny nodes - do not parse args again 2023-09-08 13:24:37 -04:00
psychedelicious
7254a6a517 feat(ui): add UI-level nodes denylist
This simply hides nodes from the workflow editor. The nodes will still work if an API request is made with them. For example, you could hide `iterate` nodes from the workflow editor, but if the Linear UI makes use of those nodes, they will still function.

- Update `AppConfig` with optional property `nodesDenylist: string[]`
- If provided, nodes are filtered out by `type` in the workflow editor
2023-09-08 13:24:37 -04:00
psychedelicious
dc771d9645 feat(backend): allow/deny nodes
Allow denying and explicitly allowing nodes. When a not-allowed node is used, a pydantic `ValidationError` will be raised.

- When collecting all invocations, check against the allowlist and denylist first. When pydantic constructs any unions related to nodes, the denied nodes will be omitted
- Add `allow_nodes` and `deny_nodes` to `InvokeAIAppConfig`. These are `Union[list[str], None]`, and may be populated with the `type` of invocations.
- When `allow_nodes` is `None`, allow all nodes, else if it is `list[str]`, only allow nodes in the list
- When `deny_nodes` is `None`, deny no nodes, else if it is `list[str]`, deny nodes in the list
- `deny_nodes` overrides `allow_nodes`
2023-09-08 13:24:37 -04:00
Millun Atluri
d3a94e5853 Update release version to 3.1.1rc1 2023-09-08 15:27:22 +10:00
Millun Atluri
0166d7ba2b new frontend build 2023-09-08 15:22:22 +10:00
psychedelicious
56399a650a fix(ui): use zod to parse metdata when fetching from api 2023-09-08 11:55:25 +10:00
psychedelicious
e4035a51af fix(ui): add missing config property 2023-09-08 11:55:10 +10:00
Mary Hipp
81ea742aea cleanup 2023-09-05 16:55:44 -04:00
Mary Hipp
15d28bfdbf add option to fetch metadata from api instead of reading off of png 2023-09-05 16:54:29 -04:00
psychedelicious
0a1c5bea05 fix(ui): do not assign empty string to version if undefined
this causes zod to fail when building workflows
2023-09-06 00:01:26 +10:00
psychedelicious
9c290f4575 fix(nodes): add version to iterate and collect 2023-09-05 23:47:57 +10:00
Lincoln Stein
500f3046a9 remove choice to update from main and add a warning about tags & branches 2023-09-05 08:14:26 -04:00
blessedcoolant
0f2b8dd7df Merge branch 'main' into scaled-aspect-ratio 2023-09-05 23:16:18 +12:00
Lincoln Stein
c54c1f603b
Merge branch 'main' into bugfix/set-vram-on-macs 2023-09-05 07:09:39 -04:00
blessedcoolant
9caa2a2043 fix: Set scaled steps to be at 64 to be in sync with the rest of the canvas 2023-09-05 22:59:37 +12:00
blessedcoolant
86185f2fe3 feat: Scaled Bounding Box Dimensions now respect Aspect Ratio 2023-09-05 22:37:14 +12:00
blessedcoolant
b008fd4a5f
Merge branch 'main' into fix/ui/fix-invoke-button-validation 2023-09-05 15:00:39 +12:00
psychedelicious
8b305651f9 fix(ui): fix non-nodes validation logic being applied to nodes invoke button 2023-09-05 12:44:39 +10:00
blessedcoolant
a9fafad5b5 chore: sync, lint & update 2023-09-05 14:17:23 +12:00
blessedcoolant
c5b9c8fc3a Merge branch 'main' into lama-infill 2023-09-05 14:16:27 +12:00
blessedcoolant
fb5ac78191 Merge branch 'lama-infill' of https://github.com/blessedcoolant/InvokeAI into lama-infill 2023-09-05 14:11:05 +12:00
blessedcoolant
871b9286d1 fix: Review changes 2023-09-05 14:10:41 +12:00
Lincoln Stein
c49b436f06 Merge branch 'lama-infill' of github.com:blessedcoolant/InvokeAI into lama-infill 2023-09-04 21:54:52 -04:00
Lincoln Stein
d2e327add9 install models/core/misc/lama/lama.pt 2023-09-04 21:54:40 -04:00
psychedelicious
2ab75bc52e feat(ui): move fp32 check to its own variable
remove a ton of extraneous checks that are easy to miss during maintenance
2023-09-05 11:51:46 +10:00
psychedelicious
94115b5217 fix(nodes): downscale and resample_mode are not optional 2023-09-05 11:23:13 +10:00
dunkeroni
10eec546ad
Consolidate and generalize saturation/luminosity adjusters (#4425)
* Consolidated saturation/luminosity adjust.
Now allows increasing and inverting.
Accepts any color PIL format and channel designation.

* Updated docs/nodes/defaultNodes.md

* shortened tags list to channel types only

* fix typo in mode list

* split features into offset and multiply nodes

* Updated documentation

* Change invert to discrete boolean.
Previous math was unclear and had issues with 0 values.

* chore: black

* chore(ui): typegen

---------

Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
2023-09-05 11:18:37 +10:00
blessedcoolant
b1ef3370fa chore: Regen Schema 2023-09-05 09:56:34 +12:00
blessedcoolant
db4af7c287 Merge branch 'main' into lama-infill 2023-09-05 09:54:44 +12:00
blessedcoolant
52d15e06bf Merge branch 'main' into lama-infill 2023-09-05 07:12:27 +12:00
psychedelicious
3dbb0e1bfb feat(tests): add tests for node versions 2023-09-04 19:16:44 +10:00
psychedelicious
4aca264308 feat(ui): handle node versions
- Node versions are now added to node templates
- Node data (including in workflows) include the version of the node
- On loading a workflow, we check to see if the node and template versions match exactly. If not, a warning is logged to console.
- The node info icon (top-right corner of node, which you may click to open the notes editor) now shows the version and mentions any issues.
- Some workflow validation logic has been shifted around and is now executed in a redux listener.
2023-09-04 19:08:18 +10:00
psychedelicious
d9148fb619 feat(nodes): add version to node schemas
The `@invocation` decorator is extended with an optional `version` arg. On execution of the decorator, the version string is parsed using the `semver` package (this was an indirect dependency and has been added to `pyproject.toml`).

All built-in nodes are set with `version="1.0.0"`.

The version is added to the OpenAPI Schema for consumption by the client.
2023-09-04 19:08:18 +10:00
psychedelicious
920fc0e751 chore(ui): typegen 2023-09-04 15:25:58 +10:00
psychedelicious
34e3c2e000 feat(ui): style handles 2023-09-04 15:25:31 +10:00
psychedelicious
d65553841e fix: remove default_factory for ImageCollectionInvocation 2023-09-04 15:25:31 +10:00
psychedelicious
446dc6bea1 fix(nodes): denoise_mask is connection-only, ui_order=6 2023-09-04 15:25:31 +10:00
psychedelicious
92975130bd feat: allow float inputs to accept integers
Pydantic automatically casts ints to floats.
2023-09-04 15:25:31 +10:00
psychedelicious
a765f01c08 chore(ui): typegen 2023-09-04 15:25:31 +10:00
psychedelicious
09803b075d fix(ui): fix node value checks to compare to undefined
existing checks would fail if falsy values
2023-09-04 15:25:31 +10:00
psychedelicious
1062fc4796 feat: polymorphic fields
Initial support for polymorphic field types. Polymorphic types are a single of or list of a specific type. For example, `Union[str, list[str]]`.

Polymorphics do not yet have support for direct input in the UI (will come in the future). They will be forcibly set as Connection-only fields, in which case users will not be able to provide direct input to the field.

If a polymorphic should present as a singleton type - which would allow direct input - the node must provide an explicit type hint.

For example, `DenoiseLatents`' `CFG Scale` is polymorphic, but in the node editor, we want to present this as a number input. In the node definition, the field is given `ui_type=UIType.Float`, which tells the UI to treat this as a `float` field.

The connection validation logic will prevent connecting a collection to `CFG Scale` in this situation, because it is typed as `float`. The workaround is to disable validation from the settings to make this specific connection. A future improvement will resolve this.

This also introduces better support for collection field types. Like polymorphics, collection types are parsed automatically by the client and do not need any specific type hints.

Also like polymorphics, there is no support yet for direct input of collection types in the UI.

- Disabling validation in workflow editor now displays the visual hints for valid connections, but lets you connect to anything.
- Added `ui_order: int` to `InputField` and `OutputField`. The UI will use this, if present, to order fields in a node UI. See usage in `DenoiseLatents` for an example.
- Updated the field colors - duplicate colors have just been lightened a bit. It's not perfect but it was a quick fix.
- Field handles for collections are the same color as their single counterparts, but have a dark dot in the center of them.
- Field handles for polymorphics are a rounded square with dot in the middle.
- Removed all fields that just render `null` from `InputFieldRenderer`, replaced with a single fallback
- Removed logic in `zValidatedWorkflow`, which checked for existence of node templates for each node in a workflow. This logic introduced a circular dependency, due to importing the global redux `store` in order to get the node templates within a zod schema. It's actually fine to just leave this out entirely; The case of a missing node template is handled by the UI. Fixing it otherwise would introduce a substantial headache.
- Fixed the `ControlNetInvocation.control_model` field default, which was a string when it shouldn't have one.
2023-09-04 15:25:31 +10:00
blessedcoolant
95f44ff343 fix: Make the name extraction work for both ckpts and folders 2023-09-04 10:52:27 +12:00
blessedcoolant
f9c3c07d98 fix: Support UNIX paths 2023-09-04 10:16:57 +12:00
blessedcoolant
c91ba2dbe7 feat: Infer Model Name automatically if empty in Model Forms 2023-09-04 01:36:48 +12:00
blessedcoolant
917c2c480e Merge branch 'main' into lama-infill 2023-09-03 23:16:34 +12:00
psychedelicious
0a70a856e5
Merge branch 'main' into fix/ui/fix-click-node-collapse 2023-09-03 09:43:40 +10:00