Fix html export styles fallback

This commit is contained in:
QingXiao
2026-01-24 01:02:11 +08:00
parent 40efb04a36
commit 7df6182e70
2 changed files with 309 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ import { wcdbService } from './wcdbService'
import { imageDecryptService } from './imageDecryptService'
import { chatService } from './chatService'
import { videoService } from './videoService'
import { EXPORT_HTML_STYLES } from './exportHtmlStyles'
// ChatLab 格式类型定义
interface ChatLabHeader {
@@ -608,15 +609,17 @@ class ExportService {
if (fs.existsSync(filePath)) {
try {
const content = fs.readFileSync(filePath, 'utf-8')
this.htmlStyleCache = content
return content
if (content.trim().length > 0) {
this.htmlStyleCache = content
return content
}
} catch {
continue
}
}
}
this.htmlStyleCache = ''
return ''
this.htmlStyleCache = EXPORT_HTML_STYLES
return this.htmlStyleCache
}
private normalizeAppMessageContent(content: string): string {