fix: 完善聊天解析与导出体验

- 修复引用消息名称和图片布局
- 明确单会话图片测试日志范围
- 支持导出文件附件
- 完善图片批测、会话刷新和安全退出
This commit is contained in:
Wxw-Gu
2026-08-04 12:03:07 +08:00
parent d76727875d
commit c70e49bf16
41 changed files with 2320 additions and 221 deletions
+18 -4
View File
@@ -55,7 +55,8 @@ export interface FormattedMessage {
voiceDataUrl?: string
voiceDuration?: number
exportMediaUrl?: string
exportMediaType?: 'image' | 'video' | 'sticker'
exportMediaType?: 'image' | 'video' | 'sticker' | 'file'
exportMediaName?: string
exportShowAvatar?: boolean
exportMediaError?: string
exportAvatarUrl?: string
@@ -109,10 +110,24 @@ function normalizeMsgType(value: string | number | undefined): number {
}
let dbRef: WechatDb | null = null
let shutdownRequested = false
export function setChatDb(db: WechatDb | null): void {
export function setChatDb(db: WechatDb | null): boolean {
if (shutdownRequested) {
db?.close()
return false
}
dbRef?.close()
dbRef = db
return true
}
export async function closeChatDbForQuit(): Promise<boolean> {
shutdownRequested = true
const current = dbRef
dbRef = null
if (!current) return true
return current.closeAsync()
}
export function getChatDb(): WechatDb | null {
@@ -639,8 +654,7 @@ export function reopenWithRoot(accountRoot: string): boolean {
if (!key) return false
try {
const next = new WechatDb(key, accountRoot)
setChatDb(next)
return true
return setChatDb(next)
} catch (error) {
console.error('[ChatService] reopen with root failed:', error)
return false