Tech
2024-08-29
AI-based personal knowledge assistant: custom code analysis and document management

Table of contents

synoptic

Last time Asking ChatGPT what ChatGPT doesn't know In this article, I learned how to ask ChatGPT questions about private personal data. This time, I would like to introduce more improved methods and uses.

Examples of use

Notion document summary and search

First, you need to import the desired page from Notes. Click the menu in the text on the right side of the note and select Export.

key

Next, you must decide whether to include subpages. If you select 'Include subpages', you can download that page and all of its linked subpages. Once you've made your selections, click the Export button.

key

You will receive a download link by email. Click the link to download, unzip, and organize the created folders. I collected and organized the materials imported under a folder called note, as shown in the image below.

key

The process of installation and configuration will be explained at the end.

Assuming that the installation and setup are complete, let's start by looking at the usage results. The image below shows the result screen for the question. The logsink in the question is WTAP's technology. ChatGPT searched all the documents that had been downloaded and answered by ChatGPT with similar content. If you look at the bottom, you can also see the name of the note document you were referring to.

key

Project code analysis

When you need to refer to or take over a project from another developer, it would be nice to have a detailed guide document or explanation, but this is often not the case. Even if there is such a document, it is often different from the current state of the code.

The image below is the result of providing the full project code and asking questions.

key

You can easily gain an overall understanding of the project through various diagrams about the project and questions about the progress of the code where you are curious.

  • You can ask questions about the entire codebase
  • Provide a detailed explanation of the project structure, key features, and technologies used

Pair programming

Similar to analysis, you can communicate the entire ongoing project code and ask for comments on future progress or direct further development. The image below is the result of a request to add functionality to existing code. The content was long, so I only captured part of it.

key

 

ChatGPT doesn't need to analyze the code of an existing project and write every word of information that would be needed when requesting code. Since you can simply and abstractly request what you want and then add what you lack little by little, you can proceed with development as if you were programming Pay with other fellow developers.

  • Request to add new features based on existing code
  • Code refactoring suggestions
  • Propose a solution to the bug

How to install

  1. Clone or download this repository:git clone https://github.com/your-repo/CodeSage.git

    cd codeSage

  1. Install the required packages:pip install -r requirements.txt

  1. Enter your OpenAI API key:
    • SageSettings.json Open the file and enter your API key instead of “your_openai_api_key”:{

      “openai_api_key”: “your_openai_api_key”,

      “extensions”: [” .md”, “.vue”, “.js”, “.json”, “.css”, “.html”, “.py”, “.java”, “.ts”, “.jsx”, “.tsx”, “.php”, “.c”, “.cpp”, “.h”, “.cs”, “.swift”, “.rb”, “.go”, “.kt”, “.hpp”, “.hpp”, “.sql”, “.m” .mm”],

      “ignore_folders”: ["SageLibs”, “SageTemplate”, “node_modules”, “cypress”, “.gradle”, “.idea”, “build”, “test”, “bin”, “dist”, “.vscode”, “.git”, “.github”, “.expo”],

      “ignore_files”: [” CodeSage.py “, “SageSettings.json”, “question_history.json”, “embeddings.json”, “package-lock.json”],

      “essential_files”: ["README.md”, “package.json”, "src/router/index.js “]

      }

    • After running the program, you can also work on the settings page.

How to use

  1. Run the application:python CodeSage-Multi.py

  1. In a web browser http://localhost:8080Go to and click the folder icon in the upper right corner.
key
  1. Add folders with reference materials, and select a folder to use for questions by clicking the check button. Once the choice is finalized Back to home Click the button to return to the home page.
  1. Click the “Refresh Embeddings” button to create an embedding file for the project file.
    • Through this process, all files to be referenced are found, converted to vectors, and prepared for AI to understand.
    • Files that have already been processed are not duplicated. Keep up to date by pressing the button periodically.
  2. Type and submit questions to get answers from AI.

Cautions and notes

  • Be careful not to leak your API key.
  • Files that are too large are excluded from reference documents. This section will be improved and distributed in the future.
  • Other than text files, only pdf documents are supported. Office files etc. will be added later.

finishing

The CodeSage introduced here is a simple program, but it is a tool that can greatly improve the daily work of developers. Use it to save time and improve efficiency in various tasks such as project analysis, code review, and documentation.

The CodeSage project will provide more advanced features through ongoing updates and feedback. We look forward to hearing from you.

Experience Monitoring with WhaTap!