Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next rebased #5836

Closed
wants to merge 340 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
340 commits
Select commit Hold shift + click to select a range
0f93698
Raise InvalidModelConfigException when unable to detect load class in…
brandonrising Feb 14, 2024
7c454b2
feat(nodes): update invocation context for mm2, update nodes model usage
psychedelicious Feb 15, 2024
758e0c1
chore: ruff
psychedelicious Feb 15, 2024
8651b7b
chore: lint
psychedelicious Feb 15, 2024
8e91c3a
fix(ui): fix type issues
psychedelicious Feb 15, 2024
af7b5d6
feat(ui): export components type
psychedelicious Feb 15, 2024
2dbde99
chore(ui): typegen
psychedelicious Feb 15, 2024
f085713
tests(ui): enable vitest type testing
psychedelicious Feb 15, 2024
8b09eab
tests(ui): add type tests
psychedelicious Feb 15, 2024
aee44d6
fix(ui): update model types
psychedelicious Feb 15, 2024
13d3a01
fix(nodes): fix t2i adapter model loading
psychedelicious Feb 16, 2024
b79fac7
feat(ui): update model identifier to be key (wip)
psychedelicious Feb 16, 2024
3890820
refactor(ui): url builders for each router
psychedelicious Feb 16, 2024
c8c0b1f
feat(ui): fix main model & control adapter model selects
psychedelicious Feb 16, 2024
8773260
chore(ui): lint
psychedelicious Feb 16, 2024
a8dc0f1
Fix issues identified during PR review by RyanjDick and brandonrising
Feb 16, 2024
a5d4d1e
Tidy names and locations of modules
Feb 17, 2024
50b989e
final tidying before marking PR as ready for review
psychedelicious Feb 18, 2024
5231bf4
fix: Alpha channel causing issue with DW Processor
blessedcoolant Feb 18, 2024
1e3369d
feat(nodes): format option for get_image method
dunkeroni Feb 18, 2024
4d9e8fe
fix(nodes): canny preprocessor uses RGBA again
dunkeroni Feb 18, 2024
fce7e00
fix: removed custom module
dunkeroni Feb 18, 2024
eae7289
chore(invocations): use IMAGE_MODES constant literal
dunkeroni Feb 18, 2024
490d772
chore(invocations): remove redundant RGB conversions
dunkeroni Feb 19, 2024
07af61b
chore: ruff formatting
dunkeroni Feb 19, 2024
111cb58
one more redundant RGB convert removed
dunkeroni Feb 19, 2024
464ac9e
remove errant def that was crashing invokeai-configure
Feb 18, 2024
8c10f25
feat(nodes): JIT graph nodes validation
psychedelicious Feb 17, 2024
29a5195
fix(nodes): fix OpenAPI schema generation
psychedelicious Feb 17, 2024
c2dbe7a
tidy(nodes): remove GraphInvocation
psychedelicious Feb 17, 2024
ab89437
tidy(nodes): move node tests to parent dir
psychedelicious Feb 17, 2024
baafcd2
tidy(nodes): remove LibraryGraphs
psychedelicious Feb 17, 2024
eff1dec
tidy(nodes): remove no-op model_config
psychedelicious Feb 17, 2024
15daad7
chore(ui): typegen
psychedelicious Feb 17, 2024
ec3b2f5
tidy(nodes): remove commented tests
psychedelicious Feb 17, 2024
484c883
refactor(nodes): merge processors
psychedelicious Feb 17, 2024
fe702a9
feat(nodes): promote `is_canceled` to public node API
psychedelicious Feb 18, 2024
b4c8183
chore(nodes): add comments for cancel state
psychedelicious Feb 18, 2024
29483c3
feat(nodes): better invocation error messages
psychedelicious Feb 18, 2024
d4cef6c
tidy(nodes): remove extraneous comments
psychedelicious Feb 18, 2024
9ea5019
feat(nodes): add whole queue_item to InvocationContextData
psychedelicious Feb 18, 2024
cadb408
refactor(nodes): move is_canceled to `context.util`
psychedelicious Feb 18, 2024
e0919dd
chore(nodes): "context_data" -> "data"
psychedelicious Feb 18, 2024
d2038e4
chore(nodes): better comments for invocation context
psychedelicious Feb 18, 2024
26f0af4
tests(nodes): fix tests following removal of services
psychedelicious Feb 18, 2024
475cfb6
feat(nodes): make processor thread limit and polling interval configu…
psychedelicious Feb 18, 2024
1b8922f
feat(nodes): improved error messages in processor
psychedelicious Feb 18, 2024
c07ace5
feat(nodes): making invocation class var in processor
psychedelicious Feb 18, 2024
c2bd829
fix(nodes): fix model load events
psychedelicious Feb 18, 2024
269c0e6
fix(nodes): fix typing on stats service context manager
psychedelicious Feb 19, 2024
b8f3b4f
tidy(nodes): clean up profiler/stats in processor, better comments
psychedelicious Feb 19, 2024
934fc82
chore(nodes): update TODO comment
psychedelicious Feb 19, 2024
71ff5b0
Add a few convenience targets to Makefile
Feb 19, 2024
4b5fdb6
fix(ui): fix low-hanging fruit types
psychedelicious Feb 19, 2024
0ad4537
chore(ui): bump `@invoke-ai/ui-library`
psychedelicious Feb 19, 2024
e31ee85
fix(ui): get lora select working
psychedelicious Feb 19, 2024
53e13f7
fix(ui): get embedding select working
psychedelicious Feb 19, 2024
4793569
fix(ui): get vae model select working
psychedelicious Feb 20, 2024
ebc3b1d
fix(ui): get refiner model select working
psychedelicious Feb 20, 2024
f6735d0
fix(ui): get workflow editor model selects working
psychedelicious Feb 20, 2024
f0d476f
groundwork for the bulk_download_service
StefanTobler Jan 8, 2024
506a87a
adding socket events for bulk download
StefanTobler Jan 8, 2024
27311d4
implementation of bulkdownload background task
StefanTobler Jan 8, 2024
6f85ced
linted and styling
StefanTobler Jan 8, 2024
cd69f77
reworking some of the logic to use a default room, adding endpoint to…
StefanTobler Jan 14, 2024
b3264db
using the board name to download boards
StefanTobler Jan 14, 2024
4f3d126
fixing issue where default board did not return images
StefanTobler Jan 14, 2024
dee7006
refactoring bulkdownload to consider image category
StefanTobler Jan 14, 2024
eb278fd
refactoring dummy event service, DRY principal; adding bulk_download_…
StefanTobler Jan 15, 2024
fe824f0
refactoring bulk_download to be better managed
StefanTobler Jan 15, 2024
a405e5e
97% test coverage on bulk_download
StefanTobler Jan 15, 2024
3c15714
replacing import removed during rebase
StefanTobler Jan 15, 2024
faa16b9
cleaning up bulk download zip after the response is complete
StefanTobler Jan 15, 2024
604aa92
adding test coverage for new bulk download routes
StefanTobler Jan 16, 2024
2d3ee91
narrowing bulk_download stop service scope
StefanTobler Jan 28, 2024
aefd4c4
returning the bulk_download_item_name on response for possible polling
StefanTobler Jan 28, 2024
3080029
using temp directory for downloads
StefanTobler Jan 28, 2024
e0051f4
updating imports to satisfy ruff
StefanTobler Feb 16, 2024
62d899f
moving the responsibility of cleaning up board names to the service n…
StefanTobler Feb 16, 2024
45ffdce
relocating event_service fixture due to import ordering
StefanTobler Feb 17, 2024
c2c93a0
removing dependency on an output folder, embrace python temp folder f…
StefanTobler Feb 17, 2024
bc0d7d8
refactoring handlers to do null check
StefanTobler Feb 18, 2024
b57336e
adding bulk_download_item_name to socket events
StefanTobler Feb 19, 2024
de8213c
tidy(bulk_download): clean up comments
psychedelicious Feb 20, 2024
9cd4d8c
tidy(bulk_download): remove extraneous abstract methods
psychedelicious Feb 20, 2024
498ce5c
tidy(bulk_download): remove class-level attr annotations
psychedelicious Feb 20, 2024
de4c687
tidy(bulk_download): use single underscore for private attrs
psychedelicious Feb 20, 2024
635fe78
tidy(bulk_download): nit - use `or` as a coalescing operator
psychedelicious Feb 20, 2024
4cde91e
tidy(bulk_download): do not rely on pagination API to get all images …
psychedelicious Feb 20, 2024
a237a37
tidy(bulk_download): don't store events service separately
psychedelicious Feb 20, 2024
f27840f
test: clean up & fix tests
psychedelicious Feb 20, 2024
aa03b6a
setting up event listeners for bulk download socket
StefanTobler Feb 18, 2024
555c10a
implementing download for bulk_download events
StefanTobler Feb 19, 2024
32afcfc
feat(bulk_download): update response model, messages
psychedelicious Feb 20, 2024
09c858c
chore(ui): typegen
psychedelicious Feb 20, 2024
0ce7d03
feat(ui): revise bulk download listeners
psychedelicious Feb 20, 2024
9dd4332
feat(ui): do not subscribe to bulk download sio room if baseUrl is set
psychedelicious Feb 20, 2024
71f7dca
fix(ui): fix package build
psychedelicious Feb 20, 2024
51d5f05
fix(nodes): fix TI loading
psychedelicious Feb 21, 2024
7fc8b82
fix(ui): use model names in badges
psychedelicious Feb 21, 2024
8c34ac2
fix(ui): handle new model format for metadata
psychedelicious Feb 21, 2024
8967c86
tidy(ui): remove debugging stmt
psychedelicious Feb 21, 2024
9abb2ed
chore(ui): bump deps
psychedelicious Feb 21, 2024
8ea0de9
Create /search endpoint, update model object structure in scan model …
brandonrising Feb 21, 2024
0651e84
rename endpoint for scanning
Feb 22, 2024
03d0d19
Run ruff
brandonrising Feb 22, 2024
69d93df
feat(nodes): added gradient mask node
dunkeroni Feb 21, 2024
5fc0ed6
chore: typing fix
dunkeroni Feb 21, 2024
3b0bd67
chore: typing
dunkeroni Feb 21, 2024
70cd319
remove startup dependency on legacy models.yaml file
Feb 21, 2024
b6f0fc1
fix repo-id for the Deliberate v5 model
Feb 21, 2024
d2a4ab5
use official Deliberate download repo
Feb 21, 2024
ea67507
several small model install enhancements
Feb 21, 2024
10ba71b
feat(ui): replace `type-fest` with `utility-types`
psychedelicious Feb 22, 2024
7f81d89
fix(nodes): make fields on `ModelConfigBase` required
psychedelicious Feb 22, 2024
f815977
chore(ui): typegen
psychedelicious Feb 22, 2024
247d971
feat(ui): refactor metadata handling
psychedelicious Feb 22, 2024
46389cc
fix(ui): roll back utility-types
psychedelicious Feb 22, 2024
fda5b7d
Allow users to run model manager without cuda
brandonrising Feb 22, 2024
fa8d847
Run ruff
brandonrising Feb 22, 2024
fee4cfb
Remove passing keys in on register
brandonrising Feb 23, 2024
8221a61
Allow passing in key on register
brandonrising Feb 23, 2024
9953ff9
get old UI working somewhat with new endpoints
Feb 20, 2024
6a80706
workspace for mary and jenn
Feb 20, 2024
f0d0f8d
model list, filtering, searching
Feb 20, 2024
35f870f
added import model form and importqueue
chainchompa Feb 20, 2024
c8e84a7
single model view
Feb 21, 2024
05e098b
hook up Add Model button
Feb 21, 2024
e73fc5d
edit view for model, depending on type and valid values
Feb 21, 2024
3ef73c3
added socket listeners, added more info to ui
chainchompa Feb 21, 2024
416fed6
finish model update
Feb 21, 2024
53907a5
form error handling
Feb 21, 2024
1242205
fix sync model endpoint
Feb 21, 2024
235f272
delete model imports and prune all finished, update state with socket…
chainchompa Feb 21, 2024
71218ac
added status to import queue model
chainchompa Feb 21, 2024
126dce9
allow metadata-less models to be used for GET metadata endpoint
maryhipp Feb 22, 2024
222c599
update metadata endpoint
Feb 22, 2024
dfa4299
add scan model endpoint, break add model into tabs
Feb 22, 2024
85a80fe
basic scan working and renders results
Feb 22, 2024
6631084
get positioning/scrolling working for scan results list
Feb 22, 2024
a844284
added advanced import forms, not fully working yet
chainchompa Feb 22, 2024
3be4908
fix(ui): fix model install event types
psychedelicious Feb 23, 2024
dc9349f
fix(ui): simplify model install event listeners
psychedelicious Feb 23, 2024
7209376
fix(ui): fix ImportMainModelResponse type
psychedelicious Feb 23, 2024
c63dbd0
chore(ui): temp disable eslint i18 rule
psychedelicious Feb 23, 2024
1684cb4
fix(ui): misc MM cleanup
psychedelicious Feb 23, 2024
d1abbdd
refactored and fixed issues with advanced import form
chainchompa Feb 23, 2024
17b2056
fix types for ImportQueue, add QuickAdd for scan models
Feb 23, 2024
ac06f3f
add error_reason to UI if import fails
Feb 23, 2024
2a380b1
add error_reason to ModelInstallJob
maryhipp Feb 23, 2024
05d12ff
fix logic to see if scanned models are already installed, style tweaks
Feb 23, 2024
d0b480f
add model convert to checkpoint main models
Feb 23, 2024
99152c4
clean up old model manager components and endpoints
Feb 23, 2024
75c78b6
fix convert endpoint logic
maryhipp Feb 23, 2024
ebdee1c
updated translations
Feb 23, 2024
cb73195
lint fix
Feb 23, 2024
5d6e008
feat(api): mm metadata route "meta" -> "metadata"
psychedelicious Feb 24, 2024
bbbac8f
chore(ui): typegen
psychedelicious Feb 24, 2024
9695d28
fix(ui): fix metadata route
psychedelicious Feb 24, 2024
a2444bd
chore: ruff
psychedelicious Feb 24, 2024
39b1076
build(ui): restore i18n eslint rule
psychedelicious Feb 24, 2024
cb90e65
chore(ui): lint
psychedelicious Feb 24, 2024
f96e3e8
feat(mm): add logic to scan_folder route to check if a model is alrea…
psychedelicious Feb 24, 2024
f9cea3d
chore(ui): typegen
psychedelicious Feb 24, 2024
28e4baf
fix(ui): use new scan_folder response instead of hook to determine if…
psychedelicious Feb 24, 2024
e809f09
fix(ui): fix merge issue
psychedelicious Feb 24, 2024
8da7440
chore: ruff
psychedelicious Feb 24, 2024
d226912
wip(ui): Replace 2 Layer Coherence pass with Gradient Mask
blessedcoolant Feb 21, 2024
c40106e
canvas: improve paste back (or try to)
blessedcoolant Feb 22, 2024
db87015
fix: lint errors
blessedcoolant Feb 22, 2024
73671ca
fix: outpaint result not getting pasted back correctly
blessedcoolant Feb 22, 2024
90c66e1
tidy(nodes): rename canvas paste back
psychedelicious Feb 24, 2024
ca8a68f
chore(ui): typegen
psychedelicious Feb 24, 2024
0ae93d2
fix(ui): fix node types for canvas graphs
psychedelicious Feb 24, 2024
4f0fd05
feat(ui): bulk download click to download
psychedelicious Feb 21, 2024
a138814
clear out VRAM when an OOM occurs
Feb 24, 2024
80e73a1
recover gracefuly from GPU out of memory errors (next version)
Feb 24, 2024
37a42aa
chore: ruff
psychedelicious Feb 26, 2024
5c175fd
fix(mm): fix ModelCacheBase method name
psychedelicious Feb 26, 2024
b5144d8
fix base model grouping in combobox
Feb 26, 2024
f5550be
fix TI appearing as key in prompt
Feb 26, 2024
0bf9aff
fix literal strings in MM UI
Feb 26, 2024
305e72f
undo
Feb 26, 2024
9c7d960
feat(api): add MM `get_by_attrs` route
psychedelicious Feb 22, 2024
3d3f231
chore(ui): typegen
psychedelicious Feb 22, 2024
7477f85
build(ui): do not fail build on eslint error in dev mode
psychedelicious Feb 24, 2024
9d9210a
feat(ui): refactor metadata handling (again)
psychedelicious Feb 23, 2024
674cdf8
feat(ui): no JSX in metadata handlers
psychedelicious Feb 25, 2024
2c8d12b
fix(ui): use id for component key in control adapter components
psychedelicious Feb 25, 2024
061da14
feat(ui): migrate all metadata recall logic to new system
psychedelicious Feb 26, 2024
343ba83
fix(ui): fix type issues related to change in LoRA type
psychedelicious Feb 26, 2024
edb0c74
fix(ui): fix lora metadata rendering
psychedelicious Feb 26, 2024
015a8e1
feat(ui): add transformation to width/height parameter schemas to rou…
psychedelicious Feb 26, 2024
34a82ee
fix(ui): fix node type
psychedelicious Feb 26, 2024
90ec551
fix(ui): fix lora metadata item type
psychedelicious Feb 26, 2024
fe954b2
feat(ui): optimize model query caching
psychedelicious Feb 26, 2024
f2aee50
tidy(ui): tidy model identifier logic
psychedelicious Feb 26, 2024
0d5d2d9
feat(nodes): update LoRAMetadataItem model
psychedelicious Feb 26, 2024
3234199
tidy(ui): remove unused metadata schemas
psychedelicious Feb 26, 2024
bf678bf
fix(ui): CanvasPasteBack types
psychedelicious Feb 26, 2024
5c01410
fix(ui): model metadata handlers use model identifiers, not configs
psychedelicious Feb 26, 2024
1606a04
feat(ui): create metadata types for control adapters
psychedelicious Feb 26, 2024
52ca0a6
added add all button to scan models
chainchompa Feb 27, 2024
17538e7
ui: split the canvas mask blur and edge size setting
blessedcoolant Feb 26, 2024
2866325
fix(ui): fix missing component import
psychedelicious Feb 27, 2024
971b604
feat(ui): add knip + minimal config
psychedelicious Feb 27, 2024
1ce4c11
tidy(ui): clean up unused code 1
psychedelicious Feb 27, 2024
e5bfa4a
tidy(mm): remove ONNX from AnyModelConfig
psychedelicious Feb 27, 2024
c268e1a
tidy(api): remove non-heuristic install route
psychedelicious Feb 27, 2024
11c4c69
fix(ui): fix up MM queries & types (wip)
psychedelicious Feb 27, 2024
9ed2f92
fix(ui): fix remaining TS issues
psychedelicious Feb 27, 2024
7daab51
chore(ui): lint
psychedelicious Feb 27, 2024
e8a8565
fix(ui): model install progress sets total bytes correctly
psychedelicious Feb 27, 2024
e1d65ea
feat(mm): add log stmt for download complete event
psychedelicious Feb 27, 2024
1b57f15
tidy(ui): clean up unused code 2
psychedelicious Feb 27, 2024
ca07402
tidy(ui): clean up unused code 3
psychedelicious Feb 27, 2024
84b4f21
tidy(ui): clean up unused code 4
psychedelicious Feb 27, 2024
ff33ae4
tidy(ui): clean up unused code 5
psychedelicious Feb 27, 2024
5110ed2
tidy(ui): clean up unused code 6
psychedelicious Feb 27, 2024
e08dbe3
feat(ui): configure knip
psychedelicious Feb 27, 2024
17a9ab3
ci: add knip to ui check workflow
psychedelicious Feb 27, 2024
86185f0
chore(ui): update pnpm-lock.yaml
psychedelicious Feb 27, 2024
8378efa
chore(ui): typegen, update knip config
psychedelicious Feb 27, 2024
3c31067
tidy: remove some traces of ONNX
psychedelicious Feb 27, 2024
0be00f9
tidy(ui): fix circular dependencies in listeners
psychedelicious Feb 27, 2024
b4c8597
feat(ui): move from madge to dpdm for circular dependencies
psychedelicious Feb 27, 2024
60453a0
ci: change frontend check to dpdm
psychedelicious Feb 27, 2024
53173df
chore(ui): bump deps
psychedelicious Feb 27, 2024
8ed45e5
fix(ui): merge conflict
psychedelicious Feb 27, 2024
746c293
updated to use new import model mutation
chainchompa Feb 27, 2024
6931b83
handle change to Civitai metadata schema for commercial usage
Feb 28, 2024
4002e61
Allow TIs to be either a key or a name in the prompt during our trans…
brandonrising Feb 27, 2024
579edbd
Fix one last reference to the uncasted model
brandonrising Feb 27, 2024
12bc16e
Extract TI loading logic into util, disallow it from ever failing a g…
brandonrising Feb 27, 2024
bc6a77c
Ruff check
brandonrising Feb 27, 2024
17ab26b
Ruff format
brandonrising Feb 27, 2024
ff3279b
Switch ModelSearch from os.walk to os.scandir
brandonrising Feb 23, 2024
44df282
Fix directory called on _walk_directory
brandonrising Feb 23, 2024
da1ab17
Ruff checks
brandonrising Feb 23, 2024
1e6386f
Switch absolute path to as_posix in _walk_directory
brandonrising Feb 28, 2024
59ed9c4
Fix merge with next
brandonrising Feb 28, 2024
664331f
fix: Assertion issue with SDXL Compel
blessedcoolant Feb 29, 2024
01940f3
chore: ruff
psychedelicious Feb 29, 2024
7e58bed
Next: Remove deprecated app.on_event usage in api runner
brandonrising Feb 28, 2024
4f5c559
feat(nodes): revise model load API args
psychedelicious Feb 29, 2024
145cbaa
docs: bump mkdocs, add mkdocstrings
psychedelicious Feb 29, 2024
2531f48
docs: update mkdocs config
psychedelicious Feb 29, 2024
54db5af
fix: make invocation_context.py accessible to mkdocs
psychedelicious Feb 29, 2024
78dd458
docs(nodes): update all docstrings for public nodes API
psychedelicious Feb 29, 2024
ac5bb98
docs: add v3 -> v4 migration, invocation API docs
psychedelicious Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .github/workflows/lint-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ jobs:
- name: Typescript
run: 'pnpm run lint:tsc'
- name: Madge
run: 'pnpm run lint:madge'
run: 'pnpm run lint:dpdm'
- name: ESLint
run: 'pnpm run lint:eslint'
- name: Prettier
run: 'pnpm run lint:prettier'
- name: Knip
run: 'pnpm run lint:knip'
39 changes: 25 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,44 @@ default: help
help:
@echo Developer commands:
@echo
@echo "ruff Run ruff, fixing any safely-fixable errors and formatting"
@echo "ruff-unsafe Run ruff, fixing all fixable errors and formatting"
@echo "mypy Run mypy using the config in pyproject.toml to identify type mismatches and other coding errors"
@echo "mypy-all Run mypy ignoring the config in pyproject.tom but still ignoring missing imports"
@echo "frontend-build Build the frontend in order to run on localhost:9090"
@echo "frontend-dev Run the frontend in developer mode on localhost:5173"
@echo "installer-zip Build the installer .zip file for the current version"
@echo "tag-release Tag the GitHub repository with the current version (use at release time only!)"
@echo "ruff Run ruff, fixing any safely-fixable errors and formatting"
@echo "ruff-unsafe Run ruff, fixing all fixable errors and formatting"
@echo "mypy Run mypy using the config in pyproject.toml to identify type mismatches and other coding errors"
@echo "mypy-all Run mypy ignoring the config in pyproject.tom but still ignoring missing imports"
@echo "test" Run the unit tests.
@echo "frontend-install" Install the pnpm modules needed for the front end
@echo "frontend-build Build the frontend in order to run on localhost:9090"
@echo "frontend-dev Run the frontend in developer mode on localhost:5173"
@echo "installer-zip Build the installer .zip file for the current version"
@echo "tag-release Tag the GitHub repository with the current version (use at release time only!)"

# Runs ruff, fixing any safely-fixable errors and formatting
ruff:
ruff check . --fix
ruff format .
ruff check . --fix
ruff format .

# Runs ruff, fixing all errors it can fix and formatting
ruff-unsafe:
ruff check . --fix --unsafe-fixes
ruff format .
ruff check . --fix --unsafe-fixes
ruff format .

# Runs mypy, using the config in pyproject.toml
mypy:
mypy scripts/invokeai-web.py
mypy scripts/invokeai-web.py

# Runs mypy, ignoring the config in pyproject.toml but still ignoring missing (untyped) imports
# (many files are ignored by the config, so this is useful for checking all files)
mypy-all:
mypy scripts/invokeai-web.py --config-file= --ignore-missing-imports
mypy scripts/invokeai-web.py --config-file= --ignore-missing-imports

# Run the unit tests
test:
pytest ./tests

# Install the pnpm modules needed for the front end
frontend-install:
rm -rf invokeai/frontend/web/node_modules
cd invokeai/frontend/web && pnpm install

# Build the frontend
frontend-build:
Expand Down
91 changes: 33 additions & 58 deletions docs/contributing/INVOCATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ complex functionality.

## Invocations Directory

InvokeAI Nodes can be found in the `invokeai/app/invocations` directory. These can be used as examples to create your own nodes.
InvokeAI Nodes can be found in the `invokeai/app/invocations` directory. These
can be used as examples to create your own nodes.

New nodes should be added to a subfolder in `nodes` direction found at the root level of the InvokeAI installation location. Nodes added to this folder will be able to be used upon application startup.
New nodes should be added to a subfolder in `nodes` direction found at the root
level of the InvokeAI installation location. Nodes added to this folder will be
able to be used upon application startup.

Example `nodes` subfolder structure:

Example `nodes` subfolder structure:
```py
├── __init__.py # Invoke-managed custom node loader
Expand All @@ -30,14 +34,14 @@ Example `nodes` subfolder structure:
└── fancy_node.py
```

Each node folder must have an `__init__.py` file that imports its nodes. Only nodes imported in the `__init__.py` file are loaded.
See the README in the nodes folder for more examples:
Each node folder must have an `__init__.py` file that imports its nodes. Only
nodes imported in the `__init__.py` file are loaded. See the README in the nodes
folder for more examples:

```py
from .cool_node import CoolInvocation
```


## Creating A New Invocation

In order to understand the process of creating a new Invocation, let us actually
Expand Down Expand Up @@ -131,7 +135,6 @@ from invokeai.app.invocations.primitives import ImageField
class ResizeInvocation(BaseInvocation):
'''Resizes an image'''

# Inputs
image: ImageField = InputField(description="The input image")
width: int = InputField(default=512, ge=64, le=2048, description="Width of the new image")
height: int = InputField(default=512, ge=64, le=2048, description="Height of the new image")
Expand Down Expand Up @@ -167,7 +170,6 @@ from invokeai.app.invocations.primitives import ImageField
class ResizeInvocation(BaseInvocation):
'''Resizes an image'''

# Inputs
image: ImageField = InputField(description="The input image")
width: int = InputField(default=512, ge=64, le=2048, description="Width of the new image")
height: int = InputField(default=512, ge=64, le=2048, description="Height of the new image")
Expand Down Expand Up @@ -197,7 +199,6 @@ from invokeai.app.invocations.image import ImageOutput
class ResizeInvocation(BaseInvocation):
'''Resizes an image'''

# Inputs
image: ImageField = InputField(description="The input image")
width: int = InputField(default=512, ge=64, le=2048, description="Width of the new image")
height: int = InputField(default=512, ge=64, le=2048, description="Height of the new image")
Expand Down Expand Up @@ -229,30 +230,17 @@ class ResizeInvocation(BaseInvocation):
height: int = InputField(default=512, ge=64, le=2048, description="Height of the new image")

def invoke(self, context: InvocationContext) -> ImageOutput:
# Load the image using InvokeAI's predefined Image Service. Returns the PIL image.
image = context.services.images.get_pil_image(self.image.image_name)
# Load the input image as a PIL image
image = context.images.get_pil(self.image.image_name)

# Resizing the image
# Resize the image
resized_image = image.resize((self.width, self.height))

# Save the image using InvokeAI's predefined Image Service. Returns the prepared PIL image.
output_image = context.services.images.create(
image=resized_image,
image_origin=ResourceOrigin.INTERNAL,
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.is_intermediate,
)

# Returning the Image
return ImageOutput(
image=ImageField(
image_name=output_image.image_name,
),
width=output_image.width,
height=output_image.height,
)
# Save the image
image_dto = context.images.save(image=resized_image)

# Return an ImageOutput
return ImageOutput.build(image_dto)
```

**Note:** Do not be overwhelmed by the `ImageOutput` process. InvokeAI has a
Expand Down Expand Up @@ -343,27 +331,25 @@ class ImageColorStringOutput(BaseInvocationOutput):

That's all there is to it.

<!-- TODO: DANGER - we probably do not want people to create their own field types, because this requires a lot of work on the frontend to accomodate.

### Custom Input Fields

Now that you know how to create your own Invocations, let us dive into slightly
more advanced topics.

While creating your own Invocations, you might run into a scenario where the
existing input types in InvokeAI do not meet your requirements. In such cases,
you can create your own input types.
existing fields in InvokeAI do not meet your requirements. In such cases, you
can create your own fields.

Let us create one as an example. Let us say we want to create a color input
field that represents a color code. But before we start on that here are some
general good practices to keep in mind.

**Good Practices**
### Best Practices

- There is no naming convention for input fields but we highly recommend that
you name it something appropriate like `ColorField`.
- It is not mandatory but it is heavily recommended to add a relevant
`docstring` to describe your input field.
`docstring` to describe your field.
- Keep your field in the same file as the Invocation that it is made for or in
another file where it is relevant.

Expand All @@ -378,10 +364,13 @@ class ColorField(BaseModel):
pass
```

Perfect. Now let us create our custom inputs for our field. This is exactly
similar how you created input fields for your Invocation. All the same rules
apply. Let us create four fields representing the _red(r)_, _blue(b)_,
_green(g)_ and _alpha(a)_ channel of the color.
Perfect. Now let us create the properties for our field. This is similar to how
you created input fields for your Invocation. All the same rules apply. Let us
create four fields representing the _red(r)_, _blue(b)_, _green(g)_ and
_alpha(a)_ channel of the color.

> Technically, the properties are _also_ called fields - but in this case, it
> refers to a `pydantic` field.

```python
class ColorField(BaseModel):
Expand All @@ -396,25 +385,11 @@ That's it. We now have a new input field type that we can use in our Invocations
like this.

```python
color: ColorField = Field(default=ColorField(r=0, g=0, b=0, a=0), description='Background color of an image')
color: ColorField = InputField(default=ColorField(r=0, g=0, b=0, a=0), description='Background color of an image')
```

### Custom Components For Frontend

Every backend input type should have a corresponding frontend component so the
UI knows what to render when you use a particular field type.

If you are using existing field types, we already have components for those. So
you don't have to worry about creating anything new. But this might not always
be the case. Sometimes you might want to create new field types and have the
frontend UI deal with it in a different way.
### Using the custom field

This is where we venture into the world of React and Javascript and create our
own new components for our Invocations. Do not fear the world of JS. It's
actually pretty straightforward.
When you start the UI, your custom field will be automatically recognized.

Let us create a new component for our custom color field we created above. When
we use a color field, let us say we want the UI to display a color picker for
the user to pick from rather than entering values. That is what we will build
now.
-->
Custom fields only support connection inputs in the Workflow Editor.
Loading
Loading