refactor: 清理 parser worker rag merger 的历史类型问题

This commit is contained in:
digua
2026-03-25 22:43:12 +08:00
parent b6fdc3887e
commit 7eaba396ec
29 changed files with 264 additions and 103 deletions
@@ -18,7 +18,7 @@
import * as fs from 'fs'
import * as readline from 'readline'
import * as path from 'path'
import { KNOWN_PLATFORMS, ChatType, MessageType, type ChatPlatform } from '../../../../src/types/base'
import { KNOWN_PLATFORMS, ChatType, MessageType } from '../../../../src/types/base'
import type {
FormatFeature,
FormatModule,
@@ -29,13 +29,10 @@ import type {
ParsedMember,
ParsedMessage,
} from '../types'
import { getFileSize, createProgress, readFileHeadBytes } from '../utils'
import { getFileSize, createProgress } from '../utils'
// ==================== JSONL 行类型定义 ====================
/** JSONL 行类型 */
type JsonlLineType = 'header' | 'member' | 'message'
/** Header 行结构 */
interface JsonlHeader {
_type: 'header'
@@ -362,7 +362,7 @@ function cleanupTempFile(filePath: string): void {
* QQ Chat Exporter 预处理器
*/
export const qqPreprocessor: Preprocessor = {
needsPreprocess(filePath: string, fileSize: number): boolean {
needsPreprocess(_filePath: string, fileSize: number): boolean {
return fileSize > PREPROCESS_THRESHOLD
},
@@ -333,7 +333,7 @@ async function* parseDiscordExporter(options: ParseOptions): AsyncGenerator<Pars
memberMap.set(author.id, {
platformId: author.id,
accountName: author.name,
groupNickname: author.nickname || null,
groupNickname: author.nickname || undefined,
avatar: author.avatarUrl,
roles: convertRoles(author.roles),
})
@@ -384,7 +384,7 @@ async function* parseDiscordExporter(options: ParseOptions): AsyncGenerator<Pars
platformMessageId: msg.id, // 消息的平台原始 ID
senderPlatformId: author.id,
senderAccountName: author.name,
senderGroupNickname: author.nickname || null,
senderGroupNickname: author.nickname || undefined,
timestamp: parseTimestamp(msg.timestamp),
type: messageType,
content: content || null,