Local offline auxiliary programming method and system based on VSCode plug-in
By combining a local large language model and RAG knowledge base with the VSCode plugin for offline assisted programming, the issues of privacy leakage and network dependence in cloud services are resolved, achieving secure and efficient local programming assistance.
Patent Information
- Application Number
- CN202511689388.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-13
AI Technical Summary
Existing AI-assisted programming assistants offer services through cloud-based large language models, but they suffer from risks such as code privacy leaks, strong reliance on the network, and an inability to integrate local knowledge bases to program according to user needs.
User requests are obtained through the VSCode plugin, and knowledge retrieval and integration are performed using a local large language model and RAG knowledge base. All steps are completed locally, avoiding the uploading of sensitive information to the cloud.
Ensure the stability and security of programming assistance, avoid the risk of data leakage, meet data privacy requirements, adapt to local hardware resources, and provide an efficient knowledge access experience.
Smart Images

Figure CN121523655A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of computer software, in particular to a local offline auxiliary programming method and system based on a VSCode plug-in. BACKGROUND
[0002] AI-assisted programming refers to the use of artificial intelligence technology to assist developers in completing programming-related work, which can significantly improve development efficiency and reduce the programming threshold, and has become an important trend in the field of software development. However, current AI-assisted programming assistants (GitHub Copilot, TabNine, and Cursor) mainly provide auxiliary programming services through cloud-based large language models, which have the problems of code privacy leakage risk, strong dependence on the network, and inability to combine local knowledge bases to program according to user needs. SUMMARY
[0003] The application provides a local offline auxiliary programming method and system based on a VSCode plug-in, which can solve the problems of code privacy leakage risk, strong dependence on the network, and inability to combine local knowledge bases to program according to user needs when current AI-assisted programming assistants provide auxiliary programming services through cloud-based large language models.
[0004] In a first aspect, the application provides a local offline auxiliary programming method based on a VSCode plug-in, comprising: obtaining a user request through a VSCode auxiliary programming plug-in and sending the user request to a local large language model; determining whether knowledge retrieval processing is needed for the user request through the large language model; if the user request needs to be subjected to knowledge retrieval processing, sending the user request to a local RAG knowledge base through the VSCode auxiliary programming plug-in for knowledge retrieval to obtain a knowledge retrieval result; sending the knowledge retrieval result to the local large language model through the VSCode auxiliary programming plug-in; integrating the knowledge retrieval result and the self-contained language output of the local large language model through the local large language model to obtain integrated output content; displaying the integrated output content on the user interface of the VSCode.
[0005] In some embodiments, before the user request is obtained through the VSCode auxiliary programming plug-in and sent to the local large language model, the method comprises: constructing a local large language model; configuring an interface for the VSCode auxiliary programming plug-in to call the local large language model; constructing a local RAG knowledge base; configuring the VSCode auxiliary programming plug-in to access the MCP service of the local RAG knowledge base.
[0006] In some embodiments, the constructing a local large language model comprises: constructing a local large language model environment server; deploying an ollama to the local large language model environment server; importing a large language model into the ollama environment to obtain the local large language model.
[0007] In some embodiments, the constructing a local large language model environment server further comprises: creating a local Assist assistant and defining a main assistant behavior template assist_config.json.
[0008] In some embodiments, the configuring the VSCode auxiliary programming plug-in to call the interface of the local large language model comprises: port mapping the API interface of the large language model so that the local external device can access the local large language model; configuring the network address and port number of the local large language model API interface called in the VSCode auxiliary programming plug-in.
[0009] In some embodiments, the constructing a local RAG knowledge base comprises: constructing a local RAG knowledge base server; inputting the user's required document into the local RAG knowledge base and performing format preprocessing on the required document to obtain a required format document; using an Embedding model to perform vectorization processing on the required format document and storing to obtain the local RAG knowledge base.
[0010] In some embodiments, the configuring the VSCode auxiliary programming plug-in to access the MCP service of the local RAG knowledge base comprises: configuring a JSON file of the MCP service to initialize the MCP service; providing a request function get_assist_ID() of the MCP service to obtain an assistant ID bound by the local RAG knowledge base through the MCP service; providing a request function get_session_ID() of the MCP service to obtain a session SessionID, so as to create a new session through a session management interface of the MCP service and associate the assistant ID. The MCP service provides a get answer function get_answer() to send the knowledge retrieval result to the local large language model; The MCP service provides an end chat function end_chat() to close the session by sending a DELETE request and release resources.
[0011] In some embodiments, if knowledge retrieval processing is required for the user request, the VSCode auxiliary programming plug-in sends the user request to the local RAG knowledge base for knowledge retrieval, and before obtaining the knowledge retrieval result, the method further includes: Configuring the VSCode auxiliary programming plug-in to set the keyword retrieval order in the mixed query mode; The VSCode auxiliary programming plug-in calls the local large language model to generate context-related and user-visualized interaction code according to user needs.
[0012] In a second aspect, the embodiments of the present application provide a local knowledge base and large language model offline auxiliary programming system based on a VSCode plug-in, which is applied to the local offline auxiliary programming method based on a VSCode plug-in as described in any one of the first aspect, and includes: The VSCode auxiliary programming plug-in is configured to obtain a user request and send the user request to a local large language model; if knowledge retrieval processing is required for the user request, the user request is sent to a local RAG knowledge base for knowledge retrieval; the knowledge retrieval result is sent to the local large language model; and the integrated output content is displayed on the user interface of the VSCode; The local large language model is configured to determine whether knowledge retrieval processing is required for the user request; and integrate the knowledge retrieval result and the language output of the local large language model to obtain integrated output content. The local RAG knowledge base is configured to perform knowledge retrieval processing on the user request to obtain a knowledge retrieval result.
[0013] In a third aspect, the embodiments of the present application provide a computer network, which includes the local offline auxiliary programming system based on a VSCode plug-in as described in any one of the second aspect.
[0014] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art: The local offline auxiliary programming method and system based on the VSCode plug-in provided by the embodiment of the application, through the VSCode auxiliary programming plug-in, a user request is acquired, and the user request is sent to a local large language model; whether the user request needs to be subjected to knowledge retrieval processing is determined through the large language model; if the user request needs to be subjected to knowledge retrieval processing, the user request is sent to a local RAG knowledge base for knowledge retrieval through the VSCode auxiliary programming plug-in, and a knowledge retrieval result is obtained; the knowledge retrieval result is sent to the local large language model through the VSCode auxiliary programming plug-in; the knowledge retrieval result and the self-provided language output of the local large language model are integrated through the local large language model, and integrated output content is obtained; the integrated output content is displayed on the user interface of the VSCode, so that all links (user request processing, model reasoning, knowledge retrieval) are completed locally, without the need to upload sensitive information such as code, project documents, and user questions to the cloud, so as to avoid the risk of data leakage, and the problems that the AI auxiliary programming assistant provides auxiliary programming services through the cloud large language model, the code privacy is leaked, the network is strongly dependent, and the local knowledge base cannot be combined to program according to the user demand. BRIEF DESCRIPTION OF DRAWINGS
[0015] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and serve to explain the principles of the application together with the specification.
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, for those skilled in the field, other drawings can also be obtained based on these drawings without any creative effort.
[0017] One or more embodiments are exemplarily illustrated by pictures in the drawings corresponding thereto, and these exemplary illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, unless otherwise specified. The drawings in the drawings do not constitute a proportional limitation.
[0018] Figure 1 The flowchart of the local offline auxiliary programming method based on the VSCode plug-in provided by an embodiment of the application; Figure 2 The local offline auxiliary programming system structure schematic diagram based on the VSCode plug-in provided by an embodiment of the application. DETAILED DESCRIPTION
[0019] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the scope of protection of the present application.
[0020] The following disclosure provides many different embodiments, or examples, for implementing different structures of the present application. For the purpose of simplifying the present application, the components and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeatedly refer to numbers and / or letters in different examples. Such repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0021] In the field of software development, developers usually rely on scattered online documents, community forums, etc. for code writing, and the information is complex and time-consuming to filter, which greatly reduces the development efficiency. AI-assisted programming refers to using artificial intelligence technology to assist developers in completing programming-related work, which can significantly improve development efficiency and reduce programming threshold, and has become an important trend in the field of software development.
[0022] With the rapid development of large language model (LLM) technology in the field of assisted programming, the current mainstream AI-assisted programming assistants (GitHub Copilot, TabNine, and Cursor, etc.) mainly provide assisted programming services through cloud-based large language models. However, they have some outstanding problems such as code privacy leakage risk, strong dependence on network, and inability to combine local knowledge base for programming according to user needs. Especially in the fields of finance, military and medical care, which have strict requirements for data security, developers urgently need a solution that can retain the advantages of assisted programming while ensuring that code and data run in a local offline environment.
[0023] Currently, open-source large language model technologies are developing rapidly (such as LLaMA, DeepSeek, etc.), making it possible to deploy high-quality auxiliary programming large language models locally. At the same time, retrieval-augmented generation (RAG) technology combines external knowledge bases with large language models, significantly improving the accuracy and professionalism of model-assisted programming. However, in the existing VSCode-based auxiliary programming plugin ecosystem, there is still a gap in combining local large language models and RAG knowledge bases while achieving completely offline auxiliary programming. Most auxiliary programming plugins rely on cloud models for services or only provide basic code completion functions, lacking deep understanding of context and domain knowledge. Existing local knowledge base management tools also fail to meet the needs of developers, as they are mostly single-function and lack deep integration with development environments, unable to provide developers with a convenient knowledge calling experience.
[0024] In a first aspect, as shown in the accompanying drawings, to solve the above technical problems, the embodiments of the present application provide a local offline auxiliary programming method based on a VSCode plugin, comprising: Figure 1 S101: obtaining a user request through a VSCode auxiliary programming plugin and sending the user request to a local large language model; S102: determining whether knowledge retrieval processing is needed for the user request through the large language model; S103: if knowledge retrieval processing is needed for the user request, sending the user request to a local RAG knowledge base through the VSCode auxiliary programming plugin for knowledge retrieval to obtain a knowledge retrieval result; S104: sending the knowledge retrieval result to the local large language model through the VSCode auxiliary programming plugin; S105: integrating the knowledge retrieval result and the self-contained language output of the local large language model through the local large language model to obtain integrated output content; S106: displaying the integrated output content on the user interface of VSCode.
[0025] It should be noted that, due to the limitations of the self-knowledge of the large language model (such as not covering project private logic and old API information), direct output may produce errors (such as fabricating non-existent function usage), the embodiments of the present application pass through the logic of “judging whether it needs to be retrieved, calling local RAG knowledge base, and integrating knowledge results”, so that the answer is based on local authoritative knowledge (such as project internal documents, code specifications, and historical solutions) first, ensuring that the output fits the actual scene; and all links (user request processing, model reasoning, knowledge retrieval, and result display) are completed locally, without the need to upload sensitive information such as code, project documents, and user questions to the cloud, which fundamentally avoids the risk of data leakage, especially in fields such as finance, military, and government, which have very high requirements for data security, can meet the compliance requirements (such as not leaking core business logic and internal code architecture).
[0026] In some embodiments, before the user request is obtained through the VSCode auxiliary programming plug-in and sent to the local large language model, the following steps are included: Building a local large language model; Configuring the interface for the VSCode auxiliary programming plug-in to call the local large language model; Building a local RAG knowledge base; Configuring the MCP service for the VSCode auxiliary programming plug-in to access the local RAG knowledge base.
[0027] It should be noted that by building the local large language model, dependence on cloud large model services can be eliminated, and auxiliary interruption caused by network fluctuations and cloud service shutdown can be avoided, ensuring the stability of programming assistance; the local large language model runs on a local device, and all reasoning processes (such as code generation and requirement analysis) do not involve data upload, eliminating the risk of sensitive information leakage such as core code and project logic, meeting the data privacy requirements (such as enterprise internal projects and classified development scenarios); and a parameterized model can be selected according to local hardware resources, balancing performance and resource consumption, and avoiding “waste of computing power” or “running lag”, wherein by configuring the communication mode of the plug-in and the model, the plug-in can accurately pass the user request (such as “generate login code”), and the model can correctly return the result (such as code snippets + explanation), avoiding “request failure” or “result garbled” caused by interface mismatch.
[0028] It should be noted that by constructing the local RAG knowledge base, project-specific knowledge (such as internal API documents, code specifications, historical bug solutions, and private framework manuals) can be imported into the local knowledge base, so that the model's answers are no longer limited to general training data, but are tailored to the actual scenario of the current project (such as generating code that conforms to the team's coding style); and the knowledge base is stored locally, supporting offline updates (such as adding new project documents or deleting outdated information), ensuring the timeliness of the knowledge (such as incorporating the latest framework version changes in a timely manner); compared to relying on the model's own knowledge, the local RAG knowledge base provides more controllable and traceable information (such as explicitly labeling the knowledge source as "project document v2.1"), reducing the risk of incorrect output caused by "memory bias" of the model.
[0029] It should be noted that the MCP service, as an intermediate layer, can shield the technical differences between plugins and knowledge bases, enabling cross-service communication through a unified protocol (such as HTTP / JSON) to reduce integration complexity; the MCP service can control knowledge base access permissions (such as limiting plugins to only retrieve public documents and not access core confidential modules), further ensuring knowledge security and preventing unauthorized access.
[0030] In some embodiments, the constructing a local large language model comprises: constructing a local large language model environment server; deploying an ollama to the local large language model environment server; importing a large language model into the ollama environment to obtain the local large language model.
[0031] It should be noted that by constructing the local large language model environment server, an independent and isolated running environment can be provided for the large language model, avoiding competition with other applications for hardware resources (CPU, memory, GPU), and ensuring stable and non-lagging model inference processes (such as code generation and semantic understanding); and the local environment is easy for developers to manage independently (such as restarting services, monitoring resource usage, and backing up data), without relying on third-party platforms, reducing the risk of service interruption caused by external environment changes (such as cloud configuration adjustments).
[0032] It should be noted that by deploying ollama (lightweight large language model management tool), a standardized command line interface (CLI) and API can be provided, simplifying operations such as model download, start, stop, version switching, etc., without the need for developers to manually handle complex model deployment details (such as dependency installation, parameter configuration, distributed running); and the import process is simple, developers do not need to understand the underlying format of the model file, reducing the technical threshold, and enabling rapid deployment of usable local large models; large language models run in the ollama environment, and can seamlessly communicate with VSCode plugins, local RAG knowledge bases, and other components through APIs (such as HTTP interfaces), providing standardized capability interfaces for subsequent "plugin calls models" and "model integrates knowledge" processes.
[0033] In some embodiments, the method of building a local large language model environment server further comprises: Creating a local Assist assistant and defining a main assistant behavior template assist_config.json.
[0034] It should be noted that the local Assist assistant can be understood as an interactive agent of the model, and through the Assist assistant, local resources can be associated: such as mapping with local RAG knowledge bases, code repositories, tool chains (such as compilers, debuggers), enabling the model to actively call these resources when answering; context management is handled through session rules in assist_config.json (such as "retain the context of the last 5 rounds of conversation" "ignore repeated questions"), ensuring the coherence of multiple rounds of interaction (such as "based on the login code generated in the last round, continue to generate registration code").
[0035] It should be noted that defining the main assistant behavior template assist_config.json can preset the interaction rules, output format, and role positioning (such as "Python programming assistant" "code debugging expert") of the model, ensuring that the output of the model meets the expectations of the developer for the "programming assistant", avoiding generating chaotic (such as disorganized format) or deviating from the scene (such as excessive colloquialism) content, and improving interaction efficiency.
[0036] In some embodiments, the method of configuring the interface of the VSCode auxiliary programming plug-in to call the local large language model comprises: Port mapping the API interface of the large language model so that the local external device can access the local large language model; Configuring the network address and port number of the local large language model API interface called in the VSCode auxiliary programming plug-in.
[0037] It should be noted that the local large language model is usually only allowed to access locally by default (such as binding localhost: 5000), and through port mapping (such as mapping the local 5000 port to the 5000 port of the local area network IP), cross-device access can be achieved, that is, the VSCode plug-in on other devices (such as the developer's notebook and the team-shared development machine) in the same local area network can also call the local large language model, supporting multi-person collaboration or multi-device switching scenarios (such as deploying the model on a desktop computer, and accessing it through the plug-in on a notebook computer); network environment adaptation, that is, in a complex network environment (such as deploying the model through a virtual machine or a container), port mapping can break through the network isolation limit (such as the bridging of the container internal port and the host computer port), ensuring that the plug-in can access the model in the container through the physical machine IP; security is controllable: compared with directly opening public network access, local port mapping only allows trusted local area network devices to access, which, while expanding availability, avoids the security risks (such as malicious request attacks) brought by exposing the model to the public network.
[0038] It should be noted that explicitly specifying the network address (such as http: / / 192.168.1.10) and port number (such as 5000) of the large language model in the plug-in can set a "unified coordinate" for the communication between the plug-in and the large language model, so that the plug-in does not need to automatically scan or guess the model location, and can directly send a request (such as POST http: / / 192.168.1.10:5000 / generate) through the configured address and port, avoiding "request failure" or "connection timeout" caused by address errors; it can adapt to environmental changes, and when the model deployment location changes (such as from the local machine to the local area network server), only the address in the plug-in configuration needs to be modified (such as from localhost to server IP), without the need to restructure the plug-in code, reducing maintenance costs.
[0039] In some embodiments, the constructing a local RAG knowledge base comprises: constructing a local RAG knowledge base server; inputting a required document of a user into the local RAG knowledge base, and performing format preprocessing on the required document to obtain a required format document; performing vectorization processing on the required format document using an Embedding model and storing the required format document to obtain the local RAG knowledge base.
[0040] It should be noted that by constructing the local RAG knowledge base server, an independent running environment (such as a physical server, a virtual machine or a container) can be provided for the local RAG knowledge base, ensuring that core operations such as knowledge storage, retrieval and management are completed locally, and all documents (such as project code and internal manuals) can be stored locally to avoid sensitive information leakage (such as core algorithm documents and API key descriptions) due to reliance on cloud knowledge bases; server resources (such as CPU, memory and storage) can be configured according to the size and retrieval frequency of the documents to avoid retrieval delays or service crashes; knowledge retrieval services can be provided normally without network environment, adapting to network-free or classified development scenarios (such as closed laboratories and military project development).
[0041] It should be noted that after constructing the local RAG knowledge base server, the Embedding model (or Embedding vectorization model) needs to be imported into the local RAG knowledge base server, and the local document format type needs to be configured; by configuring the local document format type (such as supporting md, pdf, docx, json, py, etc.), the file format that the knowledge base can receive can be clearly defined to avoid document import failures due to format incompatibility (such as rejecting special format files that cannot be parsed); at the same time, exclusive processing logic is preset for different formats (such as preserving code syntax structure for py files and extracting key-value pair information for json files) to ensure more accurate preprocessing.
[0042] It should be noted that the required document is preprocessed in the required format to obtain a required format document, specifically: programming-related knowledge files (such as API documents and design specifications) are stored in docx / PDF format; typical compiler error content (such as {"error": "NullPointerException", "solution": "check object initialization"} ) is stored in JSON structured Q / A question and answer pair form; commonly used code segment source code and comments are stored in Markdown format; after obtaining the required format document, the required format document can be stored in categories to facilitate calling according to the user's problem type and improve calling efficiency.
[0043] In some embodiments, the configuration of the VSCode auxiliary programming plug-in to access the MCP service of the local RAG knowledge base includes: configuring a JSON file of the MCP service to initialize the MCP service; providing a request function get_assist_ID() of the MCP service to obtain AssistID, so as to obtain the assistant ID bound by the local RAG knowledge base through the MCP service; A request function get_session_ID() of the MCP service is provided to obtain a SessionID, to create a new session by calling the session management interface of the MCP service, and to associate the assistant ID; An get_answer() function of the MCP service is provided to send the knowledge retrieval result to the local large language model; An end_chat() function of the MCP service is provided to close the session and release resources by sending a DELETE request.
[0044] It should be noted that the JSON file of the MCP service is configured, that is, the start parameters of the MCP service and the connection configuration of the RAG knowledge base are defined in the VSCode workspace.vscode / mcp.json. The JSON file (or JSON configuration file) defines the basic parameters (such as service address, port, timeout) of the MCP service and the connection rules (such as knowledge base IP, retrieval timeout threshold) with the local RAG knowledge base. The parameters can be automatically loaded by reading the configuration file when the MCP service starts, avoiding errors caused by manual input of parameters (such as spelling errors of IP addresses, port conflicts), ensuring that the service starts quickly and connects to the knowledge base correctly; when the local RAG knowledge base deployment location changes (such as from local to LAN server), only the rag_host and other parameters in the configuration file need to be modified, without the need to restructure the MCP service code, reducing maintenance costs.
[0045] It should be noted that the assistant ID bound to the current RAG knowledge base can be obtained from the MCP service through an HTTP POST request. The assistant ID can be the unique identifier of the "knowledge partition + retrieval strategy" in the local RAG knowledge base. After obtaining the assistant ID through this function, the knowledge range can be locked, that is, the MCP service only retrieves the knowledge partition bound to the assistant ID (such as "front-end project assistant" does not retrieve back-end Java documents), avoiding irrelevant knowledge interference and improving retrieval efficiency; unified retrieval strategy can be achieved, that is, different assistant IDs are associated with different retrieval rules (such as "debugging assistant" prioritizes matching error solutions, and "document assistant" prioritizes matching API manuals), ensuring that the returned results fit the user scenario (such as debugging to prioritize error repair methods).
[0046] It should be noted that the SessionID is the unique identifier of the current user conversation, and the context association can be achieved after creating a session by associating the assistant ID, that is, the MCP service records the user's historical queries and the knowledge fragments returned by the knowledge base through SessionID, ensuring the coherence of retrieval logic in multiple interactions (such as "the last round asked about the login interface, and this round asked about the registration interface", automatically associate the same set of user model documents); it can realize independent management of resources, that is, each Session ID corresponds to independent memory cache and retrieval context, avoiding interference between multiple users / multiple conversations (such as A user's Python query will not mix into B user's Java retrieval result); it can make the session state controllable, that is, the session state (such as "active" "timeout") can be tracked through Session ID, which facilitates subsequent precise release of resources through end_chat(), avoiding memory leakage.
[0047] It should be noted that the get_answer() function provides the core function entry of the MCP service, which is responsible for converting user queries into knowledge base retrieval requests, and then passing the retrieval results to the local large language model, so that the plug-in does not need to handle the complex logic of "retrieval-result transmission-model call", and only needs to call get_answer() to obtain the integrated result, reducing the complexity of plug-in development; it can ensure that the large language model must combine the retrieval results of the local RAG knowledge base (such as project internal code specifications) when generating answers, avoiding "hallucinations" caused by relying only on model self-knowledge (such as fabricating non-existent function usage).
[0048] It should be noted that the DELETE request can close the session and release resources (such as cached context, knowledge base connection), which can realize efficient resource recycling, that is, timely release of unused memory, network connection and other resources, avoiding performance degradation of local servers caused by long-term operation (especially important for offline environments with limited hardware resources); it can maintain state consistency, that is, mark the session as "closed" to prevent plug-in misoperation from calling expired Session ID (such as sending requests after the user has ended the conversation), reducing errors; it can balance the service load, that is, by actively closing the session, it ensures that the number of concurrent sessions of the MCP service is controlled within the configured threshold (such as no more than 10), avoiding resource exhaustion that prevents new sessions from being created.
[0049] In some embodiments, if knowledge retrieval processing is required for the user request, the VSCode auxiliary programming plug-in sends the user request to the local RAG knowledge base for knowledge retrieval, and before obtaining the knowledge retrieval result, it further includes: Configure the mixed query mode of the VSCode auxiliary programming plug-in, set the keyword retrieval order; The local large language model is called by the VSCode assisted programming plug-in to perform context association and user visual interaction code generation according to user requirements.
[0050] It should be noted that the priority of the key information in the user input is defined by setting the keyword retrieval order, which can solve the problem of multiple requirement conflicts or redundancy: that is, when there is a contradiction in the user input, the high-weight keywords are satisfied in priority, incompatible knowledge is automatically filtered during retrieval, and conflicts are prompted; ensure that the retrieval resource matches the user's most concerned constraints (such as the current language used by the project) first, avoid returning a large amount of low-priority information (such as unrelated framework implementations) from the knowledge base, and improve retrieval efficiency.
[0051] It should be noted that by calling the local large language model to record user historical interactions (such as "the last round generated parameter verification logic for the login interface"), retrieval coherence can be achieved, that is, when the user's new requirement is "improve the exception handling of the login interface", the plug-in will associate historical information to let the local RAG knowledge base preferentially retrieve exception handling documents related to "login interface parameter verification", and ensure that the retrieval result is consistent with the context logic; generation coherence can be achieved, that is, when generating subsequent code, automatically reuse historical definitions of variables and functions (such as reusing the User data model of the login interface), avoid duplication of effort, and unify the code style.
[0052] In a second aspect, as Figure 2 The embodiment of the application provides a local knowledge base and large language model offline assisted programming system based on a VSCode plug-in, which is applied to the local offline assisted programming method based on the VSCode plug-in and comprises the following steps: The VSCode assisted programming plug-in is used for acquiring a user request and sending the user request to a local large language model; if knowledge retrieval processing is needed for the user request, the user request is sent to a local RAG knowledge base for knowledge retrieval; the knowledge retrieval result is sent to the local large language model; and the integrated output content is displayed on a user interface of the VSCode; The local large language model is used for judging whether knowledge retrieval processing is needed for the user request; and integrating the knowledge retrieval result and the language output of the local large language model to obtain integrated output content. The local RAG knowledge base is used for performing knowledge retrieval processing on the user request to obtain a knowledge retrieval result.
[0053] In a third aspect, the embodiment of the application provides a computer network comprising the local offline assisted programming system based on the VSCode plug-in.
[0054] The apparatus / system embodiments described above are merely illustrative, where the units described as separate units can or can not be physically separate, and the units displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.
[0055] Through the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be implemented by means of software plus a general hardware platform, and of course can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in terms of related art, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0056] It should be understood that the terms used herein are for the purpose of describing particular example embodiments only and are not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises", "comprising", "includes", "including" and "has" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order in which they are described, unless specifically identified as an order dependent step. It is also to be understood that additional or alternative steps can be employed. The above description is that of current embodiments of the application. Various alterations and changes can be made without departing from the spirit and scope of the application. It therefore is intended that the application be covered by all of the alternatives, modifications and equivalents falling within the scope of the described embodiments and the general principles defining the application.
Claims
1. A local offline assisted programming method based on a VSCode plugin, characterized in that, include: The user request is obtained through the VSCode auxiliary programming plugin, and the user request is sent to the local large language model; The large language model is used to determine whether knowledge retrieval processing is required for the user request. If knowledge retrieval processing is required for the user request, the user request is sent to the local RAG knowledge base for knowledge retrieval through the VSCode auxiliary programming plugin to obtain the knowledge retrieval results; The knowledge retrieval results are sent to the local large language model via the VSCode auxiliary programming plugin. The integrated output content is obtained by integrating the knowledge retrieval results and the built-in language output of the local large language model. The integrated output content is displayed on the VSCode user interface.
2. The local offline assisted programming method based on the VSCode plugin according to claim 1, characterized in that, The step of obtaining the user request through the VSCode assisted programming plugin and sending the user request to the local large language model includes: Build a local large language model; Configure the VSCode auxiliary programming plugin to call the interface of the local large language model; Build a local RAG knowledge base; Configure the VSCode auxiliary programming plugin to access the MCP service of the local RAG knowledge base.
3. The local offline assisted programming method based on the VSCode plugin according to claim 2, characterized in that, The construction of the local large language model includes: Build a local large language model environment server; Deploy Ollama to the local large language model environment server; The large language model is imported into the ollama environment to obtain the local large language model.
4. The local offline assisted programming method based on the VSCode plugin according to claim 3, characterized in that, The server for building a local large language model environment also includes: Create a local Assist assistant and define the main assistant behavior template in assistant_config.json.
5. The local offline assisted programming method based on the VSCode plugin according to claim 2, characterized in that, The configuration of the VSCode auxiliary programming plugin to call the interface of the local large language model includes: Port mapping is performed on the API interface of the large language model so that local external devices can access the local large language model; Configure the network address and port number for calling the local large language model API interface in the VSCode auxiliary programming plugin.
6. The local offline assisted programming method based on the VSCode plugin according to claim 2, characterized in that, The construction of the local RAG knowledge base includes: Build a local RAG knowledge base server; The user's required document is input into the local RAG knowledge base, and the required document is preprocessed to obtain the required format document; The required format documents are vectorized and stored using the Embedding model to obtain the local RAG knowledge base.
7. The local offline assisted programming method based on the VSCode plugin according to claim 2, characterized in that, The configuration of the VSCode auxiliary programming plugin to access the MCP service of the local RAG knowledge base includes: Configure the JSON file for the MCP service to initialize the MCP service; Provide the get_assist_ID() request function of the MCP service to obtain the assistant ID bound to the local RAG knowledge base through the MCP service; Provide the get_session_ID() request function of the MCP service to obtain the Session ID, so as to create a new session by calling the session management interface of the MCP service and associate it with the assistant ID; Provide the get_answer() function of the MCP service to obtain the dialogue results, so as to send the knowledge retrieval results to the local large language model; The MCP service provides a close chat function end_chat() to close the session and release resources by sending a DELETE request.
8. The local offline assisted programming method based on the VSCode plugin according to claim 1, characterized in that, If knowledge retrieval processing is required for the user request, the VSCode auxiliary programming plugin is used to send the user request to the local RAG knowledge base for knowledge retrieval. Before obtaining the knowledge retrieval results, the process further includes: Configure the mixed query mode of the VSCode auxiliary programming plugin and set the keyword search order; The VSCode auxiliary programming plugin calls the local large language model to perform context association and generate user-visual interactive code according to user needs.
9. A local knowledge base and large language model-based offline assisted programming system based on a VSCode plugin, characterized in that, The local offline assisted programming method based on the VSCode plugin, as described in any one of claims 1-8, includes: This VSCode auxiliary programming plugin is used to obtain user requests and send them to the local large language model; if knowledge retrieval processing is required for the user request, it sends the user request to the local RAG knowledge base for knowledge retrieval; the knowledge retrieval results are sent to the local large language model; and the integrated output is displayed on the VSCode user interface. A local large language model is used to determine whether knowledge retrieval processing is needed for the user request; the knowledge retrieval results and the built-in language output of the local large language model are integrated to obtain integrated output content; A local RAG knowledge base is used to perform knowledge retrieval processing on the user request and obtain knowledge retrieval results.
10. A computer network, characterized in that, This includes the local offline assisted programming system based on the VSCode plugin as described in claim 9.