Commit Graph

5679 Commits

Author SHA1 Message Date
Lincoln Stein
ad076b1174 add model directory search route 2023-07-14 11:14:33 -04:00
blessedcoolant
e8d531b987
feat(api): set max-age for images (#3711)
Image files are immutable and we expect deletion to result in no further
requests for a given image, so we can set the max-age to something
thicc.

Resolves #3426

@ebr @brandonrising @maryhipp
2023-07-15 00:33:19 +12:00
Mary Hipp Rogers
545e2f557f
Merge branch 'main' into feat/api/image-max-age 2023-07-14 08:21:44 -04:00
psychedelicious
23c1a6b9d5 fix(nodes): make ResizeLatents w/h optional
now you can connect to them in node editor
2023-07-14 21:42:42 +10:00
blessedcoolant
5c58bc6348 fix: Missing VAE Input Field Component 2023-07-14 16:07:22 +10:00
blessedcoolant
e1d6c09ed2 fix: Type errors & missing Unet field component 2023-07-14 16:07:22 +10:00
psychedelicious
8dd4ca5723 feat(ui): update node editor to use model object format
similar to the previous commit, update the node editor to not just store models as strings - instead, store the model object.

the model select components in nodes are now just kinda copy-pastes over the linear UI versions of the same components, but they were different enough that we can't just share them.

i explored adding some props to override the linear ui components' logic, but it was too brittle. so just copy/paste.
2023-07-14 16:07:22 +10:00
psychedelicious
a071873327 feat(ui): fix a lot of model-related crashes/bugs
We were storing all types of models by their model ID, which is a format like `sd-1/main/deliberate`.

This meant we had to do a lot of extra parsing, because nodes actually wants something like `{base_model: 'sd-1', model_name: 'deliberate'}`.

Some of this parsing was done with zod's error-throwing `parse()` method, and in other places it was done with brittle string parsing.

This commit refactors the state to use the object form of models.

There is still a bit of string parsing done in the to construct the ID from the object form, but it's far less complicated.

Also, the zod parsing is now done using `safeParse()`, which does not throw. This requires a few more conditional checks, but should prevent further crashes.
2023-07-14 16:07:22 +10:00
psychedelicious
14587464d5 fix(ui): check for metadataAccumulator before connecting to it
Fixes an edge case in graph building.
2023-07-14 16:07:22 +10:00
psychedelicious
536a397b12
ui: gallery enhancements (#3752)
* feat(ui): salvaged gallery UI enhancements

* restore boardimage functionality, load boardimages and remove some cachine optimizations in the name of data integrity

* fix assets, fix load more params

* jk NOW fix assets, fix load more params

---------

Co-authored-by: Mary Hipp <maryhipp@Marys-MacBook-Air.local>
Co-authored-by: Mary Hipp Rogers <maryhipp@gmail.com>
2023-07-13 20:31:10 +00:00
blessedcoolant
271f64068c
fix: model_name reference in Model Manager (#3756) 2023-07-14 05:58:35 +12:00
blessedcoolant
50f10ce5d7 fix: model_name reference in Model Manager 2023-07-14 03:36:11 +12:00
psychedelicious
d46261a528 chore(ui): regen types 2023-07-13 23:26:52 +10:00
psychedelicious
978016ea51 feat(ui): use query to populate infill methods dropdown
- available infill methods is server state - remove it from client state, use the query to populate the dropdown
- add listener to ensure the selected infill method is an available one
2023-07-13 23:26:52 +10:00
psychedelicious
4d25d702a1 feat(api): app/config route returns available infill methods 2023-07-13 23:26:52 +10:00
Mary Hipp
d6c914eedc detect if user has patchmatch enabled 2023-07-13 23:26:52 +10:00
maryhipp
fba25792f9 add new route for app config 2023-07-13 23:26:52 +10:00
Lincoln Stein
8fc0ce7e38
Fix wrong conditioning used (#3595)
As it said in comment to this branch we want to use conditioning run:
```python
if cfg_injection:  # only applying ControlNet to conditional instead of in unconditioned
```
But in code used unconditioning
embeddings(`conditioning_data.unconditioned_embeddings`).

Later in code confirms that we want to run conditioning generation by
comment and tensor concatenation order(as all code expect to get [uc, c]
tensor):
```python
if cfg_injection:
    # Inferred ControlNet only for the conditional batch.
    # To apply the output of ControlNet to both the unconditional and conditional batches,
    #   add 0 to the unconditional batch to keep it unchanged.
    down_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_samples]
    mid_sample = torch.cat([torch.zeros_like(mid_sample), mid_sample])
```
2023-07-13 09:19:13 -04:00
blessedcoolant
9348dc8e0d
Merge branch 'main' into fix/controlnet_cfg_inj_cond 2023-07-14 01:11:04 +12:00
blessedcoolant
d4ec8873f7
Fix Inpainting Issues (#3744)
- fix: Inpaint not working with some schedulers: Resolves #3732
- fix: LoRA's not working at all while inpainting.
2023-07-13 23:42:44 +12:00
blessedcoolant
34bff3ba77
Merge branch 'main' into fix-inpainting 2023-07-13 23:35:12 +12:00
mickr777
3cf75e48c5 remove clearnode export 2023-07-13 21:34:12 +10:00
mickr777
b5e7384f09 Delete clearnodes and change nodeEditorReset 2023-07-13 21:34:12 +10:00
mickr777
ee253ea4f1 add useCallback 2023-07-13 21:34:12 +10:00
blessedcoolant
430b9c291f fix: Loras not working correctly with Inpainting 2023-07-13 22:59:38 +12:00
blessedcoolant
16f53228c2 Merge branch 'main' into fix-inpainting 2023-07-13 22:31:08 +12:00
blessedcoolant
28001271b8
fix(ui): fix nodes crash when adding model loader (#3755) 2023-07-13 22:30:17 +12:00
psychedelicious
4ab4942e69 fix(ui): fix nodes crash when adding model loader 2023-07-13 20:29:03 +10:00
blessedcoolant
1b42996925
fix(ui): fix node parsing failing (#3754) 2023-07-13 22:19:00 +12:00
blessedcoolant
98a5b3fc24
Merge branch 'main' into fix/ui/fix-missing-nodes 2023-07-13 22:18:27 +12:00
psychedelicious
944b46908a fix(ui): fix node parsing failing 2023-07-13 20:17:18 +10:00
blessedcoolant
af3b7e73ab
fix(ui): fix lora name disappearing (#3753) 2023-07-13 22:15:25 +12:00
psychedelicious
23d2af52df fix(ui): fix lora name disappearing 2023-07-13 20:14:26 +10:00
blessedcoolant
059e427457
fix(ui): check for metadata accumulator before connecting to it (#3751) 2023-07-13 22:08:13 +12:00
blessedcoolant
f4b37d4e55
Merge branch 'main' into fix/ui/fix-inpaint-graph-again 2023-07-13 22:07:30 +12:00
psychedelicious
43cc96255b fix(ui): check for metadata accumulator before connecting to it 2023-07-13 20:05:45 +10:00
blessedcoolant
37b06a4f41
fix(ui): fix inpaint invalid model error (#3750) 2023-07-13 22:02:38 +12:00
psychedelicious
4702eb2e6a fix(ui): fix inpaint invalid model error 2023-07-13 19:59:51 +10:00
blessedcoolant
5a546e66f1 Merge branch 'main' into fix-inpainting 2023-07-13 20:42:13 +12:00
blessedcoolant
fde9fa2fe4
Add Clear nodes Button (#3747)
Adds a Clear Nodes Button with Confirmation Dialog, I think I Did it
right 😃

I am sure there is a way to make the Confirmation look better and have
Yes/No instead of OK/Cancel
2023-07-13 20:35:40 +12:00
blessedcoolant
19fdb70e20 Merge branch 'clearnodes' of https://github.com/mickr777/InvokeAI into pr/3747 2023-07-13 20:34:57 +12:00
blessedcoolant
6861499697 fix: Simplify modal code 2023-07-13 20:34:23 +12:00
mickr777
8274488d2c
Merge branch 'main' into clearnodes 2023-07-13 18:30:12 +10:00
mickr777
91c4e4c9b9
useDisclosure instead of useState. 2023-07-13 18:08:30 +10:00
mickr777
d1ac50b061
Change Confirmation Dialog
Changed Confirmation Dialog to use chakra-ui alert dialog
2023-07-13 17:19:59 +10:00
psychedelicious
5f5c93abb4 feat(app): embed PNG info in invokeai_metadata and invokeai_graph
Using just `metadata` and `graph` feel a bit too generic.
2023-07-13 15:40:05 +10:00
psychedelicious
6bea7bac36 feat(ui): restore recall functionality
- Restore recall functionality to `CurrentImageButtons` and `ImageContextMenu`.
- Debounce metadata requests for `ImageMetadataViewer` and `CurrentImageButtons` by 500ms. It's possible to scroll through these really fast, so we want to debounce the network requests.
- `ImageContextMenu` is lazy-mounted so it does not need to be debounced; it makes the metadata request as soon as you click it.
- Move next/prev image selection logic into hook and add the hotkeys for this to `CurrentImageButtons`. The hotkeys now work when metadata viewer is open.

I will follow up with improved loading state during the debounced calls in the future
2023-07-13 15:40:05 +10:00
psychedelicious
a43c900961 feat(ui): update UI for new metadata
- Update for new routes
- Update model storage in state to be `MainModelField` type instead of `string`, simplifies a lot of model handling
- Update model-related stuff for model `name` --> `model_name`
- Update linear graphs to use `MetadataAccumulator`
- Update `ImageMetadataViewer` UI
- Ensure all `recall` functions work (well, the ones that are active anyways)
2023-07-13 15:40:05 +10:00
psychedelicious
bddc04af96 chore(ui): regen types 2023-07-13 15:40:05 +10:00
psychedelicious
50bef87da7 feat(db,nodes,api): refactor metadata
Metadata for the Linear UI is now sneakily provided via a `MetadataAccumulator` node, which the client populates / hooks up while building the graph.

Additionally, we provide the unexpanded graph with the metadata API response.

Both of these are embedded into the PNGs.

- Remove `metadata` from `ImageDTO`
- Split up the `images/` routes to accomodate this; metadata is only retrieved per-image
- `images/{image_name}` now gets the DTO
- `images/{image_name}/metadata` gets the new metadata
- `images/{image_name}/full` gets the full-sized image file
- Remove old metadata service
- Add `MetadataAccumulator` node, `CoreMetadataField`, hook up to `LatentsToImage` node
- Add `get_raw()` method to `ItemStorage`, retrieves the row from DB as a string, no pydantic parsing
- Update `images`related services to handle storing and retrieving the new metadata
- Add `get_metadata_graph_from_raw_session` which extracts the `graph` from `session` without needing to hydrate the session in pydantic, in preparation for providing it as metadata; also removes all references to the `MetadataAccumulator` node
2023-07-13 15:40:05 +10:00