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
+34 -2
View File
@@ -155,14 +155,46 @@ function isCurrentAccountFile(
function readStartupCacheFile(accountRoot: string): StartupCacheFile | null {
const normalizedRoot = normalizeRoot(accountRoot)
if (!normalizedRoot) return null
const file = getAccountCachePaths(normalizedRoot).startup
const paths = getAccountCachePaths(normalizedRoot)
const file = paths.startup
const scheduled = readScheduledValue<StartupCacheFile>(file)
if (scheduled) return scheduled
const memory = startupMemory.get(file)
if (memory) return memory
try {
if (!fs.existsSync(file)) return null
if (!fs.existsSync(file)) {
// Version 1 stored startup data in one JSON file. Migrate it lazily so
// account discovery can still show a cached nickname/avatar before the
// database key is entered.
if (!fs.existsSync(paths.legacy)) return null
const legacy = fs.readJsonSync(paths.legacy) as {
version?: number
platform?: NodeJS.Platform
accountRoot?: string
updatedAt?: number
self?: CachedSelfInfo
contacts?: Contact[]
}
if (
legacy.version !== 1 ||
legacy.platform !== process.platform ||
normalizeRoot(legacy.accountRoot) !== normalizedRoot
) {
return null
}
const migrated: StartupCacheFile = {
version: CACHE_VERSION,
platform: process.platform,
accountRoot: normalizedRoot,
updatedAt: Number(legacy.updatedAt) || 0,
self: legacy.self,
contacts: Array.isArray(legacy.contacts) ? legacy.contacts : []
}
startupMemory.set(file, migrated)
scheduleWrite(file, migrated, { cleanupFile: paths.legacy })
return migrated
}
const raw = fs.readJsonSync(file) as Partial<StartupCacheFile>
if (!isCurrentAccountFile(raw, normalizedRoot)) return null
const result: StartupCacheFile = {