Knowledge base management and retrieval system and retrieval method based on VS Code double plug-ins
By introducing the LjCode and LjKB dual-plugin system into VS Code and combining it with the Dify platform, the problems of insufficient personal knowledge base retrieval capabilities and poor underlying development compatibility of existing plugins have been solved. This has enabled efficient integrated knowledge base management and retrieval, improving development efficiency and scalability.
Patent Information
- Application Number
- CN202512027881.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-05-15
AI Technical Summary
Existing VS Code programming plugins lack personal knowledge base retrieval capabilities, have poor adaptability to underlying development scenarios, low efficiency in switching between multiple interfaces, cannot meet personalization and sharing needs, and have high architectural coupling leading to insufficient scalability.
It adopts the LjCode and LjKB dual-plugin system based on VS Code, achieves loosely coupled collaboration through the Dify platform, supports personal knowledge base management and retrieval, has a built-in high-quality vertical knowledge base, provides multi-format document parsing and permission management, the two plugins can run independently or collaboratively, and support secondary development.
It integrates personal knowledge base retrieval and integrated development environment within VS Code, improving underlying development efficiency, adapting to multiple languages and document formats, reducing the cost of switching between multiple interfaces, and simplifying the secondary development process.
Smart Images

Figure CN122045390A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge base management and retrieval technology, and more specifically, to a knowledge base management and retrieval system and retrieval method based on VS Code dual plugins. Background Technology
[0002] VS Code, as a mainstream integrated development environment (IDE), greatly improves development efficiency with its rich plugin ecosystem. However, existing auxiliary programming plugins have many significant technical shortcomings in low-level development scenarios, making it difficult to meet actual development needs. Specific problems are as follows:
[0003] (a) Lack of personal knowledge base retrieval ability.
[0004] Existing plugins (such as GitHub Copilot and Continue) rely on general large-scale model training data to generate code, and can only implement syntax correction and basic completion functions. They cannot access developers' personalized knowledge such as "personal project documents, private code snippets, and team-customized specifications." For example, when developers need to reuse a certain type of embedded driver template they have written, they have to frequently switch between "VS Code + external documentation tools (such as Yuque, local folders)," with each switch taking about 30 seconds, which severely disrupts the development process.
[0005] (ii) Poor adaptability to underlying development scenarios.
[0006] The built-in knowledge of existing plugins is mostly "general code snippets" (such as basic Python syntax and simple Java class definitions), which do not cover "core low-level development scenarios" at all. Scenarios such as C / C++ driver development (PCIe / USB device interaction), firmware development (embedded RTOS task scheduling), hardware management middleware development (device abstraction layer design), and Verilog FPGA full-process development (from RTL coding to synthesis and simulation) are not involved, and the code quality cannot be guaranteed, making it almost impossible for low-level developers to achieve effective reuse.
[0007] (iii) Switching between multiple interfaces leads to low development efficiency.
[0008] Existing knowledge base management tools are mostly standalone applications or web-based. When developers write code in VS Code, they need to frequently switch out of the editor to operate external tools. This not only interrupts the development focus, but also, for low-level development, the switching cost is higher because it requires frequent consultation of professional knowledge bases (such as FPGA timing constraint documents). Statistics show that this can reduce development efficiency by 40% and seriously affect the development schedule.
[0009] (iv) Personalization and sharing needs cannot be met.
[0010] Existing tools either "only support built-in knowledge (cannot be customized)" or "only support single-format documents (such as Markdown only)". Developers cannot create their own code knowledge base, nor can they integrate multi-format documents (such as PDF hardware manuals and Word interface specifications) into searchable resources. Furthermore, they lack a sound knowledge sharing mechanism, which greatly reduces the efficiency of team collaboration.
[0011] (v) The plug-in architecture has high coupling and insufficient scalability.
[0012] Most plugins adopt a "monolithic design," tightly binding knowledge base management and retrieval functions. This results in useless functions (such as developers only needing the retrieval function but having to load the completion module) consuming a large amount of system resources. At the same time, the interfaces are closed, making it impossible to work with new plugins (such as integrating with code review plugins developed by the team), resulting in extremely high secondary development costs and difficulty in adapting to the personalized needs of underlying development.
[0013] To address the aforementioned issues, there is an urgent need for a technical solution that features "personal knowledge base retrieval, vertical domain adaptation, loosely coupled extension, and integration within an IDE" to fill the gaps in existing technologies. Summary of the Invention
[0014] This invention addresses the technical problems existing in the prior art by providing a knowledge base management and retrieval system and retrieval method based on VS Code dual plugins.
[0015] According to a first aspect of the present invention, a knowledge base management and retrieval system based on dual VS Code plugins is provided, including LjCode plugin and LjKB plugin independently deployed on the VS Code client, and the Dify platform providing underlying support; the LjCode plugin and the LjKB plugin achieve loosely coupled collaboration through the VS Code standardized communication interface, and both the LjCode plugin and the LjKB plugin establish data interaction with the Dify platform through standardized APIs;
[0016] The Dify platform is used to deploy pre-processed built-in knowledge bases and to provide storage services for personal knowledge bases.
[0017] The LjKB plugin is used to allow users to create personal knowledge bases on it and synchronize them to the Dify platform, as well as to trigger the activation signal of the target personal knowledge base and send the activation signal of the target personal knowledge base to the LjCode plugin.
[0018] The LjCode plugin is used to call the Dify platform interface to verify the validity of the target knowledge base based on the received activation signal of the target personal knowledge base or the retrieval signal of the target built-in knowledge base triggered directly on it. After the verification is passed, it sets the retrieval keywords of the target knowledge base, which includes the target personal index base and / or the target built-in knowledge base; it converts the retrieval keywords into query vectors, and performs a hybrid retrieval strategy on the target knowledge base based on the retrieval keywords and the query vectors to obtain retrieval results; it obtains code completion results based on the retrieval keywords through AI empowerment of the underlying model; and it is also used to merge the retrieval results and the code completion results and display them in sorted order.
[0019] Based on the above technical solution, the present invention can also be improved as follows.
[0020] According to a second aspect of the present invention, a knowledge base management and retrieval method based on VS Code dual plugins is provided, applied to a knowledge base management and retrieval system based on VS Code dual plugins, the method comprising:
[0021] Step 1: Initialize the Dify platform, deploy the pre-processed built-in knowledge base, and enable the built-in knowledge base retrieval service;
[0022] Step 2: Activate the LjCode plugin and the LjKB plugin. The LjCode plugin and the LjKB plugin will automatically connect to the Dify platform via API.
[0023] Step 3: The user creates a personal knowledge base through the LjKB plugin, synchronizes it to the Dify platform, and triggers the activation signal of the target personal knowledge base through the LjKB plugin, and sends the activation signal of the target personal knowledge base to the LjCode plugin.
[0024] Step 4: The LjCode plugin calls the Dify platform interface to verify the validity of the target knowledge base based on the received activation signal of the target personal knowledge base or the retrieval signal of the target built-in knowledge base triggered directly on it. After the verification is passed, the retrieval keywords of the target knowledge base are set. The target knowledge base includes the target personal index library and / or the target built-in knowledge base.
[0025] Step 5: The LjCode plugin converts the search keywords into query vectors, performs a hybrid search strategy on the target knowledge base based on the search keywords and the query vectors, and obtains search results; and obtains code completion results based on the search keywords through AI empowerment of the underlying model.
[0026] Step 6: The LjCode plugin merges the search results and the code completion results and displays them in a sorted manner, so that users can insert the merged results into the VS Code editing area with one click.
[0027] This invention provides a knowledge base management and retrieval system and method based on dual VS Code plugins. The system comprises two plugins, LjCode and LjKB, independently deployed on the VS Code client, and the Dify platform providing underlying support. The LjCode and LjKB plugins achieve loosely coupled collaboration through a standardized VS Code communication interface, and both plugins interact with the Dify platform via standardized APIs. This invention, by configuring the LjKB plugin, overcomes the limitations of traditional auxiliary programming plugins that only provide "completion and error correction," achieving integrated development of personal knowledge base retrieval and integrated development environment (IDE) development. It supports the creation and sharing of personal knowledge bases in multiple languages and formats, expanding the range of formats natively supported by Dify. The LjCode plugin incorporates high-quality vertically integrated knowledge bases in various coding languages, comprehensively covering all underlying development scenarios. The loosely coupled design of the LjCode and LjKB plugins allows them to run independently or collaboratively, facilitating secondary development. Attached Figure Description
[0028] Figure 1 An architecture diagram of a knowledge base management and retrieval system based on dual VS Code plugins is provided as an embodiment of the present invention;
[0029] Figure 2 The flowchart illustrates a knowledge base management and retrieval method based on dual VS Code plugins, as provided in one embodiment of the present invention. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. In addition, the technical features of the various embodiments or individual embodiments provided by the present invention can be arbitrarily combined with each other to form feasible technical solutions. Such combinations are not constrained by the order of steps and / or structural composition patterns, but must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.
[0031] This invention aims to solve the technical problems of existing auxiliary programming plugins, such as "lack of personal knowledge base retrieval capabilities, poor adaptation to underlying scenarios, low efficiency in switching between multiple interfaces, inability to meet personalization and sharing needs, and weak architecture coupling and extension." It provides a loosely coupled knowledge base management and retrieval system and method based on VS Code dual plugins, realizing the integration of underlying development knowledge management and retrieval within the integrated development environment (IDE), and meeting the needs of underlying developers for efficient knowledge reuse, team collaboration, and private development.
[0032] Figure 1 This invention illustrates a knowledge base management and retrieval system based on a VS Code dual-plugin, as provided in one embodiment of the present invention. Figure 1 As shown, the system mainly includes the LjCode plugin and LjKB plugin, which are independently deployed on the VS Code client, and the Dify platform, which provides underlying support. The LjCode plugin and the LjKB plugin achieve loosely coupled collaboration through the VS Code standardized communication interface. Both the LjCode plugin and the LjKB plugin establish data interaction with the Dify platform through standardized APIs.
[0033] The Dify platform, LjCode plugin, and LjKB plugin all support local deployment on enterprise internal servers. The LjKB plugin exposes RESTful-style secondary development interfaces to support collaboration with external plugins. The personal knowledge base is stored using AES encryption to meet the security requirements of private development data.
[0034] The VS Code standardized communication interfaces include the window.postMessage signal sending interface and the onDidReceiveMessage event listening interface in the VS Code Extension API. The signal sending interface enables signal sending between the LjCode plugin and the LjKB plugin, and the event listening interface enables event listening between the LjCode plugin and the LjKB plugin.
[0035] The Dify platform is used to deploy a pre-processed built-in knowledge base and provide storage services for personal knowledge bases. The built-in knowledge base covers knowledge bases for different coding languages; in this embodiment, it mainly includes built-in knowledge bases for two major vertical domains: C / C++ and Verilog. The Dify platform's built-in knowledge base supports regular updates, performing "redundancy cleaning - syntax correction - scene annotation" pre-processing on newly added code. Updated content is pushed to users through the WebView interface of the LjKB plugin.
[0036] The LjKB plugin is used to allow users to create personal knowledge bases on it and synchronize them to the Dify platform, as well as to trigger an activation signal for the target personal knowledge base and send the activation signal of the target personal knowledge base to the LjCode plugin.
[0037] The LjKB plugin loads the WebView management interface, allowing users to upload documents in various formats. It is compatible with code files from almost all mainstream programming languages, including C, C++, Java, and Python, as well as document formats such as MD, DOCX, and PDF, expanding the range of document formats natively supported by Dify. The LjKB plugin parses documents of various formats, generates standardized data, and creates a personal knowledge base based on this standardized data.
[0038] The LjKB plugin also provides a built-in knowledge base visualization module, which can display the scenario coverage list, code preprocessing status, and update logs of the two built-in knowledge bases for C / C++ and Verilog.
[0039] The LjKB plugin also features personal knowledge base management capabilities, supporting the creation and configuration of "private / public" permissions, and providing code browsing and uploading, drag-and-drop uploading, batch uploading, and upload preview functions. Specifically, the WebView management interface allows for permission configuration, personal knowledge base ID configuration, and the addition of "development scenario + core function" dual-label information to code documents within the personal knowledge base, thus constructing the basic information of the personal knowledge base and synchronizing it to the Dify platform.
[0040] The LjKB plugin has a built-in personal search engine trigger module. When a user needs to search their personal knowledge base, they can send an activation signal to the LjCode plugin through this module. The signal includes the user's ID, the target personal knowledge base ID, and permission information. The signal data between the LjCode and LjKB plugins is transmitted in JSON format and includes four core fields: signal type, user ID (userId), knowledge base ID (kbId), and permission.
[0041] The LjCode plugin is used to call the Dify platform interface to verify the validity of the target knowledge base based on the received activation signal of the target personal knowledge base or the retrieval signal of the target built-in knowledge base triggered directly on it. After the verification is successful, it sets the retrieval keywords for the target knowledge base, which includes the target personal index base and / or the target built-in knowledge base; it also converts the retrieval keywords into query vectors, performs a hybrid retrieval strategy on the target knowledge base based on the retrieval keywords and the query vectors, and obtains retrieval results; it also obtains code completion results based on the retrieval keywords through AI empowerment of the underlying model; and it is also used to merge the retrieval results and the code completion results and display them in sorted order.
[0042] Specifically, when the LjCode plugin receives the activation signal for the target personal knowledge base sent by the LjKB plugin, it calls the Dify platform interface to verify the validity of the target personal knowledge base. After the verification is successful, it sets the search keywords for the target personal knowledge base.
[0043] For searches of the built-in knowledge base, you can initiate them directly on the LjCode plugin. Specifically, the LjCode plugin integrates a built-in knowledge base search engine, which can be used to directly trigger searches of the built-in knowledge base.
[0044] The LjCode plugin, based on the activation signal of the target personal index library or the retrieval signal of the target built-in knowledge library, first verifies the validity of the target knowledge library (including the target personal knowledge library or the target built-in knowledge library) according to the retrieval request. If the verification passes, it sets the corresponding search keywords according to the retrieval request and converts the search keywords into query vectors. Then, it combines the search keywords and query vectors and uses a hybrid retrieval strategy to search the target knowledge library to obtain the search results. Additionally, based on the search keywords, it uses AI-powered underlying models to obtain code completion results, i.e., it generates code completion results through a question-answering AI model.
[0045] The LjCode plugin integrates a hybrid search module that uses search keywords and query vectors to perform a hybrid search strategy on the target knowledge base, yielding search results including:
[0046] The hybrid retrieval module performs searches in the target knowledge base based on both search keywords and query vectors. The search for search keywords uses an inverted index to match syntax elements and obtain the first search result. The search for query vectors uses the Weaviate vector database integrated into the Dify platform to perform an approximate nearest neighbor query and obtain the second search result.
[0047] The first and second search results are rearranged and deduplicated to obtain the search results in the target knowledge base. The search results are then filtered and selected, retaining the search results with a similarity threshold greater than or equal to a preset threshold. For example, in this embodiment of the invention, the search results with a similarity greater than 0.7 are retained as the final search results.
[0048] After obtaining the search results and code completion results separately, they are merged and displayed in sorted order. Specifically, weight coefficients are set for the search results and code completion results, for example, a weight coefficient of 0.6 for the search results and 0.4 for the code completion results. Based on the matching similarity of the search results and the matching similarity of the code completion results, and the corresponding weight coefficients, the matching similarity of the search results and the matching similarity of the code completion results are weighted and merged to obtain a comprehensive matching similarity result. The results are then displayed in descending order according to the matching similarity of the comprehensive result through the WebView interface of the LjKB plugin.
[0049] The main innovative architecture of the system provided in this embodiment of the invention is described below. This embodiment of the invention provides a knowledge base management and retrieval system based on dual VS Code plugins. The system's overall architecture is constructed through a combination of "overall system architecture + five core innovations." The overall system architecture is divided into a "client-side plugin layer" and a "service support layer." The client-side plugin layer includes two plugins: LjCode (primarily responsible for knowledge base retrieval and result fusion) and LjKB (primarily responsible for knowledge base management). The service support layer is the Dify platform (knowledge base storage and API response). The two plugins collaborate through a standardized VS Code interface and both connect to the Dify platform via API.
[0050] The main innovations of this invention include the following aspects:
[0051] (1) Breaking through the limitation of "only completing and correcting", the invention realizes the integration of knowledge base retrieval and integrated development environment (IDE). Specifically, in response to the pain point that existing plugins cannot retrieve knowledge bases, this invention designs a collaborative solution of "LjCode plugin + Dify platform":
[0052] The LjCode plugin core has added a "Personal Knowledge Base Retrieval Module", which breaks through the functional boundaries of traditional plugins. It can call personal knowledge base data from the Dify platform through API, achieving a seamless connection between "retrieval-reuse-development".
[0053] Built-in knowledge base: LjCode loads the built-in knowledge base search engine by default, and allows developers to choose the search scope themselves;
[0054] Personal Knowledge Base: No complex configuration is required by the user. Simply trigger the signal by clicking the "Enable Personal Knowledge Base Search Engine" button in the LjKB plugin, and the LjCode plugin will automatically refresh and obtain the personal knowledge base search engine. The whole process is completed within VSCode without switching tools.
[0055] Results fusion: The built-in / personal library search results and code completion results are weighted and sorted according to "relevance + executability". Developers can click on the corresponding results to insert them into the editing area, effectively solving the problem of "separation between knowledge retrieval and development".
[0056] (2) Construct two mature vertical domain built-in knowledge bases to fully cover underlying development scenarios. Specifically, in response to the pain point of poor adaptability to underlying development scenarios, this invention has built-in two vertical domain knowledge bases: C / C++ and Verilog. Its core features are as follows:
[0057] Maturity: All built-in knowledge base code has undergone "three-step preprocessing" (redundancy cleaning - syntax correction - scene annotation) to ensure direct reuse (see the relevant description of the Dify platform in the following section for the specific preprocessing process).
[0058] Full scene coverage:
[0059] C / C++ knowledge base: covering more than ten scenarios including driver development (PCIe / USB / SPI interface drivers), firmware development (embedded bare metal programs, RTOS task scheduling), and hardware management middleware development (device abstraction layer, bus interaction logic);
[0060] Verilog Knowledge Base: Covers more than ten scenarios including the entire FPGA development process (RTL coding, timing constraint writing, simulation verification, testbench design, synthesis implementation, and resource optimization).
[0061] (3) VS Code's built-in interface management eliminates the need to switch between multiple interfaces, specifically in the following ways:
[0062] To address the pain point of low efficiency when switching between multiple interfaces, the LjKB plugin has built a built-in management interface based on VS Code WebView technology:
[0063] Interface Integration: The WebView management interface is embedded in the VS Code editor sidebar or panel, including four modules: "Built-in Library Viewing Area", "Personal Library Operation Area", "Document Upload Area", and "Search Engine Trigger Area". Developers can complete the entire process without leaving VS Code.
[0064] Ease of use: Creating a personal library only requires four steps: "Enter name → Select language → Upload document → Configure permissions". Enabling the search engine only requires clicking a button. The operation efficiency is 60% higher than external tools, which is in line with the user habits of developers.
[0065] (4) Open personal knowledge base creation permissions, support multi-format parsing and knowledge sharing. This is reflected in the fact that, in response to personalization and sharing needs, this invention has designed a flexible personal knowledge base management scheme:
[0066] Multi-language compatibility: Supports users to create personal knowledge bases, compatible with 15+ mainstream programming languages such as Java, Python, and JavaScript. Users can upload code snippets (such as project-specific interface functions) and development documents (such as interface design specifications) to meet the needs of different development scenarios.
[0067] Multi-format parsing: Differentiated tools are used to process multi-format documents to ensure that the parsed data is searchable (for specific tool implementation, please refer to the LjKB plugin multi-format parsing module in "Detailed Implementation").
[0068] Permissions and Sharing: Supports configuring "private (accessible only to the user)" and "public (accessible to all users)" permissions, allowing users to share their personal knowledge base with team members and achieve collaborative reuse of knowledge.
[0069] (5) The dual-plugin loosely coupled design supports independent operation and secondary development. Specifically, to address the pain points of architecture coupling and poor scalability, this invention adopts the approach of "functional separation + standardized interface" to achieve loose coupling:
[0070] Functional separation: The LjKB plugin focuses on "knowledge base management" (including viewing built-in libraries, creating personal libraries, parsing multiple formats, and triggering search engines), while the LjCode plugin focuses on "search and result optimization" (including personal library / built-in library search, hybrid search, and result fusion). The core functions of the two are independent of each other and can be used separately (for example, developers can use LjCode only to search built-in libraries or use LjKB only to manage knowledge bases), avoiding resource waste caused by function binding;
[0071] Collaboration mechanism: Signal interaction is implemented only through the window.postMessage / onDidReceiveMessage interface of the VS Code Extension API (corresponding to the communication interface of claim 3) when the personal library search engine is enabled, without deep dependency;
[0072] Secondary development and expansion: Both plugins expose standardized interfaces. LjKB provides a RESTful interface for "knowledge base creation / parsing / activation", and LjCode provides an interface for "search result output / search engine management". Third-party plugins can call these interfaces via HTTP requests (for example, the team's self-developed code review plugin can call the LjKB interface to obtain the project knowledge base), which shortens the secondary development cycle by 50%.
[0073] See Figure 2 This paper illustrates an embodiment of a knowledge base management and retrieval method based on a VS Code dual-plugin, applied to a knowledge base management and retrieval system based on a VS Code dual-plugin. The method includes:
[0074] Step S1: Initialize the Dify platform, deploy the preprocessed built-in knowledge base, and enable the built-in knowledge base retrieval service;
[0075] Step S2: Activate the LjCode plugin and the LjKB plugin. The LjCode plugin and the LjKB plugin automatically connect to the Dify platform via API.
[0076] Step S3: The user creates a personal knowledge base through the LjKB plugin, synchronizes it to the Dify platform, and triggers the activation signal of the target personal knowledge base through the LjKB plugin, and sends the activation signal of the target personal knowledge base to the LjCode plugin.
[0077] Step S4: The LjCode plugin calls the Dify platform interface to verify the validity of the target knowledge base based on the received activation signal of the target personal knowledge base or the retrieval signal of the target built-in knowledge base triggered directly on it. After the verification is passed, the retrieval keywords of the target knowledge base are set. The target knowledge base includes the target personal index library and / or the target built-in knowledge base.
[0078] Step S5: The LjCode plugin converts the search keywords into query vectors, performs a hybrid search strategy on the target knowledge base based on the search keywords and the query vectors, and obtains search results; and obtains code completion results based on the search keywords through AI empowerment of the underlying model.
[0079] In step S6, the LjCode plugin merges the search results and the code completion results and displays them in a sorted manner, so that users can insert the merged results into the VS Code editing area with one click.
[0080] It is understood that the knowledge base management and retrieval method based on VS Code dual plugins provided by the present invention corresponds to the knowledge base management and retrieval system based on VS Code dual plugins provided in the foregoing embodiments. The relevant technical features of the knowledge base management and retrieval method based on VS Code dual plugins can be referred to the relevant technical features of the knowledge base management and retrieval system based on VS Code dual plugins, and will not be repeated here.
[0081] The following describes a specific implementation of the knowledge base management and retrieval system based on the VS Code dual-plugin and the corresponding retrieval method provided by the present invention.
[0082] 1. Implement the environment configuration.
[0083] (1) The hardware environment required for the implementation of this invention is as follows:
[0084] Development terminal: Configured with Intel i7-12700H CPU (or equivalent AMD, domestic Phytium / Kunpeng processor), 32GB DDR5 memory, and 1TB SSD storage to ensure smooth operation of VS Code plugins and built-in WebView interface.
[0085] Enterprise internal server cluster (local deployment scenario): configured with AMD EPYC 7543 CPU×2, 256GB memory, 8TB SSD×4, for deploying the Dify platform and Weaviate vector database (supporting vector retrieval).
[0086] (2) The software environment requirements are as follows:
[0087] Development terminal: Requires VS Code version 1.85.0 or above, Node.js 18.x, TypeScript 5.1.x, and VS Code Extension API 1.85.0.
[0088] Server cluster: Install Docker (for containerized deployment of the Dify platform).
[0089] Interface configuration: The Dify platform provides a RESTful API. LjCode and the LjKB plugin initiate HTTP requests to call this API through the axios library. Signal interaction is implemented based on the VS Code Extension API.
[0090] 2. Implementation details of core modules.
[0091] (1) Core implementation of LjCode plugin:
[0092] Personal database search module:
[0093] a. Signal Listening: Register an event listener in the plugin's activate function to receive the activation signal sent by the LjKB plugin, as shown in the code below:
[0094] #javascriptwindow.addEventListener('message', async (event) => { if(event.data.type === 'enablePersonalKB') { const { userId, kbId, permission}= event.data; const valid = await validateKB(userId, kbId, permission); / / Call the Dify interface to validate if (valid) { const personalEngine = new RetrievalEngine({kbId, type: 'personal'}); retrievalEngines.set(kbId, personalEngine); / / Store the personal database retrieval engine refreshEngineList(); / / Refresh the UI display}}}).
[0095] b. Search Execution: After the user selects the search scope, the " / api / v1 / search" interface of the Dify platform is called, passing in "search keywords, knowledge base ID list, search type (keyword / vector)" to obtain the search results.
[0096] The hybrid retrieval module is implemented as follows:
[0097] a. Keyword Search: Based on the inverted index of the Dify platform, it matches syntax elements such as function names, variable names, and data types in the code to quickly filter relevant results. b. Vector Search: Based on the Weaviate vector database, it converts search keywords into vectors and performs an approximate nearest neighbor query to capture semantically related results. c. Result Merging: After deduplicating the two types of results, it filters them according to similarity scores (0-1 points), retaining only results with a score ≥ 0.7.
[0098] Secondary development interface layer: A lightweight service is built using the Express framework, exposing the following interfaces: GET " / api / retrieval / results" (for retrieving search results) and POST " / api / engine / manage" (for managing the search engine). The interface request header includes a VS Code plugin identifier to ensure security.
[0099] (2) LjKB Plugin Core Implementation:
[0100] VS Code's built-in WebView interface: Developed based on the React framework, it uses VS Code's `window.createWebviewPanel` interface to create a sidebar panel. The panel layout includes the following parts: a) Built-in library viewing area: Displays the scenario coverage of C / C++ and Verilog libraries in a tree structure (e.g., expanding "C / C++ Driver Development" allows viewing SPI / USB / PCIe driver sub-scenarios). Clicking a scenario node allows previewing the corresponding code snippet. b) Personal library operation area: Provides "New" (enter name, select language), "Edit" (modify name / permissions), and "Delete" buttons. The personal library list displays information such as "Name, Language, Permissions, Number of Documents." c) Document upload area: Supports drag-and-drop upload and file selection, displaying upload progress and parsing status (e.g., "PDF parsing in progress," "Parsing complete"). It also provides a file preview function, allowing users to preview before uploading. d) Search engine trigger area: A blue "Enable Search Engine" button is set on the right side of the personal library list. Clicking this button triggers signal sending logic.
[0101] Multi-format document parsing module:
[0102] a) Markdown Parsing: Import the markdown-it@14.0.0 library, configure highlight.js for code block syntax highlighting, extract and store text content and code blocks separately, and preserve the heading hierarchy. b) PDF Parsing: Import the pdfbox-dist@3.0.1 library, extract page text using the PDFTextStripper class, set "setSortByPosition (true)" to ensure correct content order, and treat page breaks as line breaks. c) Word Parsing: Import the apache-poi@5.2.5 library, distinguish between .docx (XWPFDocument class) and .doc (HWPFDocument class) formats, read paragraph and table data, and filter redundant formatting (such as extra spaces and useless styles).
[0103] Search engine trigger module: In the click event of the "Enable Search Engine" button, the " / api / v1 / kb / validate" interface of Dify is first called via API to verify that the personal knowledge base exists and the permissions are valid. After successful verification, a signal is sent via the window.postMessage interface of VS Code. The signal format is as follows:
[0104] #json{ "type": "enablePersonalKB", "userId": "U20240801", "kbId": "KB202408001", "permission": "private"}
[0105] (3) Core implementation of the Dify platform:
[0106] Built-in knowledge base management: Preprocessed C / C++ and Verilog built-in knowledge base data are stored in the Weaviate vector database, and a "kbId+sceneTag" composite index is created to improve retrieval and filtering efficiency; a scheduled task script is developed to fetch newly added underlying code from GitHub open source repositories (such as Linux kernel, fpga-open-source-projects) every month, and update the built-in library after performing "redundancy cleaning-syntax correction-scene annotation".
[0107] Personal knowledge base storage: After receiving standardized data synchronized from the LjKB plugin, it performs "deduplication (based on MD5 checksum) - segmentation (code is segmented by function, and documents are segmented by paragraph) - vector conversion (vectors are generated by calling the embedded model)" processing, and stores "vector data + original data + user ID + permissions" together, supporting filtering of the search scope by permissions (such as "only I can search the private library").
[0108] 3. Demonstration of the complete implementation process.
[0109] S1: Environment Initialization. Start the enterprise's internal server cluster, deploy the Dify platform and Weaviate database, and Dify loads the pre-processed C / C++ and Verilog built-in knowledge bases. Users install the LjCode and LjKB plugins in VS Code. After restarting VS Code, the two plugins are automatically activated and connected to the local Dify platform.
[0110] S2: Knowledge Base Creation and Data Synchronization. Users can open the LjKB plugin WebView interface in the VS Code sidebar to view the "Driver Development" scenario (including SPI / USB driver code) of the C / C++ library and the "FPGA Timing Constraints" scenario of the Verilog library; click "Create Personal Knowledge Base", enter the name "Python Backend Interface Library", select the language "Python", and set the permissions to "Team Visible"; upload the interface design document (including code examples) in Markdown format and the test specification document in PDF format. The LjKB plugin parses the documents through markdown-it and PDFBox, generates standardized data, adds the "Backend Interface + RESTful" tag, and synchronizes it to the Dify platform for storage; the parsing progress and tag information are displayed in real time in the WebView interface.
[0111] S3: Personal database search engine enabled. Users select "Python backend interface library" in the LjKB interface and click the "Enable Search Engine" button. After LjKB calls the Dify interface to verify the knowledge base status, it sends an enable signal to the LjCode plugin. LjCode receives the signal, calls the Dify interface to verify again, and after successful verification, refreshes to obtain the personal database search engine. A new "Personal Database - Python backend interface library" search option is added to the UI.
[0112] S4: Search and Result Reuse. When a user writes Python backend interface code in VS Code, the LjCode search function is triggered. The user selects "Built-in Libraries (C / C++) + Personal Libraries (Python Backend Interface Libraries)" as the search scope and enters the keyword "RESTful interface permission verification". LjCode calls the Dify platform to perform a mixed search and returns the Top 5 results (including C / C++ permission verification logic and Python interface code). LjCode sorts the results by weight (0.6 weight) + code completion results (0.4 weight) and displays them in the VS Code sidebar. The user selects the top-ranked Python interface code result, and the code is automatically inserted into the editing area (with complete comments), which can be directly compiled and run without manually correcting syntax errors.
[0113] To address the technical problems of existing auxiliary programming plugins, such as the lack of personal knowledge base retrieval capabilities, poor adaptability to underlying development scenarios, insufficient plugin extensibility, and low efficiency in switching between multiple interfaces, this invention provides a knowledge base management and retrieval system and method based on two VS Code plugins. This system consists of the LjCode and LjKB plugins independently deployed on the VS Code client, and the Dify platform providing knowledge base storage and underlying model support. Its main advantages include:
[0114] 1. Breaking through the limitations of traditional auxiliary programming plugins that only "complete and correct errors", the LjKB plugin is deployed in the VS Code client and coupled with the LjCode plugin to realize the construction and retrieval of personal knowledge base, and to achieve the integration of personal knowledge base retrieval and integrated development environment (IDE) development.
[0115] 2. The Dify platform incorporates a high-quality vertical knowledge base in C / C++ and Verilog, covering a full range of underlying development scenarios.
[0116] 3. The LjKB plugin is integrated into the VS Code interface, allowing you to manage your knowledge base without switching to external tools.
[0117] 4. Supports the creation and sharing of personal libraries in multiple languages and formats, expanding the range of formats natively supported by Dify.
[0118] 5. The two plug-ins are loosely coupled and can run independently or collaboratively, facilitating secondary development.
[0119] This invention deploys two plugins, LjCode and LjKB, on the VS Code client to jointly manage and retrieve individual and built-in knowledge bases. The LjKB plugin also exposes secondary development interfaces to support collaboration with external plugins. Therefore, it can significantly improve the efficiency of underlying development and the accuracy of retrieval, and is suitable for the needs of private development scenarios.
[0120] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0121] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0122] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0123] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0124] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0125] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0126] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A knowledge base management and retrieval system based on VS Code dual plugins, characterized in that, This includes the LjCode plugin and LjKB plugin, which are independently deployed on the VSCode client, and the Dify platform, which provides underlying support. The LjCode plugin and the LjKB plugin achieve loosely coupled collaboration through the VSCode standardized communication interface. Both the LjCode plugin and the LjKB plugin establish data interaction with the Dify platform through standardized APIs. The Dify platform is used to deploy pre-processed built-in knowledge bases and to provide storage services for personal knowledge bases. The LjKB plugin is used to allow users to create personal knowledge bases on it and synchronize them to the Dify platform, as well as to trigger the activation signal of the target personal knowledge base and send the activation signal of the target personal knowledge base to the LjCode plugin. The LjCode plugin is used to call the Dify platform interface to verify the validity of the target knowledge base based on the received activation signal of the target personal knowledge base or the retrieval signal of the target built-in knowledge base triggered directly on it. After the verification is passed, the retrieval keywords of the target knowledge base are set. The target knowledge base includes the target personal index library and / or the target built-in knowledge base. The system converts the search keywords into query vectors, performs a hybrid search strategy on the target knowledge base based on the search keywords and the query vectors, and obtains search results; it also obtains code completion results by AI empowerment of the underlying model based on the search keywords; and it is used to merge the search results and the code completion results and display them in a sorted manner.
2. The knowledge base management and retrieval system based on VS Code dual plugins according to claim 1, characterized in that, The VS Code standardized communication interface includes the window.postMessage signal sending interface and the onDidReceiveMessage event listening interface in the VS Code Extension API. The signals between the LjCode plugin and the LjKB plugin are transmitted in JSON format, and the transmitted signals include four core fields: signal type, user identifier userId, knowledge base identifier kbId, and permission.
3. The knowledge base management and retrieval system based on VS Code dual plugins according to claim 1, characterized in that, The built-in knowledge base includes built-in knowledge bases for C / C++ and Verilog.
4. The knowledge base management and retrieval system based on VS Code dual plugins according to claim 1, characterized in that, The LjKB plugin loads the WebView management interface. The LjKB plugin allows users to create personal knowledge bases on it and synchronize them to the Dify platform. It also triggers an activation signal for the target personal knowledge base and sends this activation signal to the LjCode plugin, including: Users upload documents in multiple formats through the LjKB plugin. The LjKB plugin parses each document, generates standardized data, and creates a personal knowledge base based on the standardized data. On the WebView management interface, you can configure permissions for your personal knowledge base and add "development scenario + core function" dual-label information to code documents in your personal knowledge base, and then synchronize your personal knowledge base to the Dify platform.
5. The knowledge base management and retrieval system based on VS Code dual plugins according to claim 1, characterized in that, The LjKB plugin has a built-in personal search engine trigger module, which is used to send an activation signal to the LjCode plugin containing "user ID + target personal knowledge base ID + permission information" for the target personal knowledge base.
6. The knowledge base management and retrieval system based on VS Code dual plugins according to claim 1, characterized in that, The LjCode plugin integrates a hybrid search module, which executes a hybrid search strategy on the target knowledge base based on the search keywords and the query vector to obtain search results, including: The hybrid retrieval module performs retrieval in the target knowledge base based on the retrieval keywords and the query vectors respectively. The retrieval of the retrieval keywords is achieved by matching syntax elements through an inverted index to obtain the first retrieval result. The retrieval of the query vectors is performed by performing an approximate nearest neighbor query based on the Weaviate vector database integrated by the Dify platform to obtain the second retrieval result. The first and second search results are rearranged to obtain the search results, and the search results are filtered to retain those with a similarity threshold greater than or equal to a preset threshold.
7. The knowledge base management and retrieval system based on VS Code dual plugins according to claim 1, characterized in that, The process of integrating and sorting the search results and code completion results includes: Set the weight coefficients for the search results and the code completion results respectively; Based on the matching similarity of the search results, the matching similarity of the code completion results, and the corresponding weight coefficients, the matching similarity of the search results and the matching similarity of the code completion results are weighted and fused to obtain the matching similarity of the comprehensive result. Based on the matching similarity of the comprehensive results, the results are displayed in descending order through the WebView interface of the LjKB plugin.
8. The knowledge base management and retrieval system based on VS Code dual plugins according to claim 1, characterized in that, The Dify platform's built-in knowledge base supports regular updates. New code undergoes preprocessing including "redundancy cleaning, syntax correction, and scene annotation," and the updated content is pushed to users through the LjKB plugin's WebView interface.
9. The knowledge base management and retrieval system based on VS Code dual plugins according to claim 1, characterized in that, The Dify platform, the LjCode plugin, and the LjKB plugin all support local deployment on enterprise internal servers. The LjKB plugin exposes RESTful-style secondary development interfaces to support collaboration with external plugins. The personal knowledge base is stored using AES encryption.
10. A knowledge base management and retrieval method based on VS Code dual plugins, applied to the knowledge base management and retrieval system based on VS Code dual plugins as described in claim 1, characterized in that, The method includes: Step 1: Initialize the Dify platform, deploy the pre-processed built-in knowledge base, and enable the built-in knowledge base retrieval service; Step 2: Activate the LjCode plugin and the LjKB plugin. The LjCode plugin and the LjKB plugin will automatically connect to the Dify platform via API. Step 3: The user creates a personal knowledge base through the LjKB plugin, synchronizes it to the Dify platform, and triggers the activation signal of the target personal knowledge base through the LjKB plugin, and sends the activation signal of the target personal knowledge base to the LjCode plugin. Step 4: The LjCode plugin calls the Dify platform interface to verify the validity of the target knowledge base based on the received activation signal of the target personal knowledge base or the retrieval signal of the target built-in knowledge base triggered directly on it. After the verification is passed, the retrieval keywords of the target knowledge base are set. The target knowledge base includes the target personal index library and / or the target built-in knowledge base. Step 5: The LjCode plugin converts the search keywords into query vectors, performs a hybrid search strategy on the target knowledge base based on the search keywords and the query vectors, and obtains search results; and obtains code completion results based on the search keywords through AI empowerment of the underlying model. Step 6: The LjCode plugin merges the search results and the code completion results and displays them in a sorted manner, so that users can insert the merged results into the VS Code editing area with one click.