Repository navigation
[Blazor] Add tool-based generative UI dojo scenario - #68330
Merged
Merged
Conversation
javiercn
force-pushed
the
javiercn-components-ai-06-tool-generative-ui
branch
from
August 11, 2026 07:10
c9dc674 to
7ad9a88
Compare
javiercn
force-pushed
the
javiercn-components-ai-06-tool-generative-ui
branch
from
August 12, 2026 13:10
7ad9a88 to
169074a
Compare
kotlarmilos
force-pushed
the
javiercn-components-ai-06-tool-generative-ui
branch
from
August 12, 2026 16:47
169074a to
fe640b1
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new “Tool-Based Generative UI” dojo scenario (position 6 in the native Components.AI stack) that exercises AG-UI tool-call serialization and SSE streaming over the real DojoClient → AGUIDojoApi HTTP boundary. The scenario registers a generate_haiku UI action, maps tool arguments into component state to render a haiku carousel during streaming, and includes deterministic E2E coverage via recorded API-side model replay.
Changes:
- Register and expose the new
/tool_based_generative_uiscenario in DojoClient (routing, DI keyedIChatClient, navigation entry). - Add new UI components (scenario page, action renderer, haiku card/carousel + CSS) driven by
generate_haikutool arguments. - Add a checkpointed Playwright E2E test plus recorded model baseline and scripted live fallback in AGUIDojoApi.
Show a summary per file
| File | Description |
|---|---|
| src/Components/AI/testassets/DojoClient/Program.cs | Registers a keyed IChatClient for the new tool-based generative UI endpoint. |
| src/Components/AI/testassets/DojoClient/DojoScenarios.cs | Adds the ToolBasedGenerativeUIEndpoint scenario constant. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/ToolBasedGenerativeUIScenario.razor.css | Layout styling for split display/chat view and responsive behavior. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/ToolBasedGenerativeUIScenario.razor | New scenario page wiring UIAgent + generate_haiku UI action and carousel state updates. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/HaikuData.cs | Adds the scenario data model for haiku content and presentation fields. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/HaikuCarousel.razor.css | Styling for carousel navigation controls and counter. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/HaikuCarousel.razor | Carousel component that renders a single card and navigates between haikus. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/HaikuCard.razor.css | Styling for the haiku “card” presentation. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/HaikuCard.razor | Card component rendering Japanese + English lines with gradient background. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/GenerateHaikuAction.razor.css | Styling for the action status line. |
| src/Components/AI/testassets/DojoClient/Components/Scenarios/ToolBasedGenerativeUI/GenerateHaikuAction.razor | Auto-invokes the UI action block and displays completion status. |
| src/Components/AI/testassets/DojoClient/Components/Pages/Home.razor | Adds the new scenario link to the home page list. |
| src/Components/AI/testassets/DojoClient/Components/_Imports.razor | Imports the new scenario namespace for component usage. |
| src/Components/AI/testassets/DojoClient.E2E.Tests/Tests/ToolBasedGenerativeUIScenarioTests.cs | Adds Playwright E2E coverage validating render-during-streaming + carousel navigation. |
| src/Components/AI/testassets/DojoClient.E2E.Tests/ServiceOverrides/DojoModelOverrides.cs | Hooks the new scenario to a recorded model baseline for determinism. |
| src/Components/AI/testassets/DojoClient.E2E.Tests/Baselines/ToolBasedGenerativeUI.recording.json | Recorded model frames/tool call+result for the scenario’s deterministic replay. |
| src/Components/AI/testassets/AGUIDojoApi/ScriptedChatClient.cs | Adds a live scripted fallback for generate_haiku and its continuation summary. |
| src/Components/AI/testassets/AGUIDojoApi/Program.cs | Maps the new dojo endpoint to the corresponding system prompt. |
| src/Components/AI/testassets/AGUIDojoApi/ChatClientAgentFactory.cs | Adds the ToolBasedGenerativeUISystemPrompt for the new scenario contract. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 19/19 changed files
- Comments generated: 2
- Review effort level: Lite
javiercn
force-pushed
the
javiercn-components-ai-06-tool-generative-ui
branch
from
August 13, 2026 09:55
fe640b1 to
cf1356d
Compare
ilonatommy
force-pushed
the
javiercn-components-ai-06-tool-generative-ui
branch
from
August 14, 2026 12:37
cf1356d to
e335258
Compare
ilonatommy
force-pushed
the
javiercn-components-ai-06-tool-generative-ui
branch
from
August 20, 2026 06:55
e335258 to
37849fc
Compare
ilonatommy
force-pushed
the
javiercn-components-ai-06-tool-generative-ui
branch
from
August 21, 2026 14:22
cf1d845 to
dae3619
Compare
Base automatically changed from
javiercn-components-ai-05-human-in-loop
to
main
August 25, 2026 08:11
Rationale: demonstrate canonical Tool-Based Generative UI across the real DojoClient to AGUIDojoApi HTTP/SSE boundary by painting rich browser UI from a streamed client-tool call. Implementation: add the /tool_based_generative_ui endpoint and keyed AGUIChatClient, declare generate_haiku as a browser UI action, and render generated Japanese and English verse in an interactive gradient-card carousel. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 323b0ef8-7905-4041-8388-a08586c0bd34
Rationale: lock down streamed rich client-tool rendering and carousel interactivity without replacing DojoClient's real AG-UI transport. Implementation: add API-side model replay registration and focused dual-host browser assertions for the placeholder card, generated haiku, in-progress assistant stream, and bidirectional carousel navigation. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 323b0ef8-7905-4041-8388-a08586c0bd34
Rationale: keep deterministic Tool-Based Generative UI browser coverage independent of live model credentials while exercising the real AG-UI HTTP/SSE boundary. Implementation: record the generate_haiku call, exact Japanese and English arguments, gradient card data, tool result continuation, and two streamed summary checkpoints. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 323b0ef8-7905-4041-8388-a08586c0bd34
Co-authored-by: Copilot <[email protected]>
ilonatommy
force-pushed
the
javiercn-components-ai-06-tool-generative-ui
branch
from
August 25, 2026 08:11
dae3619 to
c6b49da
Compare
Member
|
Current flow is:
In CopilotKit developer can disable the last follow-up message to save costs. We could have similar API that skips the last step in some scenarios. |
ilonatommy
approved these changes
Aug 25, 2026
dariatiurina
approved these changes
Aug 25, 2026
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.
Overview
Adds the canonical Tool-Based Generative UI dojo scenario as position 6 in the native Components.AI stack tracked by #68340, stacked on #68329. This three-commit layer changes only dojo/test assets: it composes the existing client-action APIs to paint a streamed
generate_haikucall as rich UI, without adding a shipping product API. The governing constraint is preserved end to end: the browser still uses DojoClient'sAGUIChatClientover real HTTP/SSE to AGUIDojoApi; deterministic replay replaces only the API-side model.Design
The scenario introduces one internal protocol contract:
/tool_based_generative_uiadvertisesgenerate_haiku, whose arguments contain exactly three Japanese lines, three English lines, an image name, and a CSS gradient. The UI accepts only the demonstrated two-color linear-gradient format and falls back to the placeholder gradient for other values. The API prompt owns the model-facing shape, while the UI registers the same route as a keyedIChatClientso scenario selection cannot silently fall back to another endpoint.The deliberate alternative not taken is an in-process or directly mocked UI client: that would make the card test easier but would stop testing AG-UI tool serialization and SSE parsing. The remaining contract additions are internal scenario composition, not new framework surface:
UIActionBlockselectsgenerate_haiku, andHaikuDatafeeds the card/carousel renderers.Implementation
The user-facing entry point registers the existing client-action mechanism and maps the completed tool arguments into observable component state. Appending rather than replacing preserves the placeholder and prior generated cards; selecting the newest index makes progressive generation visible immediately.
The repeated files fall into three equivalence classes. Scenario glue (
Home.razor,_Imports.razor,DojoScenarios.cs, and bothProgram.csfiles) only makes the route discoverable and keeps endpoint selection aligned. Presentation (HaikuData,GenerateHaikuAction,HaikuCard,HaikuCarousel, and their CSS) has one lifecycle rule: invoke the action once, then render the latest card while previous/next buttons clamp to valid indices. Deterministic coverage (DojoModelOverrides, the scenario test, and the generated recording) uses one representative nature haiku with two summary checkpoints; the scripted live fallback mirrors the same call/result shape for credential-free manual use.The browser test proves the lifecycle rather than only checking final markup: the card exists while assistant text still has the streaming class, navigation works before completion, and only then does the API-side checkpoint release the continuation.
Outcome
Review guidance: read the endpoint/client pairing,
ToolBasedGenerativeUIScenario.razor,GenerateHaikuAction.razor, and the checkpointed E2E flow closely. The card/carousel CSS and recorded Japanese/English fixture values are equivalent presentation data and can be spot-checked. Acceptance is met when the card appears from tool arguments during streaming, carousel navigation remains interactive, and the same turn completes over the real dual-host transport.Validation: dependency-aware E2E build passed with 0 warnings and 0 errors; runtime build passed with 0 warnings and 0 errors;
AgentContextUIActionTestspassed 4/4;ToolBasedGenerativeUIScenarioTestspassed 1/1.