-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat(ui): model relationship management #7963
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
base: main
Are you sure you want to change the base?
feat(ui): model relationship management #7963
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great, thank you! I've added some minor comments.
There will be some conflicts while rebasing bc I've updated the new model picker again. It will be a bit trickier to add the related models toggle to it.
Fortunately, because we are not allowing users to relate two main models, it's OK to omit the related toggle. In the future when we extend the new picker to other model types (e.g. LoRAs), we will figure out how to integrate related models.
For now, please drop the changes to the new model picker.
You can delete ParamMainModelSelect.tsx
, this file is no longer needed.
PS: I apologize for the delay in getting to review this!
invokeai/app/services/model_relationship_records/model_relationship_records_base.py
Outdated
Show resolved
Hide resolved
invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/RelatedModels.tsx
Outdated
Show resolved
Hide resolved
invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/RelatedModels.tsx
Outdated
Show resolved
Hide resolved
invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/RelatedModels.tsx
Outdated
Show resolved
Hide resolved
9631e4a
to
f8c63c1
Compare
Adds full support for managing model-to-model relationships in the UI and backend. Introduces RelatedModels subpanel for linking and unlinking models in model management. - Adds REST API routes for adding, removing, and retrieving model relationships. - New database migration: creates model_relationships table for bidirectional links. - New service layer (model_relationships) for relationship management. - Updated frontend: Related models float to top of LoRA/Main grouped model comboboxes for quick access. - Added 'Show Only Related' toggle badge to MainModelPicker filter bar **Amended commit to remove changes to ParamMainModelSelect.tsx and MainModelPicker.tsx to avoid conflict with upstream deletion/ rewrite**
removed unused AnyModelConfig related methods, removed unused get_related_model_key_count method.
Major cleanup of RelatedModels.tsx for improved readability, structure, and maintainability. Dried out repetitive logic Consolidated model type sorting into reusable helpers Added disallowed model type relationships to prevent broken connections (e.g. VAE ↔ LoRA) - Aware this introduces a new constraint—open to feedback (see PR comment) Some naming and types may still need refinement; happy to revisit
f8c63c1
to
3dc2e71
Compare
For the sake of a clean commit history, I reset and amended the PR commit to remove changes to ParamMainModelSelect.tsx and MainModelPicker.tsx. These files were either deleted or reworked upstream, so this avoids unnecessary conflicts. I opted not to cherry-pick the deletion or do rebase acrobatics until the PR is approved, to keep things easier to track and adjust if needed. Note: Some previous comments may now refer to code that no longer exists in the diff—feel free to flag anything still relevant, and I’ll handle it. |
Adds full support for managing model-to-model relationships in the UI and backend.
Introduces RelatedModels subpanel for linking and unlinking models in model management.
Summary
Introduces a full system for managing model-to-model relationships.
New database migration: model_relationships table (bidirectional, FK constrained, cascade deletes, sorted input).
New service layer: model_relationships for API interaction.
New UI subpanel (RelatedModels) for linking/unlinking models in the Model Manager.
UI on frontend linked to relationships, pulling either to the top, or allowing filters.
Rebased due to snazzy new model selector that happened this week.
Notes
base_model
types (or any model with the base typeany
) in the UI.related_model_ids
) on models for optimized frontend access (instead of extra API calls).First PR, Please be gentle.
Related Issues / Discussions
Part of 7894 used_with tag support.
QA Instructions
Ran Lint, Prettier, pnpm test, Made sure UI and API routes functioned with DB open to watch.
Merge Plan
Unless a migration happens between now and PR, Rebase if needed and repush? Honestly not completely sure what's needed here, but more than willing to work for whatever is needed.
Checklist
What's New
copy (if doing a release after this PR)