diff --git a/src/ai/kuzu-rag-orchestrator.ts b/src/ai/kuzu-rag-orchestrator.ts index 8a9af42f5..12d3dabf7 100644 --- a/src/ai/kuzu-rag-orchestrator.ts +++ b/src/ai/kuzu-rag-orchestrator.ts @@ -2,7 +2,7 @@ import { HumanMessage, SystemMessage } from '@langchain/core/messages'; import { z } from 'zod'; import { tool } from '@langchain/core/tools'; import type { LLMService, LLMConfig } from './llm-service.ts'; -import type { KuzuQueryEngine } from '../core/graph/kuzu-query-engine.ts'; +import type { KuzuQueryEngine, KuzuQueryResult } from '../core/graph/kuzu-query-engine.ts'; import type { KnowledgeGraph } from '../core/graph/types.ts'; import { isKuzuDBEnabled } from '../config/features.ts'; @@ -409,19 +409,21 @@ EXAMPLE POLYMORPHIC QUERIES: /** * Format KuzuDB query result for observation */ - private formatKuzuQueryResult(result: KuzuQueryResponse): string { - const summary = `Found ${result.nodes.length} nodes and ${result.relationships.length} relationships (execution time: ${result.executionTime.toFixed(2)}ms)`; + private formatKuzuQueryResult(result: KuzuQueryResult): string { + const nodes = result.nodes || []; + const relationships = result.relationships || []; + const summary = `Found ${nodes.length} nodes and ${relationships.length} relationships (execution time: ${result.executionTime.toFixed(2)}ms)`; - if (result.nodes.length === 0 && result.relationships.length === 0) { + if (nodes.length === 0 && relationships.length === 0) { return `${summary}. No results found.`; } - const nodeSummary = result.nodes.length > 0 - ? `\nNodes: ${result.nodes.slice(0, 5).map(n => `${n.label}:${n.properties.name || n.id}`).join(', ')}${result.nodes.length > 5 ? '...' : ''}` + const nodeSummary = nodes.length > 0 + ? `\nNodes: ${nodes.slice(0, 5).map(n => `${n.label}:${n.properties.name || n.id}`).join(', ')}${nodes.length > 5 ? '...' : ''}` : ''; - const relSummary = result.relationships.length > 0 - ? `\nRelationships: ${result.relationships.slice(0, 5).map(r => `${r.type}:${r.source}->${r.target}`).join(', ')}${result.relationships.length > 5 ? '...' : ''}` + const relSummary = relationships.length > 0 + ? `\nRelationships: ${relationships.slice(0, 5).map(r => `${r.type}:${r.source}->${r.target}`).join(', ')}${relationships.length > 5 ? '...' : ''}` : ''; return `${summary}${nodeSummary}${relSummary}`; @@ -478,7 +480,13 @@ EXAMPLE POLYMORPHIC QUERIES: return { status: 'KuzuDB not initialized' }; } - const dbStats = await this.kuzuQueryEngine.getDatabaseStats(); + // Get basic database stats + const dbStats = { + status: 'ready', + initialized: this.kuzuQueryEngine.isReady(), + timestamp: new Date().toISOString() + }; + return { kuzuDBStatus: 'ready', databaseStats: dbStats, diff --git a/src/core/ingestion/parallel-parsing-processor.ts b/src/core/ingestion/parallel-parsing-processor.ts index 9ef7fc67a..717694d63 100644 --- a/src/core/ingestion/parallel-parsing-processor.ts +++ b/src/core/ingestion/parallel-parsing-processor.ts @@ -380,7 +380,7 @@ export interface ParallelParsingResult { // Add additional relationships like single-threaded version if (definition.extends && definition.extends.length > 0) { - definition.extends.forEach(() => { + definition.extends.forEach((extendedClass) => { const extendsRelationship: GraphRelationship = { id: generateDeterministicId('extends', `${nodeId}-${extendedClass}`), type: 'EXTENDS' as RelationshipType, @@ -394,7 +394,7 @@ export interface ParallelParsingResult { } if (definition.implements && definition.implements.length > 0) { - definition.implements.forEach(() => { + definition.implements.forEach((implementedInterface) => { const implementsRelationship: GraphRelationship = { id: generateDeterministicId('implements', `${nodeId}-${implementedInterface}`), type: 'IMPLEMENTS' as RelationshipType, @@ -478,11 +478,9 @@ export interface ParallelParsingResult { } // Apply centralized ignore patterns - const beforeIgnoreFilter = filtered.length; filtered = ignoreService.filterPaths(filtered); // Apply content filter (only exclude truly empty files) - const beforeContentFilter = filtered.length; const emptyFiles: string[] = []; filtered = filtered.filter(path => { const content = fileContents.get(path); diff --git a/src/ui/pages/HomePage.tsx b/src/ui/pages/HomePage.tsx index e4caef819..a13bc8ade 100644 --- a/src/ui/pages/HomePage.tsx +++ b/src/ui/pages/HomePage.tsx @@ -26,6 +26,8 @@ interface AppState { // Input State directoryFilter: string; fileExtensions: string; + githubUrl: string; + githubToken: string; // Processing State isProcessing: boolean; @@ -52,6 +54,8 @@ const initialState: AppState = { showExportModal: false, directoryFilter: 'src,lib,components,pages,utils', fileExtensions: '.ts,.tsx,.js,.jsx,.py,.java,.cpp,.c,.cs,.php,.rb,.go,.rs,.swift,.kt,.scala,.clj,.hs,.ml,.fs,.elm,.dart,.lua,.r,.m,.sh,.sql,.html,.css,.scss,.less,.vue,.svelte', + githubUrl: '', + githubToken: localStorage.getItem('github_token') || '', isProcessing: false, progress: '', error: '', @@ -493,7 +497,7 @@ const HomePage: React.FC = () => { )} handleFileUpload({ target: { files: [file] } } as any)} + onZipFileSubmit={(file) => handleFileUpload({ target: { files: [file] } } as unknown as React.ChangeEvent)} disabled={state.isProcessing} /> diff --git a/src/ui/pages/HomePage/HomePage.tsx b/src/ui/pages/HomePage/HomePage.tsx index 0d02ce86e..360680c93 100644 --- a/src/ui/pages/HomePage/HomePage.tsx +++ b/src/ui/pages/HomePage/HomePage.tsx @@ -8,7 +8,6 @@ import WarningDialog from '../../components/WarningDialog'; import RepositoryInput from '../../components/repository/RepositoryInput'; import { useGitNexus } from '../../hooks/useGitNexus'; import { exportAndDownloadGraph, exportAndDownloadGraphAsCSV } from '../../../lib/export'; -import { getFeatureFlags } from '../../../config/features.ts'; import type { ExportFormat } from '../../components/ExportFormatModal'; /** @@ -16,7 +15,6 @@ import type { ExportFormat } from '../../components/ExportFormatModal'; * Uses custom hooks and focused components for better maintainability */ const HomePage: React.FC = () => { - const featureFlags = getFeatureFlags(); const [showNewAnalysisWarning, setShowNewAnalysisWarning] = useState(false); const { state, @@ -35,10 +33,11 @@ const HomePage: React.FC = () => { if (!state.graph) return; try { + const projectName = 'project'; // You can customize this if (format === 'json') { - await exportAndDownloadGraph(state.graph, state.fileContents); + await exportAndDownloadGraph(state.graph, { projectName }, state.fileContents); } else if (format === 'csv') { - await exportAndDownloadGraphAsCSV(state.graph, state.fileContents); + await exportAndDownloadGraphAsCSV(state.graph, { projectName }); } toggleExportModal(); } catch (error) { @@ -279,8 +278,8 @@ const HomePage: React.FC = () => { {processing.state.result && (
- 📊 {processing.state.result.graph.getNodes().length} nodes - 🔗 {processing.state.result.graph.getRelationships().length} relationships + 📊 {processing.state.result.graph.nodes.length} nodes + 🔗 {processing.state.result.graph.relationships.length} relationships
)} @@ -301,14 +300,6 @@ const HomePage: React.FC = () => { )} @@ -319,9 +310,8 @@ const HomePage: React.FC = () => { )} @@ -329,10 +319,10 @@ const HomePage: React.FC = () => { {state.showExportModal && state.graph && ( )}