feat: 导出功能

This commit is contained in:
Wxw-Gu
2026-07-27 17:43:36 +08:00
parent 9ae0c6cc47
commit e93e4554d7
18 changed files with 2007 additions and 92 deletions
+56
View File
@@ -0,0 +1,56 @@
import type { Message } from './types'
export type ExportFormat = 'html' | 'csv' | 'json' | 'markdown'
export type ExportMessageKind =
| 'text'
| 'image'
| 'video'
| 'voice'
| 'sticker'
| 'share'
| 'location'
| 'system'
export type ExportNameMode = 'groupNickname' | 'remark' | 'wechatNickname'
export interface ExportRequest {
jobId: string
userMd5: string
name: string
format: ExportFormat
outputName: string
startTime?: number
endTime?: number
kinds: ExportMessageKind[]
includeMedia: boolean
includeAvatars?: boolean
avatarUrls?: Record<string, string>
nameMode?: ExportNameMode
nameMap?: Record<string, string>
zip?: boolean
}
export interface ExportJobProgress {
jobId: string
phase: 'reading' | 'writing' | 'completed' | 'cancelled' | 'failed'
processed: number
total?: number
percent?: number
outputPath?: string
error?: string
}
export interface ExportResult {
success: boolean
outputPath?: string
messageCount?: number
error?: string
}
export type ExportRendererApi = {
startExport: (request: ExportRequest) => Promise<ExportResult>
cancelExport: (jobId: string) => Promise<{ success: boolean }>
revealExport: (path: string) => Promise<{ success: boolean; error?: string }>
onExportProgress: (callback: (progress: ExportJobProgress) => void) => () => void
}
export type ExportMessage = Message