MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / scanMultiChatFile

Function scanMultiChatFile

packages/parser/src/index.ts:93–109  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

91 * @returns 聊天列表,如果格式不支持多聊天则抛出错误
92 */
93export async function scanMultiChatFile(filePath: string): Promise<MultiChatInfo[]> {
94 const feature = sniffer.sniff(filePath)
95 if (!feature) {
96 throw new Error(`无法识别文件格式: ${filePath}`)
97 }
98
99 if (!feature.multiChat) {
100 throw new Error(`格式 "${feature.name}" 不是多聊天格式`)
101 }
102
103 const module = formats.find((m) => m.feature.id === feature.id)
104 if (!module?.scanChats) {
105 throw new Error(`格式 "${feature.name}" 声明了 multiChat 但未实现 scanChats`)
106 }
107
108 return module.scanChats(filePath)
109}
110
111/**
112 * 检查文件是否需要预处理

Callers 2

registerChatHandlersFunction · 0.90
registerImportRoutesFunction · 0.85

Calls 1

sniffMethod · 0.80

Tested by

no test coverage detected