IntegrationsWeb SDK
Group Chat
Several characters sharing one conversation on your page
Experimental, Pro or Team plan
The request and response shape may change.
Up to six characters in one conversation, each with its own voice. How the server runs the scene: Web API Group Chat.
Every character must be in the proxy's characters allowlist.
Element
<neocortex-group-chat endpoint="/api/neocortex" character-ids="aria-id,bram-id" max-turns="2" voice></neocortex-group-chat>Same attributes and events as <neocortex-chat>. The Let them talk button runs a turn without the player.
GroupDirector
import { GroupDirector } from "@neocortex-link/web/client";
const group = new GroupDirector({ endpoint: "/api/neocortex", characterIds: ["aria-id", "bram-id"], voice: true });
group.on("speaker", ({ characterId }) => npcs.get(characterId).faceCamera());
group.on("lineStarted", ({ name, line }) => subtitles.show(name, line.text));
group.registerAction("FOLLOW_PLAYER", (action, message) => npcs.get(message.characterId).follow(player));| Call | Turn |
|---|---|
send(message) | The AI picks who answers, up to maxTurns. |
sendTo(characterId, message) | That character answers. |
continue() | The characters talk among themselves. |
sendAudio(wav) | Transcribes, then send. |
Turns are queued, so a continue() from an idle timer never talks over the player.
Changing the cast
addCharacter(id) and removeCharacter(id) start a new conversation, as does changing character-ids on the element. To keep one conversation across cast changes (dynamic cast), call client.chat() with the same sessionId and the new characterIds.