ant-design-x-vue-next
Version:
Ant Design X for Vue — community continuation aligned with @ant-design/x
27 lines (26 loc) • 1.39 kB
TypeScript
import { type Ref, type ShallowRef } from 'vue';
import type { MessageInfo, SimpleType } from '../use-x-chat';
import { ConversationStore, conversationStoreHelper, type ConversationData } from './store';
export type { ConversationData };
export { ConversationStore, conversationStoreHelper };
export interface XConversationConfig {
defaultConversations?: ConversationData[];
defaultActiveConversationKey?: string;
}
export interface XConversationsReturn {
conversations: ShallowRef<ConversationData[]>;
activeConversationKey: Ref<string>;
setActiveConversationKey: (key: string) => boolean;
addConversation: (conversation: ConversationData, placement?: 'prepend' | 'append') => boolean;
removeConversation: (key: string) => boolean;
setConversation: (key: string, conversation: ConversationData) => boolean;
getConversation: (key: string) => ConversationData | undefined;
setConversations: (list: ConversationData[]) => boolean;
getMessages: <Message extends SimpleType = SimpleType>(key: string) => MessageInfo<Message>[];
}
/**
* Multi-conversation list management (aligned with @ant-design/x-sdk useXConversations).
* Pair with useXChat({ conversationKey: activeConversationKey }) for message isolation.
*/
export declare function useXConversations(config?: XConversationConfig): XConversationsReturn;
export default useXConversations;