MCPcopy Create free account
hub / github.com/aetherstate/GODMOD3.AI / listBatchFiles

Function listBatchFiles

api/lib/hf-reader.ts:127–150  ·  view source on GitHub ↗
(forceRefresh = false)

Source from the content-addressed store, hash-verified

125}
126
127export async function listBatchFiles(forceRefresh = false): Promise<BatchInfo[]> {
128 const now = Date.now()
129
130 // Check cache
131 if (!forceRefresh && fileListCache && fileListCache.expires > now) {
132 return parseBatchInfos(fileListCache.data)
133 }
134
135 // Fetch both directories in parallel
136 const [metaFiles, dataFiles] = await Promise.all([
137 fetchFileList('metadata'),
138 fetchFileList('dataset'),
139 ])
140
141 const allFiles = [
142 ...metaFiles.map(f => ({ ...f, path: f.path || `metadata/${f.path}` })),
143 ...dataFiles.map(f => ({ ...f, path: f.path || `dataset/${f.path}` })),
144 ]
145
146 // Cache the combined list
147 fileListCache = { data: allFiles, expires: now + FILE_LIST_TTL }
148
149 return parseBatchInfos(allFiles)
150}
151
152function parseBatchInfos(files: HFFileEntry[]): BatchInfo[] {
153 return files

Callers 2

queryCorpusFunction · 0.85
getCorpusStatsFunction · 0.85

Calls 2

parseBatchInfosFunction · 0.85
fetchFileListFunction · 0.85

Tested by

no test coverage detected