- 新增热门帖子、热门作者、榜单接口及实现 - 新增api-documentation,更好的ai协作 - 修复types没有导出的问题 BREAKING CHANGES: 1.0.0->1.1.0(latest)
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import type { User } from '../index';
|
|
import type { ChatMessageType, ChatMessageStatus } from './enum';
|
|
|
|
// 聊天消息接口
|
|
export interface ChatMessage {
|
|
id: string;
|
|
sessionId: string;
|
|
sender: User;
|
|
receiver: User;
|
|
content: string;
|
|
type: ChatMessageType;
|
|
status: ChatMessageStatus;
|
|
createdAt: Date;
|
|
// 非文本消息类型的元数据
|
|
metadata?: {
|
|
fileName?: string;
|
|
fileSize?: number;
|
|
duration?: number;
|
|
thumbnail?: string;
|
|
[key: string]: unknown;
|
|
};
|
|
}
|
|
|
|
// 聊天会话接口
|
|
export interface ChatSession {
|
|
id: string;
|
|
participant1Id: string;
|
|
participant2Id: string;
|
|
participant1: User;
|
|
participant2: User;
|
|
lastMessage?: {
|
|
id: string;
|
|
content: string;
|
|
senderId: string;
|
|
createdAt: Date;
|
|
};
|
|
unreadCount1: number; // 参与者1的未读消息数
|
|
unreadCount2: number; // 参与者2的未读消息数
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
// 会话元数据(特殊标记、背景设置、自定义属性等等)
|
|
metadata?: {
|
|
[key: string]: unknown;
|
|
};
|
|
}
|