feat(chat): 聊天页增加导出弹窗与进度展示

- 导出弹窗支持范围/格式/时间范围/媒体开关/文件名等参数
- 批量会话列表展示头像,提供 全部/群聊/单聊 tab 与搜索
- 导出进度使用 SSE 实时更新(失败回退轮询),提供进度条展示
- 支持任务取消与 ZIP 下载
- 隐私模式下导出同步隐私策略,且 hover 不再保持模糊
This commit is contained in:
2977094657
2025-12-23 20:26:21 +08:00
parent 0445889b9b
commit 0a3aad6ba3
2 changed files with 618 additions and 2 deletions

View File

@@ -138,6 +138,42 @@ export const useApi = () => {
}
})
}
// 聊天记录导出离线zip
const createChatExport = async (data = {}) => {
return await request('/chat/exports', {
method: 'POST',
body: {
account: data.account || null,
scope: data.scope || 'selected',
usernames: Array.isArray(data.usernames) ? data.usernames : [],
format: data.format || 'json',
start_time: data.start_time != null ? Number(data.start_time) : null,
end_time: data.end_time != null ? Number(data.end_time) : null,
include_hidden: !!data.include_hidden,
include_official: !!data.include_official,
include_media: data.include_media == null ? true : !!data.include_media,
media_kinds: Array.isArray(data.media_kinds) ? data.media_kinds : ['image', 'emoji', 'video', 'video_thumb', 'voice', 'file'],
allow_process_key_extract: !!data.allow_process_key_extract,
privacy_mode: !!data.privacy_mode,
file_name: data.file_name || null
}
})
}
const getChatExport = async (exportId) => {
if (!exportId) throw new Error('Missing exportId')
return await request(`/chat/exports/${encodeURIComponent(String(exportId))}`)
}
const listChatExports = async () => {
return await request('/chat/exports')
}
const cancelChatExport = async (exportId) => {
if (!exportId) throw new Error('Missing exportId')
return await request(`/chat/exports/${encodeURIComponent(String(exportId))}`, { method: 'DELETE' })
}
return {
detectWechat,
@@ -151,6 +187,10 @@ export const useApi = () => {
downloadChatEmoji,
getMediaKeys,
saveMediaKeys,
decryptAllMedia
decryptAllMedia,
createChatExport,
getChatExport,
listChatExports,
cancelChatExport
}
}