@ant-design/x-sdk
Version:
placeholder for @ant-design/x-sdk
30 lines (29 loc) • 1.42 kB
TypeScript
import type { ConversationData } from '.';
/**
* We manage all conversation stores here, so that useXChat can get the conversation data by conversationKey.
*/
export declare const conversationStoreHelper: {
_allConversationStores: Map<string, ConversationStore>;
set: (key: string, store: ConversationStore) => void;
delete: (key: string) => void;
getConversation: (conversationKey: string) => ConversationData | undefined;
};
export declare class ConversationStore {
private conversations;
private listeners;
private storeKey;
private activeConversationKey;
private emitListeners;
constructor(defaultConversations: ConversationData[], defaultActiveConversationKey: string);
setActiveConversationKey: (key: string) => boolean;
setConversations: (list: ConversationData[]) => boolean;
getConversation: (key: ConversationData['key']) => ConversationData | undefined;
addConversation: (conversation: ConversationData, placement?: 'prepend' | 'append') => boolean;
setConversation: (key: ConversationData['key'], conversation: ConversationData) => boolean;
removeConversation: (key: ConversationData['key']) => boolean;
getMessages: (key: ConversationData['key']) => any[] | undefined;
getSnapshot: () => ConversationData[];
getActiveConversationKey: () => string;
subscribe: (callback: () => void) => () => void;
destroy: () => void;
}