Workflow: auto-create nodes for model nodes, Output button, copyable errors, and document the API oauth_token param - #13685
Merged
Merged
Conversation
…e errors Addresses three of the remaining items in #13665: - Adding a model node from the picker now spawns its input and output components and wires them up, the same ready-to-run subgraph that Space nodes have always produced. Previously a fresh model node appeared with nothing attached, so it looked like it ran but produced nothing. - The bottom bar gains an "Output" button alongside "Input" (output nodes were only reachable by dragging from a port), and "Data" is renamed "Dataset" to match its icon, tooltip and DATASET_MODALITY constant. - Node error banners get a "copy" button, so a failure can be pasted somewhere useful — canvas nodes swallow text selection for dragging. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
🪼 branch checks and previews
Install Gradio from this PR pip install https://huggingface.co/buckets/gradio/pypi-previews/resolve/1e52482b527612ebdc16fa4cdac675fbc873dc8b/gradio-6.21.0-py3-none-any.whlInstall Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@1e52482b527612ebdc16fa4cdac675fbc873dc8b#subdirectory=client/python"Import Gradio JS Client from this PR via CDN import { Client } from "https://huggingface.co/buckets/gradio/npm-previews/resolve/1e52482b527612ebdc16fa4cdac675fbc873dc8b/browser.js"; |
Collaborator
🦄 change detectedThis Pull Request includes changes to the following packages.
|
#13667 landed, so a caller can now hand a workflow a token via the request body. Subgraph endpoints already declare one — `_build_endpoint_fn` synthesizes `token: Optional[OAuthToken]` into the signature, so `/info` reports `oauth_token: "optional"` for them — but the workflow's own View API panel said nothing about it, which was the last item blocking API access to Space-hosted workflows from being usable. `describe_workflow_api` now reports the requirement, asked of the same builder that registers the endpoints so the panel can't drift from `/info`, and the panel adds a note plus `oauth_token` in all three snippets. Also fixes the panel's file-parameter examples, which no client accepted: the curl body needs the FileData payload (`{"path": ..., "meta": {...}}`) and the JS snippet needs `handle_file`, where both previously emitted a bare URL string. Verified by running the generated request: upload → call → the workflow's function receives OAuthToken(token='hf_DOCS_CHECK'). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replaces the bottom bar's Input/Output pair with a single "Component" button. A component's direction was never really the user's to declare: `WorkflowNodeSF` already picks between an editable widget and a read-only output tile purely from whether the node's input port is connected, and the port-drag path already infers the role from drag direction. The bar was the one place that made the user pre-commit. `reconcileComponentRoles` makes the role a function of the edge set — driven components are subjects, undriven ones are references — and runs on every edge mutation plus on load. Without it the collections could disagree with the rendering, and that mattered: `workflow_api.py` builds endpoint parameters from `references` (skipping any with an incoming edge) and endpoints themselves from `subjects`, so a node that rendered as an output while still filed under `references` contributed no endpoint at all. That was reachable before this change — wire a model into an Input node and its subgraph silently vanished from the API — and the new Output button would only have widened the target. Flipped nodes append rather than merge in place, since `subject_groups` fixes the API's output-tuple order from `subjects` order. API panel, from review feedback: - the `oauth_token` note moves out of the per-endpoint cards to a single note beneath all of them, so it doesn't read as one of the endpoint's own parameters, and is cut down to one sentence with a link - Copy moves onto the code block it copies - long snippets scroll instead of being clipped: `overflow: hidden` on the endpoint card resolved its flex minimum size to 0, so cards shrank to fit the panel and cut their code mid-line Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
abidlabs
marked this pull request as ready for review
July 29, 2026 20:52
Collaborator
|
did some testing and think this is good to go. much better model UX, and the copyable error is also a handy addition. much better API docs too now! thanks @abidlabs! |
hannahblair
reviewed
Jul 30, 2026
| .api-code { | ||
| margin: 0; | ||
| padding: var(--size-3) 14px; | ||
| /* Right padding clears the absolutely positioned Copy button. */ |
Collaborator
There was a problem hiding this comment.
claude comments around css are probably overkill
hannahblair
approved these changes
Jul 30, 2026
Member
Author
|
Thanks for the review @hannahblair! Will address and get this in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Picks off three of the remaining items in #13665. Each was verified by driving the real canvas in a browser.
Auto-create input/output nodes for model nodes
handlePickerCreateonly built the ready-to-run subgraph whentemplate.source === "space", so a freshly added model node arrived with nothing attached — the issue's "not having the output node can make it seem like the node runs but doesn't produce anything". Model templates already carry typed ports (fromTASK_SCHEMAS, which the picker filters on), so the existing companion-spawning logic works unchanged for them.Adding
FLUX.1-schnell(text-to-image) now yieldsText→FLUX.1-schnell→Image, wired and ready to run.Note this is bounded by
SUBGRAPH_PORT_TYPES, exactly as for Spaces:object-detectionoutputsjson, which isn't a component type, so that model still gets only an input companion. Unchanged behaviour, just now shared.An "Output" button, and "Data" → "Dataset"
The bar had
Inputbut noOutput, so output nodes were only reachable by dragging from a port.addInputNode/addOutputNodenow share one helper that differs only in node role (referencevssubject), and that helper reuses the existinggetComponentForPortTypeinstead of rebuilding its own port-type → component map."Data" is renamed "Dataset" — the button already used
DatasetIcon,title="Add dataset node"andDATASET_MODALITY, so the label was the odd one out.I did not remove the
Inputbutton. The issue asks whether it's needed at all; that's a product call, and dropping it would be the destructive reading.Copyable node errors
Node error banners now have a
copybutton next toshow more. Canvas nodes suppress text selection for dragging, so selecting the message by hand isn't possible.Document the API
oauth_tokenparamNow that #13667 has landed. Subgraph endpoints already take a token —
_build_endpoint_fnsynthesizestoken: Optional[OAuthToken]into the advertised signature, so/inforeportsoauth_token: "optional"for them (verified against a running workflow) — but the workflow's own View API panel said nothing about it, which was the last thing standing between "the fix landed" and "an API caller can actually use a Space-hosted workflow".