[feat] Filter out nlf model type from Upload Model flow#7793
[feat] Filter out nlf model type from Upload Model flow#7793luke-mino-altherr merged 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughA filter mechanism was added to the model types composable to exclude specific model folders from being returned. A new constant defines disallowed model type names, and filtering logic was integrated into the model types fetch flow to remove matching entries. Changes
✨ Finishing touches
Comment |
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 12/29/2025, 07:45:35 PM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Test Results⏰ Completed at: 12/29/2025, 07:54:28 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
Add filtering to exclude the "nlf" (no-license-file) model type from appearing in the model type dropdown during the Upload Model wizard. This prevents users from selecting this internal model category when uploading models. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
139e6b8 to
734775b
Compare
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 3.19 MB (baseline 3.19 MB) • ⚪ 0 BMain entry bundles and manifests
Status: 3 added / 3 removed Graph Workspace — 996 kB (baseline 996 kB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 6.54 kB (baseline 6.54 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 1 added / 1 removed Panels & Settings — 296 kB (baseline 296 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 6 added / 6 removed UI Components — 196 kB (baseline 196 kB) • 🔴 +142 BReusable component library chunks
Status: 8 added / 8 removed Data & Services — 12.5 kB (baseline 12.5 kB) • ⚪ 0 BStores, services, APIs, and repositories
Status: 2 added / 2 removed Utilities & Hooks — 1.41 kB (baseline 1.41 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 1 added / 1 removed Vendor & Third-Party — 9.1 MB (baseline 9.1 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 3.46 MB (baseline 3.46 MB) • ⚪ 0 BBundles that do not match a named category
Status: 20 added / 20 removed |
|
Is this particular composable only used in the upload model flow or is it intended to be general purpose? |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/platform/assets/composables/useModelTypes.ts
🧰 Additional context used
📓 Path-based instructions (11)
src/**/*.{vue,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{vue,ts}: Leverage VueUse functions for performance-enhancing styles
Implement proper error handling
Use vue-i18n in composition API for any string literals. Place new translation entries in src/locales/en/main.json
Files:
src/platform/assets/composables/useModelTypes.ts
src/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.ts: Use es-toolkit for utility functions
Use TypeScript for type safety
Files:
src/platform/assets/composables/useModelTypes.ts
src/**/{services,composables}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/{services,composables}/**/*.{ts,tsx}: Useapi.apiURL()for backend endpoints instead of constructing URLs directly
Useapi.fileURL()for static file access instead of constructing URLs directly
Files:
src/platform/assets/composables/useModelTypes.ts
src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/*.{ts,tsx,vue}: Sanitize HTML with DOMPurify to prevent XSS attacks
Avoid using @ts-expect-error; use proper TypeScript types instead
Use es-toolkit for utility functions instead of other utility libraries
Implement proper TypeScript types throughout the codebase
Files:
src/platform/assets/composables/useModelTypes.ts
src/**/{composables,components}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Clean up subscriptions in state management to prevent memory leaks
Files:
src/platform/assets/composables/useModelTypes.ts
src/**/*.{vue,ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Follow Vue 3 composition API style guide
Files:
src/platform/assets/composables/useModelTypes.ts
src/**/{components,composables}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Use vue-i18n for ALL user-facing strings by adding them to
src/locales/en/main.json
Files:
src/platform/assets/composables/useModelTypes.ts
**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,vue}: Use TypeScript exclusively; do not write new JavaScript code
Use sorted and grouped imports organized by plugin/source
Enforce ESLint rules including Vue + TypeScript rules, disallow floating promises, disallow unused imports, and restrict i18n raw text in templates
Do not useanytype oras anytype assertions; fix the underlying type issue instead
Write code that is expressive and self-documenting; avoid redundant comments and clean as you go
Keep functions short and functional; minimize nesting and follow the arrow anti-pattern
Avoid mutable state; prefer immutability and assignment at point of declaration
Use function declarations instead of function expressions when possible
Use es-toolkit for utility functions
Implement proper error handling in code
Files:
src/platform/assets/composables/useModelTypes.ts
**/**/use[A-Z]*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Name composables using the pattern
useXyz.ts
Files:
src/platform/assets/composables/useModelTypes.ts
**/*.{ts,tsx,vue,js,jsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Apply Prettier formatting with 2-space indentation, single quotes, no trailing semicolons, and 80-character line width
Files:
src/platform/assets/composables/useModelTypes.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Minimize the surface area (exported values) of each module and composable
Files:
src/platform/assets/composables/useModelTypes.ts
🧠 Learnings (5)
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/*.{ts,tsx,vue} : Implement proper TypeScript types throughout the codebase
Applied to files:
src/platform/assets/composables/useModelTypes.ts
📚 Learning: 2025-12-09T03:39:54.501Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7169
File: src/platform/remote/comfyui/jobs/jobTypes.ts:1-107
Timestamp: 2025-12-09T03:39:54.501Z
Learning: In the ComfyUI_frontend project, Zod is on v3.x. Do not suggest Zod v4 standalone validators (z.uuid, z.ulid, z.cuid2, z.nanoid) until an upgrade to Zod 4 is performed. When reviewing TypeScript files (e.g., src/platform/remote/comfyui/jobs/jobTypes.ts) validate against Zod 3 capabilities and avoid introducing v4-specific features; flag any proposal to upgrade or incorporate v4-only validators and propose staying with compatible 3.x patterns.
Applied to files:
src/platform/assets/composables/useModelTypes.ts
📚 Learning: 2025-12-13T11:03:11.264Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7416
File: src/stores/imagePreviewStore.ts:5-7
Timestamp: 2025-12-13T11:03:11.264Z
Learning: In the ComfyUI_frontend repository, lint rules require keeping 'import type' statements separate from non-type imports, even if importing from the same module. Do not suggest consolidating them into a single import statement. Ensure type imports remain on their own line (import type { ... } from 'module') and regular imports stay on separate lines.
Applied to files:
src/platform/assets/composables/useModelTypes.ts
📚 Learning: 2025-12-17T00:40:09.635Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.stories.ts:45-55
Timestamp: 2025-12-17T00:40:09.635Z
Learning: Prefer pure function declarations over function expressions (e.g., use function foo() { ... } instead of const foo = () => { ... }) for pure functions in the repository. Function declarations are more functional-leaning, offer better hoisting clarity, and can improve readability and tooling consistency. Apply this guideline across TypeScript files in Comfy-Org/ComfyUI_frontend, including story and UI component code, except where a function expression is semantically required (e.g., callbacks, higher-order functions with closures).
Applied to files:
src/platform/assets/composables/useModelTypes.ts
📚 Learning: 2025-12-11T12:25:15.470Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7358
File: src/components/dialog/content/signin/SignUpForm.vue:45-54
Timestamp: 2025-12-11T12:25:15.470Z
Learning: This repository uses CI automation to format code (pnpm format). Do not include manual formatting suggestions in code reviews for Comfy-Org/ComfyUI_frontend. If formatting issues are detected, rely on the CI formatter or re-run pnpm format. Focus reviews on correctness, readability, performance, accessibility, and maintainability rather than style formatting.
Applied to files:
src/platform/assets/composables/useModelTypes.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: setup
- GitHub Check: test
🔇 Additional comments (1)
src/platform/assets/composables/useModelTypes.ts (1)
56-61: No action needed. The filtering in the shared composable is correctly scoped to the Upload Model flow—useModelTypesis used only inUploadModelDialog.vueandUploadModelConfirmation.vue, both of which are part of the Upload Model flow. The implementation aligns with the stated PR scope.Likely an incorrect or invalid review comment.
| .filter( | ||
| (folder) => | ||
| !DISALLOWED_MODEL_TYPES.includes( | ||
| folder.name as (typeof DISALLOWED_MODEL_TYPES)[number] | ||
| ) | ||
| ) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Type assertion can be removed after fixing the constant declaration.
The type assertion folder.name as (typeof DISALLOWED_MODEL_TYPES)[number] is a workaround for the type incompatibility caused by as const on line 40. Once that constant is typed as readonly string[], this simplifies to:
.filter(
- (folder) =>
- !DISALLOWED_MODEL_TYPES.includes(
- folder.name as (typeof DISALLOWED_MODEL_TYPES)[number]
- )
+ (folder) => !DISALLOWED_MODEL_TYPES.includes(folder.name)
)Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/platform/assets/composables/useModelTypes.ts around lines 56 to 61, the
explicit type assertion on folder.name is compensating for the constant being
declared with as const; change the DISALLOWED_MODEL_TYPES declaration (around
line 40) from using as const to a readonly string[] type (e.g. declare it as
const DISALLOWED_MODEL_TYPES: readonly string[] = [...]) so its element type is
string, then remove the unnecessary assertion in the filter and use folder.name
directly in the includes check.
There was a problem hiding this comment.
I'd probably do a
type DisallowedModelType = (typeof DISALLOWED_MODEL_TYPES)[number]to make this a little cleaner.
There was a problem hiding this comment.
@DrJKL That's a nice approach! Creating the DisallowedModelType type alias keeps the benefits of as const (literal type inference for 'nlf') while making the type assertion much more readable and maintainable. It's cleaner than repeating (typeof DISALLOWED_MODEL_TYPES)[number] inline and also more self-documenting.
If more disallowed types are added in the future, the type alias would automatically expand to the union type (e.g., 'nlf' | 'other'), which is a nice bonus for type safety compared to just using readonly string[].
🧠 Learnings used
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.562Z
Learning: Applies to **/*.{ts,tsx,vue} : Do not use `any` type or `as any` type assertions; fix the underlying type issue instead
## Summary Filters out the "nlf" (no-license-file) model type from the Upload Model wizard's model type dropdown, preventing users from selecting this internal category. ## Changes - **What**: Added DISALLOWED_MODEL_TYPES constant and filter in useModelTypes composable - **Scope**: Only affects Upload Model flow (used by UploadModelDialog and UploadModelConfirmation) ## Test plan - [ ] Open Upload Model dialog and verify "nlf" does not appear in model type dropdown - [ ] Verify other model types still appear correctly - [ ] Verify dropdown still functions as expected 🤖 Generated with [Claude Code](https://claude.com/claude-code) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7793-feat-Filter-out-nlf-model-type-from-Upload-Model-flow-2d86d73d3650811f88e1fcc8dd7040cd) by [Unito](https://www.unito.io) Co-authored-by: Claude <noreply@anthropic.com>
|
@luke-mino-altherr Successfully backported to #7883 |
## Summary Filters out the "nlf" (no-license-file) model type from the Upload Model wizard's model type dropdown, preventing users from selecting this internal category. ## Changes - **What**: Added DISALLOWED_MODEL_TYPES constant and filter in useModelTypes composable - **Scope**: Only affects Upload Model flow (used by UploadModelDialog and UploadModelConfirmation) ## Test plan - [ ] Open Upload Model dialog and verify "nlf" does not appear in model type dropdown - [ ] Verify other model types still appear correctly - [ ] Verify dropdown still functions as expected 🤖 Generated with [Claude Code](https://claude.com/claude-code) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7793-feat-Filter-out-nlf-model-type-from-Upload-Model-flow-2d86d73d3650811f88e1fcc8dd7040cd) by [Unito](https://www.unito.io) Co-authored-by: Claude <noreply@anthropic.com>
|
@luke-mino-altherr Successfully backported to #7886 |
Summary
Filters out the "nlf" (no-license-file) model type from the Upload Model wizard's model type dropdown, preventing users from selecting this internal category.
Changes
Test plan
🤖 Generated with Claude Code
┆Issue is synchronized with this Notion page by Unito