Skip to content

Message actions

The row of buttons under a message — copy, retry, edit, feedback, details — on when your app can answer them, in the order you choose.

On this page
Open

Every message can carry a row of actions. Copy is on by default, because the library can do it alone. The others only ask: retry and edit need something that re-sends and rewrites the conversation, feedback and details need a listener. So they stay off until your app says it handles them, with aparteGlobalConfig.setBubbleActions(), and a button never sits there answering to nobody.

AparteClient handles retry and edit for you, so with the client running, setBubbleActions({ retry: true, edit: true }) is all it takes.

Open

A list for a role replaces the flags for that role: those buttons, in that order. Naming a button in the list is the opt-in.

Open

The details button appears only on a message that carries usage, and it only emits aparte-message-info: the popover with the numbers is yours to draw.

ts
import { aparteGlobalConfig } from '@aparte/core';
import type { AparteFeedbackEventDetail } from '@aparte/core';

aparteGlobalConfig.setBubbleActions({ retry: true, edit: true, feedback: true });

document.addEventListener('aparte-feedback', (e) => {
  const { messageId, value } = (e as CustomEvent<AparteFeedbackEventDetail>).detail;
  void fetch('/api/feedback', { method: 'POST', body: JSON.stringify({ messageId, value }) });
});
ActionDefaultNeeds
copyonnothing
retryoffa host that re-sends (AparteClient)
editoffa host that keeps the new text (AparteClient)
feedbackoffa listener for aparte-feedback
infooffa listener for aparte-message-info, and usage on the message
  • Each action is a button named from the locale (copy, retry, edit, feedbackPositive, messageInfo…), so a row of icons still reads as words.
  • The row is hidden while a reply streams, so nobody copies half an answer.
  • Message — the bubble the row belongs to.
  • Branches — where a retry’s new version goes.