Compare commits

...

18 Commits

Author SHA1 Message Date
0acf800015 update URL for bulk download placeholder 2023-11-15 08:49:15 -05:00
fa031156ab Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-11-15 08:48:33 -05:00
d19460bda3 Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-30 12:22:55 -04:00
cc901e5ace Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-27 09:51:59 -04:00
c8d6bec9b3 Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-17 12:47:21 -04:00
3c044bb245 Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-17 11:06:43 -04:00
af5341b39d Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-13 10:07:42 -04:00
0e60f3dac1 chore: typegen 2023-10-12 09:23:10 -04:00
ce9183113b fix: fix test imports 2023-10-12 09:23:10 -04:00
ff4a57f883 chore(ui): regen types 2023-10-12 09:23:10 -04:00
0f361cc3f1 fix(app): remove errant logger line 2023-10-12 09:23:10 -04:00
028fe7eb04 chore: rebase conflicts 2023-10-12 09:23:10 -04:00
efda2ded7a fix: merge conflicts 2023-10-12 09:23:10 -04:00
899935a861 fix(backend): remove logic to create workflows column
Snuck in there while I was organising
2023-10-12 09:23:10 -04:00
94c00cee4c feat: refactor services folder/module structure
Refactor services folder/module structure.

**Motivation**

While working on our services I've repeatedly encountered circular imports and a general lack of clarity regarding where to put things. The structure introduced goes a long way towards resolving those issues, setting us up for a clean structure going forward.

**Services**

Services are now in their own folder with a few files:

- `services/{service_name}/__init__.py`: init as needed, mostly empty now
- `services/{service_name}/{service_name}_base.py`: the base class for the service
- `services/{service_name}/{service_name}_{impl_type}.py`: the default concrete implementation of the service - typically one of `sqlite`, `default`, or `memory`
- `services/{service_name}/{service_name}_common.py`: any common items - models, exceptions, utilities, etc

Though it's a bit verbose to have the service name both as the folder name and the prefix for files, I found it is _extremely_ confusing to have all of the base classes just be named `base.py`. So, at the cost of some verbosity when importing things, I've included the service name in the filename.

There are some minor logic changes. For example, in `InvocationProcessor`, instead of assigning the model manager service to a variable to be used later in the file, the service is used directly via the `Invoker`.

**Shared**

Things that are used across disparate services are in `services/shared/`:

- `default_graphs.py`: previously in `services/`
- `graphs.py`: previously in `services/`
- `paginatation`: generic pagination models used in a few services
- `sqlite`: the `SqliteDatabase` class, other sqlite-specific things
2023-10-12 09:23:10 -04:00
021f92fadc feat(backend): rename db.py to sqlite.py 2023-10-12 09:23:10 -04:00
fe4c5a68c4 feat(backend): move pagination models to own file 2023-10-12 09:23:10 -04:00
4f2318571d feat(backend): organise service dependencies
**Service Dependencies**

Services that depend on other services now access those services via the `Invoker` object. This object is provided to the service as a kwarg to its `start()` method.

Until now, most services did not utilize this feature, and several services required their dependencies to be initialized and passed in on init.

Additionally, _all_ services are now registered as invocation services - including the low-level services. This obviates issues with inter-dependent services we would otherwise experience as we add workflow storage.

**Database Access**

Previously, we were passing in a separate sqlite connection and corresponding lock as args to services in their init. A good amount of posturing was done in each service that uses the db.

These objects, along with the sqlite startup and cleanup logic, is now abstracted into a simple `SqliteDatabase` class. This creates the shared connection and lock objects, enables foreign keys, and provides a `clean()` method to do startup db maintenance.

This is not a service as it's only used by sqlite services.
2023-10-12 09:23:10 -04:00
2 changed files with 2 additions and 2 deletions

View File

@ -366,7 +366,7 @@ class ImagesDownloaded(BaseModel):
)
@images_router.post("/download", operation_id="download_images_from_list", response_model=ImagesDownloaded)
@images_router.post("/export", operation_id="download_images_from_list", response_model=ImagesDownloaded)
async def download_images_from_list(
image_names: list[str] = Body(description="The list of names of images to download", embed=True),
board_id: Optional[str] = Body(

View File

@ -1543,7 +1543,7 @@ export const imagesApi = api.injectEndpoints({
components['schemas']['Body_download_images_from_list']
>({
query: ({ image_names, board_id }) => ({
url: `images/download`,
url: `images/export`,
method: 'POST',
body: {
image_names,