rag-kb-system / debug_content.js
duqing2026's picture
对接语雀 token,同步所有文档,并同样布局展示页面和交互功能,并未实现对话知识库功能
2c10495
const Database = require('better-sqlite3');
const path = require('path');
const db = new Database(path.join(process.cwd(), 'rag-kb.db'));
try {
const docs = db.prepare('SELECT id, title, length(content_preview) as len, content_preview FROM documents WHERE content_preview IS NOT NULL AND content_preview != \'\' LIMIT 5').all();
console.log("Documents with content:", docs.map(d => ({ id: d.id, title: d.title, length: d.len, preview: d.content_preview.substring(0, 50) })));
const emptyDocs = db.prepare('SELECT id, title FROM documents WHERE content_preview IS NULL OR content_preview = \'\' LIMIT 5').all();
console.log("Documents without content:", emptyDocs);
const totalDocs = db.prepare('SELECT count(*) as count FROM documents').get();
console.log("Total documents:", totalDocs);
const totalEmpty = db.prepare('SELECT count(*) as count FROM documents WHERE content_preview IS NULL OR content_preview = \'\'').get();
console.log("Total empty documents:", totalEmpty);
} catch (error) {
console.error("Database error:", error);
}