add knowledge graph #2
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request (PR) introduces a new feature: a knowledge graph generator based on uploaded PDF documents, along with several structural improvements and dependency updates. Here's a breakdown:
Key Features and Changes:
Knowledge Graph Generator:
A new feature is added that allows users to upload PDF files and generate interactive knowledge graphs.
The KnowledgeGraphView.js component provides the overall view, while KnowledgeGraphComponent.js handles the core logic.
The knowledgeGraphService.js handles the backend logic:
Extracts text from PDFs using pdfjs-dist.
Uses the OpenAI API (GPT-4) to extract entities and relationships from the text.
Stores the extracted data in a Neo4j database.
Retrieves data from Neo4j to visualize the graph.
The graph is rendered using D3.js, with interactive features like zoom, drag, and different layout options (force-directed, circular, hierarchical).
Progress is shown to the user during the PDF processing.
Routing and Navigation:
A new route /knowledge-graph is added to the application, linking to the KnowledgeGraphView component.
The navigation menu in App.js is updated to include a "Knowledge Graph" link.
The routing system has been standardized to use VueRouter version 4.
Dependency Updates:
Several dependencies are added or updated, including:
d3: For graph visualization.
neo4j-driver: For interacting with the Neo4j database.
pdfjs-dist: For extracting text from PDF files.
axios: For making HTTP requests to the OpenAI API.
Tailwind and PostCSS are updated.
OpenAI package updated.
.env file variables are referenced for API keys and Neo4j connection details.
Code Structure and Improvements:
The application structure is improved with the introduction of a dedicated services directory for backend logic.
The App.js component is refactored to improve readability and maintainability.
The vue version is updated to vue 3.3.4.
The code now correctly uses Vue 3 composition API.
PR Explanation for Non-Technical Stakeholders:
"This update adds a powerful new feature to our application: the ability to turn PDF documents into interactive knowledge graphs. Imagine uploading a research paper, and the application automatically creates a visual map showing the key concepts, people, and relationships discussed in the document. This makes it much easier to understand and explore complex information.
We've also made improvements to the application's navigation and updated some of the underlying technology to ensure everything runs smoothly and efficiently. This update makes the application more useful and provides a more intuitive way to explore and understand information."
In summary: This PR significantly enhances the application's capabilities by introducing a knowledge graph generation feature, improving the overall structure, and updating dependencies.