@eloquentai/chat-sdk 0.36.0 → 0.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat/hooks/use-realtime-socket.d.ts +7 -2
- package/dist/components/chat/message-mapping.d.ts +8 -0
- package/dist/index.mjs +1251 -1153
- package/dist/index.mjs.map +1 -1
- package/dist/{skeleton-CNz9cQ6u.js → skeleton-CFoCj07s.js} +3 -3
- package/dist/{skeleton-CNz9cQ6u.js.map → skeleton-CFoCj07s.js.map} +1 -1
- package/dist/ui.mjs +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,10 @@ export type UseRealtimeSocketOptions = {
|
|
|
5
5
|
chatSettings: BootResponse["chat_settings"] | null;
|
|
6
6
|
chatId: string | null;
|
|
7
7
|
messages: Message[];
|
|
8
|
-
|
|
8
|
+
/** `afterId` is the message the reply follows in the history, when it came from a poll. */
|
|
9
|
+
onMessage: (response: ChatResponse, chatId: string, afterId?: string | null) => void;
|
|
10
|
+
/** A user message in the history the transcript doesn't show (e.g. lost to a reload). */
|
|
11
|
+
onMissedUserMessage?: (response: ChatResponse, chatId: string, afterId: string | null, createdAt: string) => void;
|
|
9
12
|
onCognition: (content: string) => void;
|
|
10
13
|
onCognitionComplete: () => void;
|
|
11
14
|
onError?: () => void;
|
|
@@ -23,5 +26,7 @@ export type UseRealtimeSocketReturn = {
|
|
|
23
26
|
connect: (chatId: string) => Promise<void>;
|
|
24
27
|
disconnect: () => void;
|
|
25
28
|
clearProcessedIds: () => void;
|
|
29
|
+
/** Polls the history every few seconds until a reply arrives, in case the socket misses it. */
|
|
30
|
+
expectReply: () => void;
|
|
26
31
|
};
|
|
27
|
-
export declare function useRealtimeSocket({ chatSettings, chatId, messages, onMessage, onCognition, onCognitionComplete, onError, onChatClosed, onAgentCapturedUrl, onAgentTopic, onAgentSummary, onRatingRequest, onBreadcrumb, fetchHistory, getChatToken, backupPollingInterval, }: UseRealtimeSocketOptions): UseRealtimeSocketReturn;
|
|
32
|
+
export declare function useRealtimeSocket({ chatSettings, chatId, messages, onMessage, onMissedUserMessage, onCognition, onCognitionComplete, onError, onChatClosed, onAgentCapturedUrl, onAgentTopic, onAgentSummary, onRatingRequest, onBreadcrumb, fetchHistory, getChatToken, backupPollingInterval, }: UseRealtimeSocketOptions): UseRealtimeSocketReturn;
|
|
@@ -2,6 +2,14 @@ import { ChatResponse } from './validations';
|
|
|
2
2
|
import { AttachmentFile, Message, MessageData } from '../../types/message';
|
|
3
3
|
/** A realtime/polled assistant reply, as appended to the transcript. */
|
|
4
4
|
export declare function messageFromChatResponse(response: ChatResponse): Message;
|
|
5
|
+
/** A user message the transcript lost (e.g. before a reload), restored from the chat history. */
|
|
6
|
+
export declare function userMessageFromChatResponse(response: ChatResponse, createdAt: string): Message;
|
|
7
|
+
/**
|
|
8
|
+
* Places `message` right after the message with id `afterId`, so a late reply
|
|
9
|
+
* keeps its place in the conversation. `null` means it opens the history (it
|
|
10
|
+
* goes after the welcome message); `undefined` or an id not shown appends.
|
|
11
|
+
*/
|
|
12
|
+
export declare function insertMessageAfter(messages: Message[], message: Message, afterId: string | null | undefined): Message[];
|
|
5
13
|
/** The configured welcome message, shown before any conversation exists. */
|
|
6
14
|
export declare function createWelcomeMessage(content: string): Message;
|
|
7
15
|
/** The star-rating prompt appended when the server requests feedback. */
|