Skip to content

Make this an artifact, under an answer a Bot draws - #2972

Open
davidmckayv wants to merge 1 commit into
mainfrom
feat/make-this-an-artifact
Open

davidmckayv wants to merge 1 commit into
mainfrom
feat/make-this-an-artifact

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

An answer a Bot draws in the conversation now has Make this an artifact under it. Pressing it sends the Bot the person's ask to keep that drawing, and the Bot makes the artifact with its own artifact_create.

Why

Sam's product call: answer quick asks in the chat, draw when that helps, and offer an artifact as a follow-up. Asking the Bot to make that offer in its reply didn't work on GPT models (no offers at all in the runs), so the offer is now a button under the drawing.

What changes

  • The button. It sits under each answer a Bot drew, in the toolbar style Copy uses under a reply: the SDK's own toolbar button, with the Artifacts icon from the sidebar, and "Make this an artifact" in its tooltip and as its accessible name. The newest drawing's button is always shown, the way the newest reply's Copy is. Earlier ones show on hover, and always on a touch screen. Its space is reserved while the turn runs, so the Bot's words after the drawing don't move when it appears.
  • What counts as drawn (app/src/components/channels/drawn-answers.ts): a native catalog interface (render_ui, a generative-ui-surface activity), an HTML interface (generateSandboxedUi, open-generative-ui), and a gallery or Playground component call that put something on screen. A component that drew says in its first sentence that it is on screen for the person. A refused call, one with wrong arguments, one called too early and a decision all answer differently, so they get no button. Text answers, artifact cards, interfaces still being drawn and failed ones get none either.
  • What it sends is an ordinary message from the person, in their voice, naming the drawing when there are several: Make “Weekend trip budget” an artifact. by its title (a Card's title, the first heading line, the first <h1>–<h3>, or a component's title). Without a title it's Make what you drew an artifact. for the only drawing, Make the last thing you drew an artifact. for the newest, and Make the second thing you drew an artifact. and so on for the rest.
  • The same for every Bot. There's no private channel and no server path. The message goes through the composer's own send (ConversationView), exactly like Carry on. When the Bot is free it goes at once. While a turn runs it waits as queued. A second press while the same ask is waiting or sending does nothing. A stock AG-UI Bot gets exactly what a built-in one gets. The Bot's instructions already say to make an artifact when asked to keep something it answered.

The artifact viewer and the Bot's prompt are not touched.

What the leaders do

  • Claude treats its custom visuals as "ephemeral by default" and offers three ways to keep one: Copy as image, Download, and Save as artifact, which "convert[s] it into an artifact you can keep, publish, and iterate on" (Custom visuals in chat and Cowork). It's an action on each visual, so OpenBot puts one under each drawing.
  • ChatGPT opens canvas from the composer or by asking, and opens it by itself for long outputs. There's no button to turn an existing reply into a canvas (Using canvas in ChatGPT).
  • Gemini starts Canvas from the prompt bar (TechCrunch).

Claude is the one leader with this exact feature, so this follows Claude: one action per drawn answer, beside it. One difference, on purpose: Claude converts the visual in its own app. Here the press asks the Bot, because a connected AG-UI Bot must get everything a built-in Bot gets, and every Bot already holds artifact_create.

Tests

  • app/tests/make-artifact-browser.test.tsx (new, real browser, Chromium and WebKit, light and dark, 1280px and 390px). It runs the real conversation in the app's frame against a stock AG-UI agent at the runtime's address. The history holds a text answer, an artifact card and a drawn packing list. The person asks for a trip budget, and the agent streams it as a generative-ui-surface activity. Each drawing has the button, and the text answer, the reply and the artifact card have none. Pressing it under the budget sends Make “Weekend trip budget” an artifact. as the person's message. The agent answers with artifact_create, the budget's artifact card is drawn, and nothing is wider than the window. Added to the WebKit job's list in ci.yml.
  • app/tests/drawn-answers.test.ts checks the rule against what the app really writes: every shipped gallery component's own on-screen answer counts as drawn. That includes the activity report's "The report is on screen…", which a first version of the rule missed. Refusals, wrong arguments (from the real wrongArguments), called-too-early, decisions, text answers, artifact cards, and interfaces still drawing or failed don't count. It also checks each ask's wording, titles that two drawings share, and a long title cut at a word.
  • Red/green. With the three source files reverted to main, the browser test fails in all 8 runs, waiting for the button under the budget. With the change, all 8 pass.
  • Format, lint, typecheck, scripts/ci-changes.test.ts, and the related transcript, conversation and look-guard tests pass.

Screenshots

From the browser test. Before is main, with the same conversation at the same moment.

A drawn budget, before and after (the packing list above it shows its button on hover):

Before After
Chromium, light, 1280px
Chromium, dark, 1280px
WebKit, light, 390px
WebKit, dark, 390px

The before shots sit a little further down the conversation, so the packing list's last line shows at the top. The budget, the reply and its Copy are drawn as they were, and the button's row is the only thing added.

After pressing it, the person's ask and the artifact the Bot made:

Chromium, light Chromium, dark WebKit, light, 390px WebKit, dark, 390px

The artifact card's preview is blank because the test serves no page for it. That's the existing card, not part of this change.

Changelog

Conversations.

  • Keep something a Bot drew as an artifact. Charts, cards and interfaces a Bot draws in a conversation have a "Make this an artifact" button under them. Pressing it asks the Bot to turn that drawing into an artifact you can keep, share and change. It works the same for every Bot, including ones connected over AG-UI.

A drawn answer (a native interface, an HTML interface, or a gallery or
Playground component that drew) gets "Make this an artifact" under it, in
the toolbar style of Copy under a reply. Pressing it sends the Bot the
person's ask as an ordinary message, naming the drawing by its title or
its place when there are several, and the Bot makes the artifact with the
artifact_create every Bot holds. The same for a Bot connected over plain
AG-UI. Text answers and artifact cards get none.

The offer in the Bot's prompt didn't reach people on GPT models; this is
OpenBot's version of Claude's "Save as artifact" on its custom visuals.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant