Request
The agent asking something it can't work out itself, with the answers right there. It asks in choices or with a form, and keeps its questions once answered — the question is most of what the card is worth later.
Choices
One question or several, single or multiple choice. A single choice is required.
Wants to know
Before I send anything:
<div class="mx-auto max-w-xl">
<%= ai_chat_request state: :waiting, url: "#", prompt: "Before I send anything:" do |request| %>
<% request.question "Which candidates should get a nudge?", header: "Who", multiple: true do |q| %>
<% q.option "Ana Silva", description: "Opened it twice, hasn't answered" %>
<% q.option "Grace Okafor", description: "Hasn't opened it" %>
<% end %>
<% request.question "How should it sound?", header: "Tone" do |q| %>
<% q.option "Friendly", description: "A short, warm check-in" %>
<% q.option "Direct", description: "The role closes on Friday" %>
<% end %>
<% request.aside "Or say something else in the box below." %>
<% end %>
</div>A form
request.form takes your own fields; Decline skips validation.
Wants to know
I need a few details to create the job.
<div class="mx-auto max-w-xl">
<%= ai_chat_request state: :waiting, url: "#", prompt: "I need a few details to create the job." do |request| %>
<% request.form do |form| %>
<%= form.field :title, "Job title", required: true %>
<%= form.field :salary, "Salary band", hint: "For example, $180–210k" %>
<% end %>
<% request.decline %>
<% end %>
</div>Answered
The options go and what was picked stays. Declined and cancelled cards dim.
Wanted to knowSubmitted
Wanted to knowDeclined
I need a few details to create the job.
Wanted to knowTimed out
<div class="mx-auto flex max-w-xl flex-col gap-4">
<%= ai_chat_request state: :accepted do |request| %>
<% request.question "Which candidates should get a nudge?", header: "Who", picked: [ "Ana Silva", "Grace Okafor" ] %>
<% request.question "How should it sound?", header: "Tone", picked: [ "Friendly" ] %>
<% end %>
<%= ai_chat_request state: :declined, prompt: "I need a few details to create the job." %>
<%= ai_chat_request state: :timed_out do |request| %>
<% request.question "Send it now?", picked: [] %>
<% end %>
</div>