feat(assets): add chat typing indicator lottie animation

This commit is contained in:
2026-06-08 17:26:09 +08:00
parent f4e1c30051
commit 90fe892995
22 changed files with 988 additions and 3 deletions
+36
View File
@@ -0,0 +1,36 @@
"use client";
/**
* Dexie 数据库定义
*
* 唯一表 `messages`,只有 `++dbId` 自增主键,无次级索引(按本轮需求"最简表")。
* 未来要按 session 查询可升级到:
* this.version(2).stores({ messages: "++dbId, sessionId, createdAt" })
* .upgrade(async (tx) => { ... });
*
* 构造时 `dbName` 可注入,便于测试时每个用例用独立 DB 互不污染。
*/
import Dexie, { type Table } from "dexie";
export interface LocalMessageRow {
/** Dexie 自增主键(数据库内部使用,不暴露给 LocalMessage 类)。 */
dbId?: number;
/** 消息 id(来自 ChatMessage.id)。 */
id: string;
role: string;
content: string;
createdAt: string;
sessionId: string;
}
export class LocalChatDB extends Dexie {
messages!: Table<LocalMessageRow, number>;
constructor(dbName: string = "cozsweet-chat") {
super(dbName);
this.version(1).stores({
messages: "++dbId",
});
}
}