feat: 完善日报图片与公众号消息展示

修复日报图片读取格式与模型不支持时的友好降级
恢复话题关键词回退,确保词云在缺少顶层关键词时仍可展示
支持公众号多文章消息在聊天、日报、检索和 HTML 导出中完整呈现
迁移账号身份缓存并优化首次连接的账号占位信息
补充图片、词云、账号缓存与多文章消息回归测试
This commit is contained in:
电摇小子
2026-08-07 00:00:52 +08:00
parent 0ec2e6a0be
commit 3af62783dd
18 changed files with 432 additions and 36 deletions
+37 -1
View File
@@ -1,4 +1,5 @@
import { mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'fs'
import { mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync, mkdirSync } from 'fs'
import { createHash } from 'crypto'
import { tmpdir } from 'os'
import { join } from 'path'
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -105,4 +106,39 @@ describe('bootstrap cache', () => {
}).nickname
).toBe('濑岛田井卫')
})
it('migrates the previous startup cache so account discovery can show identity before unlock', () => {
const legacyRoot = '/fixture/legacy-account'
const digest = createHash('sha1')
.update(`${process.platform}:${legacyRoot}`)
.digest('hex')
.slice(0, 16)
const legacyFile = join(userData, 'cache', 'bootstrap', `${process.platform}-${digest}.json`)
mkdirSync(join(userData, 'cache', 'bootstrap'), { recursive: true })
writeFileSync(
legacyFile,
JSON.stringify({
version: 1,
platform: process.platform,
accountRoot: legacyRoot,
updatedAt: Date.now(),
self: {
wxid: 'wxid_legacy',
nickname: '缓存昵称',
avatar: 'data:image/png;base64,fixture',
accountRoot: legacyRoot
},
contacts: []
}),
'utf8'
)
clearBootstrapCache()
expect(getBootstrapCache(legacyRoot)?.self).toMatchObject({
wxid: 'wxid_legacy',
nickname: '缓存昵称',
avatar: 'data:image/png;base64,fixture'
})
flushBootstrapCacheWritesSync()
})
})