import React, { useContext } from 'react'; import { Conversation } from '@tencentcloud/chat'; import { TUIConversationList } from '../components'; export interface TUIConversationContextValue { createConversation?:(conversationID:string) => Promise, deleteConversation?:(conversationID:string) => Promise, filterConversation?:(conversationList: Array) => Array, } export const TUIConversationContext = React.createContext(undefined); export function TUIConversationProvider({ children, value }:React.PropsWithChildren<{ value?: TUIConversationContextValue }>) { return ( {children || ( )} ); } export const useTUIConversationContext = (componentName?:string) => { const contextValue = useContext(TUIConversationContext); if (!contextValue && componentName) { return {}; } return contextValue; };