Embedded chat
The chat panel you mount inside your own app.
What it is
EmbeddedChat is the chat itself. Mount it inside providers so it has a deployment. The chat’s
datastore is its own datastore prop, or the one an operator picks. Without that prop, the server uses the account’s
default datastore. user is the person shown in the chat. isOperator chooses whether they pick a datastore first.
Import
import { EmbeddedChat } from "@manta-eu/react/components/embedded-chat";
Example
export function Copilot(props: { onClose: () => void }) {
return (
<EmbeddedChat
user={{ id: "…", email: "you@example.com", name: "You" }}
isOperator={false}
datastore={{ id: "your-datastore", name: "Your datastore" }}
assistantName="Copilot"
title="Copilot"
welcomeSubtitle="Ask about the campaign on this page."
onClose={props.onClose}
/>
);
}
Request
user and isOperator are required. The rest are optional.
user—{ id, email, name?, picture? }.idandemailare strings.nameandpicturemay be omitted.isOperator—truewhen this person may choose a datastore,falsefor a fixed one.datastore—{ id, name }. The chat uses this datastore. WhenisOperatoris false and this is omitted, the server uses the account’s default datastore. WhenisOperatoris true and this is omitted, the user picks one first. The providers’datastoreIdis what GraphQL and SPARQL from that tree use, not this prop.assistantName— name used in the header and the greeting. Defaults toManta.title— header label. When omitted, the header reads{assistantName} Co-pilot.assistantIcon— a component that takes{ className?: string }, drawn in place of the Manta mark while the assistant is working.welcomeSubtitle— subtitle on the empty state, in place of the default greeting.initialPrompt— a string sent as the first user message once the chat is connected and still empty.initialDraft—{ id: string; text: string }. The composer showstext. A newidreplaces it. After that draft is sent, the sameidstays out of the box.onClose—() => void. Passing it adds a Close button in the header.mode—"datastore"(the default) or"group"."group"is an overview of a group’s datastores: setdatastoreto the group’s own datastore. Its conversations answer from that datastore and every datastore beneath it, as far as the user is granted them, name the one each figure comes from, and change nothing. They tell the user which datastore a requested change belongs to instead, and open no plan or rule chat: a plan the user picks goes toonSelectPlan, and without it the user is told to open the plan from its own datastore. A group view keeps its own chat list, apart from the datastore’s, and the conversations and the personal memories saved from them are kept in the group’s datastore.
Page context and opening a plan are separate props.
Response
With isOperator false, the panel opens on the datastore prop. Without that prop, the server uses the account’s
default datastore. With isOperator true and no datastore chosen yet, the user sees Select a datastore and then
the chat for the one they pick.
An empty chat greets them with “What would you like to improve today?” and either welcomeSubtitle or a greeting
that uses their name. initialPrompt appears as the first message they sent. initialDraft waits in the composer
until they send it. Close calls onClose.