MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / getDictList

Function getDictList

packages/node-runtime/src/nlp/dict-manager.ts:33–47  ·  view source on GitHub ↗
(nlpDir: string)

Source from the content-addressed store, hash-verified

31}
32
33export function getDictList(nlpDir: string): DictInfo[] {
34 return AVAILABLE_DICTS.map((d) => {
35 const filePath = getDictFilePath(nlpDir, d.id)
36 const downloaded = fs.existsSync(filePath)
37 let fileSize: number | undefined
38 if (downloaded) {
39 try {
40 fileSize = fs.statSync(filePath).size
41 } catch {
42 /* ignore */
43 }
44 }
45 return { ...d, downloaded, fileSize }
46 })
47}
48
49export function loadDictBuffer(nlpDir: string, dictId: string): Buffer | null {
50 const filePath = getDictFilePath(nlpDir, dictId)

Callers 1

registerNlpRoutesFunction · 0.90

Calls 1

getDictFilePathFunction · 0.85

Tested by

no test coverage detected