mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-08-28 05:25:25 +00:00
fixed ts errors
This commit is contained in:
parent
4d5f37fbc7
commit
d6d9a1995b
4 changed files with 33 additions and 33 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 = () => {
|
|||
)}
|
||||
|
||||
<RepositoryInput
|
||||
onZipFileSubmit={(file) => handleFileUpload({ target: { files: [file] } } as any)}
|
||||
onZipFileSubmit={(file) => handleFileUpload({ target: { files: [file] } } as unknown as React.ChangeEvent<HTMLInputElement>)}
|
||||
disabled={state.isProcessing}
|
||||
/>
|
||||
|
||||
|
|
|
|||
|
|
@ -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 && (
|
||||
<div className="processing-results">
|
||||
<div className="result-stats">
|
||||
<span>📊 {processing.state.result.graph.getNodes().length} nodes</span>
|
||||
<span>🔗 {processing.state.result.graph.getRelationships().length} relationships</span>
|
||||
<span>📊 {processing.state.result.graph.nodes.length} nodes</span>
|
||||
<span>🔗 {processing.state.result.graph.relationships.length} relationships</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -301,14 +300,6 @@ const HomePage: React.FC = () => {
|
|||
<ChatInterface
|
||||
graph={state.graph}
|
||||
fileContents={state.fileContents}
|
||||
selectedNodeId={state.selectedNodeId}
|
||||
llmProvider={settings.settings.llmProvider}
|
||||
llmApiKey={settings.settings.llmApiKey}
|
||||
azureConfig={{
|
||||
endpoint: settings.settings.azureOpenAIEndpoint,
|
||||
deploymentName: settings.settings.azureOpenAIDeploymentName,
|
||||
apiVersion: settings.settings.azureOpenAIApiVersion
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -319,9 +310,8 @@ const HomePage: React.FC = () => {
|
|||
<GraphExplorer
|
||||
graph={state.graph}
|
||||
fileContents={state.fileContents}
|
||||
selectedNodeId={state.selectedNodeId}
|
||||
onNodeSelect={handleNodeSelect}
|
||||
showStats={state.showStats}
|
||||
isLoading={processing.state.isProcessing}
|
||||
/>
|
||||
)}
|
||||
</main>
|
||||
|
|
@ -329,10 +319,10 @@ const HomePage: React.FC = () => {
|
|||
|
||||
{state.showExportModal && state.graph && (
|
||||
<ExportFormatModal
|
||||
onExport={handleExport}
|
||||
isOpen={state.showExportModal}
|
||||
onSelectFormat={handleExport}
|
||||
onClose={toggleExportModal}
|
||||
nodeCount={state.graph.nodes.length}
|
||||
relationshipCount={state.graph.relationships.length}
|
||||
projectName="project"
|
||||
/>
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue