Files
knowai/types/chat/base.d.ts
tobegold574 6a81b7bb13
Some checks reported errors
continuous-integration/drone/push Build was killed
feat(image): 新建 knowai-core:1.0.0 镜像并完成推送
- 搭建 api、auth、utils 等逻辑模块
- 通过 tsc、eslint、vitest 测试验证

BREAKING CHANGE: 新镜像分支
2025-11-10 20:20:25 +08:00

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;
};
}