Skip to content
0

katanakit-js / useGetHistory

Function: useGetHistory() ​

ts
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: src/core/services/assistant.service.ts:313

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

Parameters ​

ParameterTypeDescription
sessionIdstringThe conversation session id.

Returns ​

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.

Example ​

ts
const history = await useGetHistory(sessionId);

Released under the MIT License.