Skip to content

AI scenarios

Forms

Bit.BlazorUI.AI Scripted transport

The model proposes a form from a JSON Schema, the user corrects it, and the corrected values are what execute.

Live demo

Ask it to book something: check the form it proposes, correct it, and submit. The values that would execute appear beside the chat, under the schema's property names.

A booking to confirm

Ask it to book something
Ask a question to get started.

How it works

Confirmation, not guessing. The model produced a schema, not a booking: the form is built from that schema (BitAiFormDefinition.FromJsonSchema), validated by the application rather than by the model, and only submits once it is valid.

The transport writes a line of text, then streams the JSON Schema as BitAiStructuredDataDeltaEvents named booking_form. A structured renderer registered for that name (renderers.RegisterStructured("booking_form", context => ...), a BitAiStructuredDataRenderer handed a BitAiStructuredDataContext with the part and its message) replaces the default view, so the user sees a form rather than the JSON behind it. The renderer, BookingForm, hands the values - keyed by the schema's property names - to whatever page cascaded a BookingSubmitted callback, so it stays reusable and the page decides what a booking means: this one lists them beside the chat, where a real one would make the booking, and could tell the model what was booked with the session's SubmitAsync.

Fields appear as the schema streams in, and anything already typed survives a new field arriving. What the model inferred arrives as the schema's defaults, which the form starts from; it cannot be submitted until the whole schema is in (Busy), and takes no more edits once it has been (Disabled).

Components used

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.