Past chats

History is entirely the host's. The widget stores no conversations; it asks, and shows what it is given. Open the widget and use the history control in the header.

Two functions, and the widget has no history without them

This is the part that is easy to forget, because nothing complains. Mount the widget without them and it works perfectly — it streams, it answers, it remembers the current thread — and every past conversation is invisible. It happened on our own hub: threads were being saved server-side for weeks and nothing there ever asked for them.

createAiChatWidget({
  listThreads: () => api("/accounts/123/ai/threads"),
  loadThread: async (id) =>
    buildThreadReplay(await api(`/accounts/123/ai/threads/${id}/messages`)),
});

listThreads returns { id, title?, updatedAt?, starred? }. loadThread returns the messages oldest first — pass them through buildThreadReplay and charts and tables come back too, not just the text.

Whose history?

The widget does not decide. Point these at an account-scoped endpoint and a person sees their own conversations for that account; point them at a staff endpoint and they see their own across accounts. Our hub and our dashboard deliberately read different lists — a staff chat about an account should not appear in that account member's history.

Try it

Three canned conversations, served from this page. Open the widget, then the history control in the header.