Spaces:
Paused
Paused
File size: 882 Bytes
0b9dc2e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import { client } from './client';
import type { ChatRequest } from './types';
/**
* Chat API — fire-and-forget trigger for chat runs.
*
* Events produced by the run are delivered via the session's SSE
* stream endpoint (``GET /sessions/{sid}/stream``), not in the
* response body of this POST.
*/
export const chatApi = {
/**
* Trigger a chat run for the specified session.
*
* Accepts user messages, human-in-the-loop confirmation events,
* or ``null`` (continue from current state). Returns immediately;
* the caller should already be subscribed to the session's SSE
* stream to receive the resulting events.
*
* @param body - The chat request payload.
* @returns A confirmation object ``{ status, session_id }``.
*/
trigger: (body: ChatRequest) =>
client.post<{ status: string; session_id: string }>('/chat/', body),
};
|