Skip to content

feat(nodes): add managed file inputs#9302

Open
Gohankaiju wants to merge 5 commits into
invoke-ai:mainfrom
Gohankaiju:feat/managed-file-inputs
Open

feat(nodes): add managed file inputs#9302
Gohankaiju wants to merge 5 commits into
invoke-ai:mainfrom
Gohankaiju:feat/managed-file-inputs

Conversation

@Gohankaiju

@Gohankaiju Gohankaiju commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Closes #9300

This PR adds a first pass of managed file inputs for custom nodes.

It introduces a lightweight FileField flow so node authors can accept document/data files through the InvokeAI UI, instead of requiring users to provide server-local paths or embedding file contents in workflow data. This is especially important for hosted deployments, but is also useful for local/self-hosted users because files can be attached directly from the node input UI.

What is included:

  • FileField invocation field support
  • Managed file upload/get/delete API
  • Node input UI for uploading and clearing a file reference
  • Server-managed file storage using stable file_id references
  • Invocation-side access via context.files
  • Extension/MIME allowlists and configurable upload size limit
  • Upload body size limiting for the managed file upload endpoint
  • Backend tests
  • Regenerated OpenAPI schema and frontend API types

This first pass is intentionally scoped to node inputs. It does not add gallery/boards integration, previews, thumbnails, search, starring, or bulk file management.

Clearing a node input currently removes the node's reference only. Automatic server-side deletion is left out for now because the same file_id may still be referenced by saved workflows, copied nodes, or queued executions.

Related Issues / Discussions

Refs #9300

QA Instructions

Automated checks run locally:

uv run ruff check invokeai/app/api_app.py invokeai/app/api/dependencies.py invokeai/app/api/routers/files.py invokeai/app/services/config/config_default.py invokeai/app/services/files tests/app/services/files/test_files_disk.py
uv run --extra test pytest tests/app/services/files/test_files_disk.py
uv run python -m compileall -q invokeai/app/api_app.py invokeai/app/api/dependencies.py invokeai/app/api/routers/files.py invokeai/app/services/files invokeai/app/services/shared/invocation_context.py invokeai/app/services/invocation_services.py invokeai/app/invocations/fields.py invokeai/invocation_api/__init__.py
corepack pnpm@10.12.4 -C invokeai/frontend/web exec eslint --max-warnings=0 src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FileFieldInputComponent.tsx src/services/api/endpoints/files.ts
corepack pnpm@10.12.4 -C invokeai/frontend/web lint:tsc
uv run python scripts/generate_openapi_schema.py | corepack pnpm@10.12.4 -C invokeai/frontend/web typegen
git diff --check

Startup smoke test:

uv run invokeai-web --root /tmp/invokeai-managed-file-review-startup

Confirmed startup reached Invoke running on http://127.0.0.1:9090.

Still validating before marking ready for review:

  • End-to-end custom node workflow using FileField
  • Browser upload of a PDF into a node input
  • Invocation-side file access through context.files

Merge Plan

Draft PR for design and implementation feedback.

No database schema migration is included. No gallery/boards file lifecycle is introduced in this first pass.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration (N/A: adds handling for a new field value type; does not migrate existing persisted state)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions Bot added api python PRs that change python files invocations PRs that change invocations services PRs that change app services frontend PRs that change frontend files python-tests PRs that change python tests labels Jun 25, 2026
@Gohankaiju Gohankaiju marked this pull request as ready for review June 26, 2026 04:04
@lstein lstein added the 6.14.x label Jul 10, 2026
@lstein lstein assigned dunkeroni and unassigned JPPhoto Jul 10, 2026
@lstein

lstein commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

@Gohankaiju I'm afraid there are merge conflicts in api_app.py and invocation_services.py. After you resolve these, please make frontend-openapi frontend-typegen to fix the problems in openapi.json and schema.ts.

@Gohankaiju

Copy link
Copy Markdown
Author

@lstein Thanks for the heads-up! I've merged main, resolved the conflicts in api_app.py and invocation_services.py, and ran make frontend-openapi frontend-typegen to regenerate openapi.json and schema.ts.

@JPPhoto

JPPhoto commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

@Gohankaiju It looks like a CI action is failing for docs. To fix:

cd docs
pnpm run generate-docs-data

Then add, commit, and push docs/src/generated/invocation-context.json and docs/src/generated/settings.json.

Add FilesInterface to the generated invocation context docs and pick up
the new max_file_upload_size_bytes setting.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the docs PRs that change docs label Jul 10, 2026
@Gohankaiju

Copy link
Copy Markdown
Author

@JPPhoto
Thanks! Regenerated and committed the docs data. Also added FilesInterface to INTERFACE_NAMES in generate_docs_json.py so its methods are included in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.14.x api docs PRs that change docs frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files python-tests PRs that change python tests services PRs that change app services

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[enhancement]: Add managed file inputs for custom nodes

4 participants