Skip to content

UseGetHistory

katanakit-js / useGetHistory

function useGetHistory(sessionId): Promise<
{
content: string | null;
name?: string;
role: "system" | "user" | "assistant" | "tool";
tool_call_id?: string;
tool_calls?: {
function: {
arguments: string;
name: string;
};
id: string;
type: "function";
}[];
}[]
>;

Defined in: core/services/assistant.service.ts:313

Returns the full message history of a session, oldest first.

Parameter Type Description
sessionId string The conversation session id.

Promise<{ content: string | null; name?: string; role: "system" | "user" | "assistant" | "tool"; tool_call_id?: string; tool_calls?: { function: { arguments: string; name: string; }; id: string; type: "function"; }[]; }[]>

The accumulated messages.

const history = await useGetHistory(sessionId);