feat(media): implement caching for chat media and update components to use cached media

This commit is contained in:
2026-06-30 15:59:33 +08:00
parent 78d8aae22e
commit ccd2d6bd48
15 changed files with 591 additions and 42 deletions
+1
View File
@@ -156,6 +156,7 @@ async function sendMessageViaHttp(content: string): Promise<{
log.error("[chat-machine] sendMessageHttpActor failed", { error: result.error });
throw result.error;
}
void chatRepo.prefetchMediaForSendResponse(result.data);
const isMessageLimit =
result.data.lockDetail.locked &&
result.data.lockDetail.showUpgrade &&
+1
View File
@@ -356,6 +356,7 @@ export async function readAndSyncHistory(): Promise<{
log.debug("[chat-machine] loadHistory NETWORK DONE", {
count: networkUi.length,
});
void chatRepo.prefetchMediaForMessages(networkResult.data.messages);
// 3. 用 network 覆盖 local
const saveResult = await chatRepo.saveMessagesToLocal(networkResult.data.messages);