Skip to content

@pgege/kaboo-react


Function: useTurnGroups()

useTurnGroups(messageId): GroupEntry[]

Defined in: src/context/TurnBinding.tsx:82

All activity groups of the turn anchored on messageId (the turn's final assistant message), or an empty array for any other message. Lets custom surfaces implement their own end-of-turn presentation from the same binding the built-in turnFooter slot uses.

Parameters

messageId

string | undefined

Returns

GroupEntry[]

Example

import { useTurnGroups } from "@pgege/kaboo-react";

function TurnToolCount({ messageId }: { messageId: string }) {
  const groups = useTurnGroups(messageId);
  return <span>{groups.reduce((n, [, g]) => n + g.tools.length, 0)}</span>;
}