Skip to content

Commit 63c92fc

Browse files
author
Tim Sinaeve
committed
chore: release v0.8.9 - fix RAG indexing and enhance transparency
1 parent f853ca1 commit 63c92fc

9 files changed

Lines changed: 91 additions & 10 deletions

File tree

VERSION_LOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
## v0.8.8 - The Agentic Workspace Update
1+
## v0.8.9 - The RAG Indexing & Transparency Fix
2+
1:
3+
2: ### 🐛 Fixes
4+
3:
5+
4: - **RAG Workspace Indexing**:
6+
5: * Fixed a critical bug where workspace indexing would find documents but fail to process them (showing "0 documents processed").
7+
6: * Corrected the `rag_vectors` virtual table schema by removing an unsupported `PRIMARY KEY` constraint.
8+
7: * Added automated schema recovery logic to detect and report missing or broken vector tables.
9+
8: - **Transparency & Feedback**:
10+
9: * **Main Process Error Propagation**: Backend indexing errors are now captured and displayed directly in the Chat Panel log, providing clear feedback if document processing fails.
11+
10: * **Enhanced Status Diagnostics**: The "Build Index" process now performs a pre-flight check of the database schema and reports specific configuration or initialization errors.
12+
11: * **Detailed Content Logs**: Added diagnostic logging to identify documents that are skipped due to missing content or extraction failures.
13+
12:
14+
13: ## v0.8.8 - The Agentic Workspace Update
215

316
### ✨ Features
417

components/ChatPanel.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,15 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
106106
const result = await ragService.indexAll(settings);
107107
if (result.success) {
108108
addLog('INFO', `RAG: Index build complete. Found ${result.totalDocumentsFound || 0} documents. Processed ${result.documentsProcessed} documents, ${result.totalChunks} chunks.`);
109+
if (result.errors && result.errors.length > 0) {
110+
addLog('WARNING', `RAG: Encountered errors while indexing ${result.errors.length} documents:`);
111+
result.errors.forEach(err => addLog('ERROR', ` - ${err}`));
112+
}
109113
if (result.documentsProcessed === 0) {
110114
addLog('WARNING', `RAG: No documents were processed into the index. (Found ${result.totalDocumentsFound || 0} document nodes in total).`);
115+
if (!result.errors || result.errors.length === 0) {
116+
addLog('INFO', 'RAG: Tip - Check if Ollama is running and the embedding model is downloaded.');
117+
}
111118
}
112119
} else {
113120
addLog('ERROR', `RAG: Index build failed: ${result.error}`);

docs/VERSION_LOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
## v0.8.8 - The Agentic Workspace Update
1+
## v0.8.9 - The RAG Indexing & Transparency Fix
2+
1:
3+
2: ### 🐛 Fixes
4+
3:
5+
4: - **RAG Workspace Indexing**:
6+
5: * Fixed a critical bug where workspace indexing would find documents but fail to process them (showing "0 documents processed").
7+
6: * Corrected the `rag_vectors` virtual table schema by removing an unsupported `PRIMARY KEY` constraint.
8+
7: * Added automated schema recovery logic to detect and report missing or broken vector tables.
9+
8: - **Transparency & Feedback**:
10+
9: * **Main Process Error Propagation**: Backend indexing errors are now captured and displayed directly in the Chat Panel log, providing clear feedback if document processing fails.
11+
10: * **Enhanced Status Diagnostics**: The "Build Index" process now performs a pre-flight check of the database schema and reports specific configuration or initialization errors.
12+
11: * **Detailed Content Logs**: Added diagnostic logging to identify documents that are skipped due to missing content or extraction failures.
13+
12:
14+
13: ## v0.8.8 - The Agentic Workspace Update
215

316
### ✨ Features
417

docs/releases/v0.8.9.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# DocForge v0.8.9 Release Notes
2+
3+
## 🏷️ The RAG Indexing & Transparency Fix
4+
5+
This release focuses on resolving critical stability issues in the RAG (Retrieval-Augmented Generation) workspace indexing engine and improving the transparency of background operations.
6+
7+
### 🐛 Bug Fixes
8+
9+
- **RAG Workspace Indexing Fix**:
10+
- Resolved a bug where the indexing process would successfully discover documents but fail to process any chunks, resulting in an empty index.
11+
- Corrected the `rag_vectors` virtual table schema in the database initialization logic.
12+
- Fixed a silent failure in the SQLite extension loading process that could cause transactions to roll back without user notification.
13+
14+
### ✨ Improvements
15+
16+
- **Error Visibility**:
17+
- Indexing errors from the main process are now propagated to the renderer and displayed in the **Chat Panel log**.
18+
- Added clear troubleshooting tips when indexing results in 0 processed documents (e.g., suggestions to check Ollama status).
19+
- **Diagnostic Diagnostics**:
20+
- The application now performs a detailed check of the RAG engine status on startup and when building the index, identifying missing tables or unsupported architectures.
21+
- **Enhanced Logging**:
22+
- Added document-level logging to track content retrieval and chunking, making it easier to identify why specific documents might be skipped.
23+
24+
---
25+
*For a full history of changes, see the [Version Log](../../VERSION_LOG.md).*

electron/database.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,15 @@ export const databaseService = {
14141414
};
14151415
}
14161416

1417+
// Check if rag_vectors table exists
1418+
const tableCheck = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='rag_vectors'").get();
1419+
if (!tableCheck) {
1420+
return {
1421+
success: false,
1422+
error: 'The rag_vectors table is missing. This usually happens if the database was initialized with an invalid schema. You may need to reset your database if this persists.',
1423+
};
1424+
}
1425+
14171426
const totalRow = db.prepare('SELECT COUNT(*) as count FROM nodes WHERE node_type = \'document\'').get() as { count: number };
14181427
const indexedRow = db.prepare('SELECT COUNT(DISTINCT node_id) as count FROM rag_chunks').get() as { count: number };
14191428

@@ -1446,7 +1455,14 @@ export const databaseService = {
14461455
WHERE n.node_id = ? AND n.node_type = 'document'
14471456
`).get(nodeId) as { title: string; text_content: string } | undefined;
14481457

1449-
if (!row || !row.text_content) return null;
1458+
if (!row) {
1459+
console.log(`[RAG DB] Document entry not found for node: ${nodeId}`);
1460+
return null;
1461+
}
1462+
if (!row.text_content) {
1463+
console.log(`[RAG DB] Document "${row.title}" (${nodeId}) has no text content in store (it might be empty or a different type).`);
1464+
return null;
1465+
}
14501466
return { title: row.title, content: row.text_content };
14511467
},
14521468

electron/embeddingService.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,13 @@ export const embeddingService = {
192192
ollamaBaseUrl: string,
193193
modelName: string,
194194
onProgress?: (current: number, total: number) => void
195-
): Promise<{ documentsProcessed: number; totalChunks: number; totalDocumentsFound: number }> {
195+
): Promise<{ documentsProcessed: number; totalChunks: number; totalDocumentsFound: number; errors?: string[] }> {
196196
const nodeIds = databaseService.ragGetAllDocumentNodeIds();
197197
console.log(`[RAG] Starting full index of ${nodeIds.length} documents.`);
198198
let totalChunks = 0;
199199
let documentsProcessed = 0;
200200
const totalDocumentsFound = nodeIds.length;
201+
const errors: string[] = [];
201202

202203
if (nodeIds.length === 0) {
203204
console.log('[RAG] No documents found to index.');
@@ -208,14 +209,19 @@ export const embeddingService = {
208209
const result = await this.indexDocument(nodeIds[i], ollamaBaseUrl, modelName);
209210
totalChunks += result.chunksCreated;
210211
if (result.chunksCreated > 0) documentsProcessed++;
211-
} catch (error) {
212-
console.error(`[RAG] Failed to index document ${nodeIds[i]}:`, error);
212+
} catch (error: any) {
213+
const errorMsg = error instanceof Error ? error.message : String(error);
214+
// Try to get document title for the error message
215+
const doc = databaseService.ragGetDocumentContent(nodeIds[i]);
216+
const title = doc ? doc.title : nodeIds[i];
217+
console.error(`[RAG] Failed to index document "${title}":`, errorMsg);
218+
errors.push(`"${title}": ${errorMsg}`);
213219
}
214220
onProgress?.(i + 1, nodeIds.length);
215221
}
216222

217223
console.log(`[RAG] Full index complete. Processed ${documentsProcessed} documents, created ${totalChunks} total chunks.`);
218-
return { documentsProcessed, totalChunks, totalDocumentsFound };
224+
return { documentsProcessed, totalChunks, totalDocumentsFound, errors: errors.length > 0 ? errors : undefined };
219225
},
220226

221227
/**

electron/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// removing the need for external .sql files which can complicate the build process.
33

44
export const INITIAL_SCHEMA = `
5-
-- PRAGMA user_version is set to 7 by the database service for this schema.
5+
-- PRAGMA user_version is set to 9 by the database service for this schema.
66
77
-- =================================================================
88
-- CORE HIERARCHY & METADATA
@@ -237,7 +237,7 @@ CREATE INDEX idx_rag_chunks_node ON rag_chunks(node_id);
237237
-- sqlite-vec virtual table for vector similarity search
238238
-- nomic-embed-text produces 768-dimensional vectors
239239
CREATE VIRTUAL TABLE IF NOT EXISTS rag_vectors USING vec0(
240-
chunk_id INTEGER PRIMARY KEY,
240+
chunk_id INTEGER,
241241
embedding float[768]
242242
);
243243
`;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docforge",
3-
"version": "0.8.8",
3+
"version": "0.8.9",
44
"description": "An application to manage and refine documents.",
55
"main": "dist/main.js",
66
"scripts": {

types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ export interface RagIndexResponse {
622622
totalChunks: number;
623623
totalDocumentsFound?: number;
624624
error?: string;
625+
errors?: string[];
625626
}
626627

627628
export interface AgentToolCall {

0 commit comments

Comments
 (0)