Page context
Tell the agent which entities are on screen.
What it is
pageContext is an optional prop on embedded chat. It names the entities the user is
looking at, so the agent can answer about “this campaign” or “these orders” without the user naming them.
Import
import { EmbeddedChat } from "@manta-eu/react/components/embedded-chat";
import type { PageContext } from "@manta-eu/react/lib/chat-types";
Example
const pageContext: PageContext = {
iris: ["https://example.com/id/1"],
typenames: ["Campaign"],
};
export function Copilot() {
return (
<EmbeddedChat
user={{ id: "…", email: "you@example.com", name: "You" }}
isOperator={false}
pageContext={pageContext}
/>
);
}
Request
Pass a PageContext:
iris— IRI strings for the entities on screen.typenames— type name strings for those entities, such as"Campaign".
Both fields are arrays. The chat attaches the object to the next message the user sends. Update it when the screen changes.
Response
The assistant answers in the chat about those entities. “this” or “these” in the question refers to the IRIs on screen.