Repository navigation
Expand file tree
/
Copy pathtest-files.js
More file actions
55 lines (46 loc) Β· 1.6 KB
/
Copy pathtest-files.js
File metadata and controls
55 lines (46 loc) Β· 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const { PrismaClient } = require('@prisma/client')
const prisma = new PrismaClient()
async function testFileIndexing() {
console.log('π Checking file indexing status...\n')
try {
// ζ£ζ₯ζδ»Άζ°ι
const fileCount = await prisma.file.count()
console.log(`π Total files in database: ${fileCount}`)
if (fileCount > 0) {
// θ·εζθΏηζδ»Ά
const recentFiles = await prisma.file.findMany({
orderBy: { createdAt: 'desc' },
take: 5,
include: {
chunks: true
}
})
console.log('\nπ Recent files:')
recentFiles.forEach((file, idx) => {
console.log(`\n${idx + 1}. ${file.filename}`)
console.log(` Type: ${file.mimetype}`)
console.log(` Size: ${(file.size / 1024).toFixed(2)} KB`)
console.log(` Status: ${file.status}`)
console.log(` Chunks: ${file.chunks.length}`)
if (file.description) {
console.log(` Description: ${file.description}`)
}
if (file.extractedText) {
console.log(` Extracted text: ${file.extractedText.slice(0, 100)}...`)
}
})
} else {
console.log('\nβ οΈ No files found in database yet')
console.log('π‘ Try uploading a file through the web interface')
}
// ζ£ζ₯ FileChunk ζ°ι
const chunkCount = await prisma.fileChunk.count()
console.log(`\nπ¦ Total file chunks: ${chunkCount}`)
console.log('\nβ
File indexing test completed')
} catch (error) {
console.error('β Error:', error)
} finally {
await prisma.$disconnect()
}
}
testFileIndexing()