import { request } from '../api/request' ; export interface ChatMessageReaction { name : string ; author : string ; } export interface ChatMessage { _id : string ; content : string ; author ? : string ; groupId ? : string ; converseId : string ; reactions ? : ChatMessageReaction [ ] ; hasRecall ? : boolean ; meta ? : Record < string , unknown > ; createdAt ? : string ; updatedAt ? : string ; } export interface SimpleMessagePayload { groupId ? : string ; converseId : string ; content : string ; } export interface SendMessagePayload extends SimpleMessagePayload { meta ? : Record < string , unknown > ; } param converseId param startId export async function fetchConverseMessage ( converseId , startId ? ) { const { data } = await request . get ( '/api/chat/message/fetchConverseMessage' , { params : { converseId , startId } } ) ; return data ; } param payload export async function sendMessage ( payload ) { const { data } = await request . post ( '/api/chat/message/sendMessage' , payload ) ; return data ; } param messageId export async function recallMessage ( messageId ) { const { data } = await request . post ( '/api/chat/message/recallMessage' , { messageId } ) ; return data ; } export async function deleteMessage ( messageId ) { const { data } = await request . post ( '/api/chat/message/deleteMessage' , { messageId } ) ; return data ; } /**
 * 基于会话id获取会话最后一条消息的id
 */ export async function fetchConverseLastMessages ( converseIds ) { const { data } = await request . post ( '/api/chat/message/fetchConverseLastMessages' , { converseIds } ) ; return data ; } /**
 * 增加表情行为
 */ export async function addReaction ( messageId , emoji ) { const { data } = await request . post ( '/api/chat/message/addReaction' , { messageId , emoji } ) ; return data ; } /**
 * 移除表情行为
 */ export async function removeReaction ( messageId , emoji ) { const { data } = await request . post ( '/api/chat/message/removeReaction' , { messageId , emoji } ) ; return data ; }