Programming assistant framework, programming assisting method, equipment, medium and product
By introducing DevOps platform integration module, code completion and dialogue function module and RAG search enhancement generation module into the programming assistant framework, the problem of insufficient integration capabilities of existing AI programming assistants and CI/CD and DevOps toolchains is solved, and the full implementation is achieved The deep collaboration and intelligent code completion of the life cycle have improved development efficiency.
Patent Information
- Application Number
- CN202411430709.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-02-14
AI Technical Summary
The existing AI programming assistants are insufficient in their integration capabilities with CI/CD and DevOps toolchains, and cannot deeply collaborate in the full life cycle nodes of development, testing, and deployment, resulting in developers being unable to make full use of the intelligent capabilities of AI assistants. Improve efficiency.
A programming assistant framework is proposed, including DevOps platform integration module, code completion and dialogue function module, and RAG search enhancement generation module. The DevOps platform integration module receives input information, code completion and dialogue function modules perform code analysis and suggestions generation, and RAG search enhancement generation module performs semantic recognition and search, realizing in-depth integration of code completion and dialogue functions.
It realizes the automation and seamless connection of the development process, reduces manual intervention, improves response speed, improves the accuracy of code completion, and enables the programming assistant to have the ability to intelligent Q&A and complex code interpretation, thereby further improving the work of developers. efficiency.
Smart Images

Figure CN119440491A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a programming assistant framework, programming assistance methods, devices, media and products. Background Art
[0002] With the rapid development of artificial intelligence technology, AI (Artificial Intelligence) programming assistants have been widely used in the field of software development. These tools are designed to improve the work efficiency of developers and reduce repetitive work in the development process through functions such as intelligent completion, code suggestions, and automated test generation. Although AI programming assistants have greatly improved programming efficiency, there are still some shortcomings in existing technologies. For example, although some AI programming assistants can be integrated with mainstream IDE tools (such as VSCode and JetBrains series), they are not integrated with CI / CD (Continuous Integration / Continuous Delivery / Deployment) and DevOps (Development & Operations) tool chains. The inability to perform deep collaboration in the entire life cycle nodes of development, testing, and deployment makes it impossible for developers to fully utilize the intelligent capabilities of AI assistants to improve efficiency when performing automated processes. Summary of the invention
[0003] The main purpose of this application is to provide a programming assistance method, device, equipment, medium and product, aiming to solve the technical problem of low overall development efficiency in the development process.
[0004] To achieve the above objectives, the present application proposes a programming assistant framework, which includes:
[0005] The DevOps platform integration module is used to receive input information sent by any link node in each link node of code development and maintenance, and when it is determined that code completion and dialogue operations need to be performed based on the input information, the input information is sent to the code completion and dialogue function module;
[0006] The code completion and dialogue function module is used to obtain code-related issues in the input information, read the source code matching the code-related issues in the preset project code library, and perform abstract syntax tree analysis on the source code to obtain the abstract syntax tree;
[0007] The RAG retrieval enhancement generation module is used to perform semantic recognition on code-related issues, obtain user intent, traverse the abstract syntax tree according to the user intent, determine the code context information, perform retrieval according to the user intent and the code context information, obtain retrieval information, generate code suggestions based on the retrieval information, and output the code suggestions.
[0008] In one embodiment, the programming assistant framework further includes a prompt word library module.
[0009] A prompt word library module, used to determine a matching prompt word in a preset prompt word library that matches the input information, the link node for sending the input information, and the source code;
[0010] The code completion and dialogue function module is used to output matching prompt words, determine the matching prompt words selected by the developer as target prompt words, parse the code-related issues contained in the target prompt words, and use the parsed code-related issues as the code-related issues in the input information, and read the source code matching the code-related issues in the preset project code library, wherein the matching prompt words come from the prompt word library.
[0011] In one embodiment, the programming assistant framework further includes an API forwarding library module:
[0012] The DevOps platform integration module receives input information sent by any link node through the API forwarding library module.
[0013] RAG retrieves the augmented generation module and outputs code suggestions through the API forwarding library module.
[0014] In one embodiment, applied to the programming assistant framework as claimed in any one of claims 1 to 3, the programming assistance method includes:
[0015] In each link node of code development and maintenance, if the DevOps platform integration module receives input information sent by any link node, and determines that code completion and dialogue operations are required based on the input information, it obtains code-related issues in the input information;
[0016] Read source code matching the code-related problem in the preset project code library, perform abstract syntax tree analysis on the source code, and obtain an abstract syntax tree;
[0017] Perform semantic recognition on code-related issues to obtain user intent, traverse the abstract syntax tree based on user intent, determine code context information, perform retrieval based on user intent and code context information to obtain retrieval information, generate code suggestions based on the retrieval information, and output code suggestions.
[0018] In one embodiment, the step of obtaining code-related questions in the input information is:
[0019] Determine a matching prompt word that matches the input information, the link node receiving the input information, and the source code, output the matching prompt word, and determine the matching prompt word selected by the developer as the target prompt word, wherein the matching prompt word comes from a prompt word library;
[0020] Parse the code-related issues contained in the target prompt word, use the parsed code-related issues as the code-related issues in the input information, and read source code matching the code-related issues in a preset project code library.
[0021] In one embodiment, after the step of parsing the source code to obtain the abstract syntax tree, the following steps are included:
[0022] Check if there is any update to the source code;
[0023] If there is an update, determine the change position in the updated source code, and update the change node corresponding to the change position in the abstract syntax tree to obtain an updated abstract syntax tree;
[0024] The steps to traverse the abstract syntax tree according to the user's intention include:
[0025] Traverse the updated abstract syntax tree based on user intent.
[0026] In one embodiment, the step of performing a search based on the user's intention and the code context information to obtain the search information includes:
[0027] Retrieve information related to user intent and code context information in the project code base within the programming assistant framework;
[0028] When retrieval information related to the user intention and the code context information cannot be found in the project code base, retrieval information related to the user intention and the code context information is retrieved through a preset external knowledge base.
[0029] In addition, to achieve the above objectives, the present application also proposes a programming assistant device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the programming assistance method as described above.
[0030] In addition, to achieve the above-mentioned purpose, the present application also proposes a medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the programming assistance method as described above are implemented.
[0031] In addition, to achieve the above-mentioned purpose, the present application also provides a product, which is a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the programming assistance method as described above are implemented.
[0032] One or more technical solutions proposed in this application have at least the following technical effects:
[0033] The present application provides a programming assistant framework, including a DevOps platform integration module, a code completion and dialogue function module and a RAG retrieval enhancement generation module. The DevOps platform integration module is used to receive input information sent by any link node in each link node for code development and maintenance, and when it is determined that code completion and dialogue operations need to be performed based on the input information, the input information is sent to the code completion and dialogue function module, which realizes the automation and seamless connection of the development process, reduces manual intervention, and improves the response speed. The code completion and dialogue function module is used to obtain code-related issues in the input information, read the source code matching the code-related issues in the preset project code library, perform abstract syntax tree analysis on the source code, and obtain an abstract syntax tree. By deeply parsing the code structure, it can more accurately and deeply analyze the structure and dependencies of the code, not only limited to the current file, but also across files for code analysis and completion. This parsing capability makes code completion more accurate, especially in large projects, it can effectively understand the dependencies between code modules and generate more reasonable completion suggestions. The RAG retrieval enhancement generation module is used to perform semantic recognition on code-related issues, obtain user intent, traverse the abstract syntax tree according to user intent, determine code context information, perform retrieval according to user intent and code context information, obtain retrieval information, generate code suggestions based on the retrieval information, and output code suggestions. This technology not only improves the accuracy of code completion, but also enables programming assistants to have the ability of intelligent question and answer and complex code interpretation, thereby further improving the work efficiency of developers. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0036] Figure 1 This is a framework diagram of the first embodiment of the programming assistant framework of this application;
[0037] Figure 2 This is another framework diagram of the first embodiment of the programming assistant framework of this application;
[0038] Figure 3 This is the overall architecture diagram of the programming assistant framework for this application;
[0039] Figure 4 This is a flowchart of Embodiment 2 of the programming assistance method of this application;
[0040] Figure 5 Devops integrated scene graph for this application programming assistance method;
[0041] Figure 6 A flowchart of the specific problem handling method of the programming assistance method for this application;
[0042] Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the programming assistance method in the embodiment of the present application.
[0043] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0045] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0046] Due to some limitations of current AI programming assistants, they usually perform completion and suggestions based on the code context of the current file, and lack the ability to deeply analyze project-level and cross-file dependencies. This means that in large projects, the accuracy of code completion and error detection will be significantly reduced, and it cannot effectively support complex project management and maintenance needs. Moreover, they often rely on the system's built-in prompt words and code libraries, and cannot be flexibly adjusted or optimized according to the actual needs of users. This has led to its application in specific vertical fields (such as finance, medical care, etc.) being limited, and unable to meet the customized requirements of developers in different fields for prompt words and functions. In addition, although some AI programming assistants can be integrated with mainstream IDE tools, they are insufficient in their integration capabilities with CI / CD and DevOps tool chains. The inability to perform deep collaboration in the full life cycle nodes of development, testing, and deployment makes it impossible for developers to fully utilize the intelligent capabilities of AI assistants when performing automated processes.
[0047] The programming assistance method provided in this embodiment solves the shortcomings of existing AI programming assistants in terms of multi-language support, cross-file code completion, custom prompt word management, and integration with development tool chains.
[0048] This embodiment, by building an open prompt word library management system, allows users to customize prompt words according to different roles, scenarios and languages, and has built-in prompt word templates that adapt to multiple programming languages and frameworks, solving the problem of insufficient support of existing technologies in vertical fields. In addition, this embodiment can automatically manage fixed prompt words to meet the coding task requirements in different fields. In order to improve the accuracy of code completion, this embodiment introduces Abstract Syntax Tree (AST) and Retrieval Augmented Generation (RAG) technology to support cross-file and project-level intelligent code completion and dialogue functions. By using AST, this embodiment can deeply parse the structure and dependencies of the code, not only limited to the current file, but also perform code analysis and completion across files. This parsing ability makes code completion more accurate, especially in large projects, it can effectively understand the dependencies between code modules and generate more reasonable completion suggestions. In addition, combined with the retrieval enhancement generation technology, this embodiment can use the project code library or external knowledge base for retrieval, extract relevant information from the project code library and external knowledge base through semantic understanding, and then generate code completion or dialogue suggestions adapted to the current context. This technology not only improves the accuracy of code completion, but also enables the programming assistant to have the ability of intelligent question and answer and complex code interpretation, thereby further improving the work efficiency of developers. Through the combination of AST and retrieval enhancement generation technology, this embodiment greatly enhances the intelligence level of code completion and dialogue functions, especially when dealing with cross-project, cross-file dependencies and complex code logic, it can provide more in-depth support. In terms of integration, this embodiment supports full life cycle node integration with the DevOps platform. Users can define WebHook (an API concept, one of the usage paradigms of microservice API) tasks to seamlessly connect the programming assistant with the DevOps tool chain, automatically handle tasks in development, testing, deployment and other links, and realize intelligent workflows from coding to publishing. In addition, this embodiment decouples the front-end UI (User Interface) interaction logic and the back-end interface proxy logic, so that the programming assistant can quickly adapt to different IDE (Integrated Development Environment) plug-ins, and run background services through independent processes, supporting background operations at the level of personal workspaces, thereby improving the flexibility and scalability of the system. Through these improvements, this embodiment can not only effectively improve the work efficiency of developers, but also solve the limitations of existing AI programming assistants in multi-scenario applications, and provide a more intelligent and flexible programming assistant framework.
[0049] Based on this, this embodiment provides a programming assistant framework, referring to Figure 1 , Figure 1 This is a framework diagram of the first embodiment of the programming assistant framework of the present application. The programming assistant framework includes:
[0050] The DevOps platform integration module 10 is used to receive input information sent by any link node in each link node of code development and maintenance, and when it is determined that code completion and dialogue operations need to be performed according to the input information, the input information is sent to the code completion and dialogue function module;
[0051] The code completion and dialogue function module 20 is used to obtain code-related problems in the input information, read source code matching the code-related problems in a preset project code library, perform abstract syntax tree analysis on the source code, and obtain an abstract syntax tree;
[0052] The RAG retrieval enhancement generation module 30 is used to perform semantic recognition on code-related issues, obtain user intent, traverse the abstract syntax tree according to the user intent, determine the code context information, perform retrieval according to the user intent and the code context information, obtain retrieval information, generate code suggestions according to the retrieval information, and output the code suggestions.
[0053] The DevOps platform integration module can be a module responsible for integrating and managing various links in the DevOps process (such as code development, testing, deployment, etc.), which can receive input information from these link nodes and trigger corresponding processing flows based on this information.
[0054] The code completion and dialogue function module can be a module specifically for handling code-related issues, which can parse code questions in input information, retrieve relevant code from a preset project code library, and conduct in-depth analysis to assist users in solving code problems or provide code completion suggestions.
[0055] An abstract syntax tree (AST) can be a tree-like data structure in computer science that represents the grammatical structure of source code, but does not include any actual execution information in the code, such as variable values. It helps programmers understand and analyze the structure of the code.
[0056] The RAG retrieval-enhanced generation module combines retrieval and generation techniques to handle code-related issues more intelligently. It first identifies the intent of the user's question, then retrieves relevant information in the code base, and finally generates code suggestions based on this information.
[0057] When there is a demand at any node in the code development, testing, maintenance and other links (such as encountering code writing obstacles, requiring code review opinions, etc.), these requirements are sent to the DevOps platform integration module as input information. The DevOps platform integration module analyzes these input information to determine whether the code completion and dialogue function needs to be started. If necessary, the relevant information is forwarded to the code completion and dialogue function module. After receiving the input information, the code completion and dialogue function module first identifies and extracts the code-related issues. Then, it searches for source code matching these issues in the preset project code base. This is usually achieved through keyword matching, regular expressions or other text retrieval technologies. For the source code found, the module will perform abstract syntax tree (AST) parsing. This step involves converting the source code into a tree structure to analyze the syntax and structure of the code in more detail. The RAG retrieval enhancement generation module first uses natural language processing technology to semantically identify code-related issues to understand the user's true intention. Then, it traverses the abstract syntax tree provided by the code completion and dialogue function module according to the user's intention to determine the context information of the code. This helps to more accurately understand the problem and the required solution. Based on user intent and code context information, the RAG retrieval enhancement generation module searches the code base to find possible solutions or related code snippets, generates code suggestions based on the retrieved information, and outputs them to the user. These suggestions may include directly usable code snippets, modification suggestions, or detailed answers to questions.
[0058] The present embodiment provides a programming assistant framework, including a DevOps platform integration module, a code completion and dialogue function module and a RAG retrieval enhancement generation module, which significantly improves the efficiency and code quality in the software development process. The DevOps platform integration module is used to receive input information sent by any link node in each link node for code development and maintenance, and when it is determined that code completion and dialogue operations need to be performed according to the input information, the input information is sent to the code completion and dialogue function module, which realizes the automation and seamless connection of the development process, reduces manual intervention, and improves the response speed. The code completion and dialogue function module is used to obtain code-related issues in the input information, read the source code matching the code-related issues in the preset project code library, perform abstract syntax tree analysis on the source code, and obtain an abstract syntax tree. By deeply parsing the code structure, the structure and dependency of the code can be more accurately and deeply analyzed, not only limited to the current file, but also across files for code analysis and completion. This parsing capability makes code completion more accurate, especially in large projects, it can effectively understand the dependency between code modules and generate more reasonable completion suggestions. The RAG retrieval enhancement generation module is used to perform semantic recognition on code-related issues, obtain user intent, traverse the abstract syntax tree according to user intent, determine code context information, perform retrieval according to user intent and code context information, obtain retrieval information, generate code suggestions based on the retrieval information, and output code suggestions. This technology not only improves the accuracy of code completion, but also enables programming assistants to have the ability of intelligent question and answer and complex code interpretation, thereby further improving the work efficiency of developers.
[0059] In one possible embodiment, referring to Figure 2 , Figure 2 This is another framework diagram of the first embodiment of the programming assistant framework of the present application. The programming assistant framework also includes a prompt word library module 40.
[0060] A prompt word library module, used to determine a matching prompt word in a preset prompt word library that matches the input information, the link node for sending the input information, and the source code;
[0061] The code completion and dialogue function module is used to output matching prompt words, determine the matching prompt words selected by the developer as target prompt words, parse the code-related issues contained in the target prompt words, and use the parsed code-related issues as the code-related issues in the input information, and read the source code matching the code-related issues in the preset project code library, wherein the matching prompt words come from the prompt word library.
[0062] The prompt word library module can be a component dedicated to storing and managing prompt words. Prompt words are divided into two categories: one is customized by developers according to specific project requirements or coding habits; the other is imported from the outside, which may include industry-wide prompt words, project history or other sources. These prompt words are intended to assist functions such as code completion, smart prompts or question and answer. Furthermore, the prompt word library module can export prompt words into files or data formats so that they can be used in other systems or backup prompt word library data.
[0063] The code completion and dialogue function module is responsible for processing input information from users or development environments, and outputs the prompt words that best match the current context (including input information, the link nodes that receive input information, and the source code currently being processed) through intelligent analysis. Users can select one of these matching prompt words as a target prompt word, and the module then analyzes the code-related issues contained in the target prompt word, and based on these issues, searches for relevant source code snippets in the preset project code library.
[0064] According to project requirements, developers can customize new prompt words through the user interface or API interface of the prompt word library module. These prompt words can be code snippets, function names, variable names, etc., which are used to improve the accuracy of code completion and intelligent prompts. At the same time, the system supports importing existing prompt words from external files, databases or other systems to expand the coverage of the prompt word library. All prompt words are stored in the prompt word library module for subsequent quick retrieval and use. When the user writes code in the code editor or IDE, the system captures the user's input information (such as typed characters, selected menu items, etc.). After receiving this information, the code completion and dialogue function module combines the current link node (such as code editing, code review, etc.) and the source code content being processed to initiate a query request to the prompt word library module. The prompt word library module selects a list of matching prompt words based on the request conditions (including input information, link nodes and source code) through efficient retrieval algorithms (such as fuzzy matching, keyword indexing, etc.). The user selects one or more matching prompt words from the list as target prompt words. The module then parses these target prompt words and extracts the code-related issues contained therein (such as specific function usage, variable meaning, etc.). The module then uses these questions as query criteria to perform a more refined search in the preset project code base to find source code snippets or documents related to the questions.
[0065] This embodiment builds an open prompt word library management system to allow users to customize prompt words according to different roles, scenarios and languages, and has built-in prompt word templates that are compatible with multiple programming languages and frameworks, solving the problem of insufficient support in vertical fields in the existing technology. In addition, this embodiment can automatically manage fixed prompt words to meet the coding task requirements in different fields.
[0066] In one possible embodiment, referring to Figure 2 , Figure 2 It is another framework diagram of the first embodiment of the programming assistant framework of the present application. The programming assistant framework also includes an API forwarding library module 50:
[0067] The DevOps platform integration module receives input information sent by any link node through the API forwarding library module.
[0068] RAG retrieves the augmented generation module and outputs code suggestions through the API forwarding library module.
[0069] As a middleware, the API forwarding library module is responsible for receiving input information from different platforms, such as input information from different nodes in the DevOps process, and forwarding this information to the corresponding processing module. It uses API (application programming interface) as a communication bridge to ensure efficient and secure transmission of information between different systems or modules.
[0070] In this embodiment, the DevOps platform integration module is the core of the entire process, which coordinates the flow of information between different links and nodes. When any link node (such as the development environment, test environment, or operation and maintenance environment) generates input information that needs to be processed, this information is first sent to the API forwarding library module. As an information distribution center, the API forwarding library module receives input information from different nodes and forwards this information to the corresponding processing module according to preset rules or configurations. It identifies information that requires the intervention of the RAG retrieval enhancement generation module and forwards it to the module. Not only the DevOps platform, the system can be installed in any platform or compiler as a plug-in.
[0071] After receiving the information, the RAG retrieval enhancement generation module starts its internal retrieval and analysis mechanism. Based on these analyses, the module can generate code suggestions or solutions for the current problem. These suggestions may be specific code snippets, repair steps, or optimization suggestions, etc., designed to help users quickly solve problems or improve code quality. Finally, the RAG retrieval enhancement generation module returns the generated code suggestions to the original request node or the designated recipient through the API forwarding library module. In this way, the entire process completes a closed loop from problem discovery to solution provision, effectively improving the problem-solving efficiency and code quality in the DevOps process.
[0072] This embodiment decouples the front-end UI interaction logic and the back-end interface proxy logic, so that the programming assistant can quickly adapt to different IDE plug-ins, run background services through independent processes, support background jobs at the personal workspace level, thereby improving the flexibility and scalability of the system.
[0073] For example, refer to Figure 3 , Figure 3 It is the overall architecture diagram of this application. When the developer uses the integrated development environment plug-in (this plug-in is the interface for the programming assistant to interact directly with the developer) in the client to initiate intelligent code completion or dialogue requests, the integrated development environment plug-in communicates with the development and operation platform through the development and operation (DevOps) platform network callback (WebHook) mechanism. After the development and operation platform network callback receives the request from the integrated development environment (IDE) plug-in, it triggers the backend service. The backend service is the core part of processing intelligent code completion and dialogue requests. The backend service forwards the request to the interface forwarding service. As an agent of the backend service, the interface forwarding service is responsible for encapsulating complex backend functions into atomic interfaces to facilitate integrated calls of different development tools. At the back end of the interface forwarding service, the core module starts to process requests. The core modules include an abstract syntax tree (AST) parsing service and a retrieval enhancement generation (RAG) retrieval service. By introducing abstract syntax tree technology, the structure and dependencies of the code are parsed to support cross-file code completion. The abstract syntax tree helps the system accurately understand the connection between code snippets and provide accurate completion suggestions. Combined with project-level code library retrieval and knowledge base query, semantic retrieval is performed using retrieval enhancement generation technology. Retrieval enhancement generation extracts relevant information from existing code in external knowledge bases or projects, generates code completion or intelligent dialogue suggestions based on the context, and provides more comprehensive support for developers. Intelligent dialogue can provide intelligent dialogue support based on the developer's input to help developers solve problems or provide programming suggestions. During the processing, the core module uses external resources (such as code bases, files, etc.) and information in external knowledge bases to enhance the accuracy and comprehensiveness of code completion and intelligent dialogue. The prompt word library module provides the system with a task-based fixed prompt word management function, which supports developers to customize prompt words. These prompt words are adapted to different programming languages and models, providing effective support for intelligent code completion and dialogue. After being processed by the core module, the results of intelligent code completion or dialogue will be returned to the developer and displayed in the client's integrated development environment. The entire process realizes the intelligent code completion and dialogue functions in the automated workflow through the integrated module of the development and operation platform. For example, in the continuous integration and continuous delivery / deployment process, the programming assistant can automatically detect code changes and provide relevant suggestions to help developers optimize the development process.
[0074] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device, a terminal system, etc. that can realize the above functions. The following takes the programming assistant system as an example (hereinafter referred to as the system) to illustrate this embodiment and the following embodiments.
[0075] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be described in detail later. Figure 4 , Figure 4 This is a flow chart of the second embodiment of the programming assistance method of the present application.
[0076] In this embodiment, the programming assistance method includes steps S10 to S30:
[0077] Step S10, in each link node of code development and maintenance, if the DevOps platform integration module receives input information sent by any link node, and when it is determined that code completion and dialogue operations are required according to the input information, the code-related issues in the input information are obtained;
[0078] It should be noted that the code completion operation is to automatically recommend or fill in possible subsequent codes based on the entered code snippets or context during the code writing process to improve coding efficiency and reduce errors.
[0079] After the DevOps platform installs the programming assistant plug-in, during the code development and maintenance process, when the DevOps platform integration module receives input information from any link node, it will extract specific problems or code snippets related to code completion from the input information, which is the basis for subsequent processing.
[0080] For example, refer to Figure 5 , Figure 5It is a devops integration scenario diagram. The devops integration scenario contains a multi-step development workflow, including demand analysis, user story decomposition, card management, code submission, code review, testing, and release. In each devops node, the network callback mechanism (when an event (such as code submission, test completion, successful deployment, etc.) occurs, the devops system will send a request to the programming assistant, which contains detailed information of the event. The programming assistant can perform corresponding operations based on this information, such as updating status, sending notifications, triggering new workflows, etc.) to call the intelligent completion and dialogue functions to improve the automation level of the development process. For example, in the user story decomposition stage, the dialogue function can be used to understand the user stories described by developers in natural language and convert them into structured information, so as to accurately identify user needs, and can also automatically retrieve relevant information, provide background information and reference examples. In the card management node, the system can automatically assign task cards according to the priority of the task, the skills of the developer, and the current workload. In the code submission node, for merge requests in the version control system, the system can provide intelligent merge suggestions based on the history and current status of the code base. In the code review node, the system can automatically check the code quality, potential errors and security risks, and provide reference for reviewers. In the test node, the system can automatically trigger the execution of the test suite, including unit testing, integration testing and end-to-end testing. After the test is completed, the system can automatically analyze the test results, generate a test report, and highlight the failed or unpassed test cases. In the release node, the system can automatically deploy the tested code to the production environment or the specified test environment. After the deployment is completed, the system can automatically perform health checks, monitor the performance indicators and stability of the application, and send alerts when problems occur.
[0081] Step S20, reading source code matching the code-related problem in a preset project code library, performing abstract syntax tree parsing on the source code to obtain an abstract syntax tree;
[0082] It should be noted that the abstract syntax tree (AST) is a tree-like representation of the abstract syntax structure of the source code. It does not retain all details (such as spaces, comments), but retains the syntax structure information to facilitate code analysis, modification and other operations.
[0083] In the preset project code base, find the source code that matches the problem. Then, use the parser to parse the abstract syntax tree (AST) of these source codes to convert the source code into a structured form that is easy for computers to understand and operate. The first step of the parser is lexical analysis, also known as scanning. In this stage, the source code is decomposed into a series of tokens, which are the smallest units that constitute the source code, such as keywords, identifiers, literals (such as numbers, strings), operators, and separators. The lexical analyzer reads the character stream of the source code and organizes them into a sequence of tokens according to the lexical rules of the language. Then, the grammatical analysis is performed, and the parser uses these tokens to build an abstract syntax tree (AST). AST is a tree-like data structure that uses nodes to represent the grammatical structures in the source code, such as expressions, statements, declarations, etc. Each node represents a construct in the source code and may contain pointers to its child nodes, which further represent the components of the construct. The grammatical analyzer combines the token sequence into nodes and edges of the AST according to the grammatical rules of the language. Although semantic analysis is not a direct part of AST parsing, it is usually performed after AST construction. Semantic analysis checks whether the nodes in the AST conform to the semantic rules of the language, such as type checking, scope resolution, etc. This step may modify the AST, add additional information (such as type annotations), or report errors.
[0084] Step S30, perform semantic recognition on code-related issues to obtain user intent, traverse the abstract syntax tree according to the user intent, determine code context information, perform retrieval according to the user intent and the code context information to obtain retrieval information, generate code suggestions according to the retrieval information, and output the code suggestions.
[0085] It should be noted that semantic recognition is an important part of natural language processing (NLP) and code analysis, which is to understand the user's intention or request content by analyzing the meaning of code or text. Code context information refers to the code environment around the current code snippet when writing code, including variable declarations, function calls, control structures, etc., which is crucial for understanding code intent and performing accurate code completion.
[0086] Conduct in-depth analysis of code-related issues and understand the user's true intention through semantic recognition technology. Then, combined with the user's intention, traverse the previously constructed abstract syntax tree to determine the context information of the code. This step is a bridge between user needs and the actual structure of the code. Based on user intention and code context information, search in the project code base and external knowledge base to find code snippets or solutions that match the current needs. The retrieved information will be used as the basis for generating code suggestions. Finally, specific code suggestions are generated based on this information and output to the user.
[0087] The present embodiment provides a programming assistant framework, including a DevOps platform integration module, a code completion and dialogue function module and a RAG retrieval enhancement generation module, which significantly improves the efficiency and code quality in the software development process. The DevOps platform integration module is used to receive input information sent by any link node in each link node for code development and maintenance, and when it is determined that code completion and dialogue operations need to be performed according to the input information, the input information is sent to the code completion and dialogue function module, which realizes the automation and seamless connection of the development process, reduces manual intervention, and improves the response speed. The code completion and dialogue function module is used to obtain code-related issues in the input information, read the source code matching the code-related issues in the preset project code library, perform abstract syntax tree analysis on the source code, and obtain an abstract syntax tree. By deeply parsing the code structure, the structure and dependency of the code can be more accurately and deeply analyzed, not only limited to the current file, but also across files for code analysis and completion. This parsing capability makes code completion more accurate, especially in large projects, it can effectively understand the dependency between code modules and generate more reasonable completion suggestions. The RAG retrieval enhancement generation module is used to perform semantic recognition on code-related issues, obtain user intent, traverse the abstract syntax tree according to user intent, determine code context information, perform retrieval according to user intent and code context information, obtain retrieval information, generate code suggestions based on the retrieval information, and output code suggestions. This technology not only improves the accuracy of code completion, but also enables programming assistants to have the ability of intelligent question and answer and complex code interpretation, thereby further improving the work efficiency of developers.
[0088] In a feasible implementation manner, step S20 further includes steps T10 to T20, and step S30 further includes step T30:
[0089] Step T10, detecting whether there is any update to the source code;
[0090] It should be noted that source code update refers to the modification or addition of source code files during the software development process, including but not limited to changes in function definitions, variable declarations, logical processing, etc. These updates may be made manually by developers or completed through automated tools (such as version control systems).
[0091] First, the system needs to get the latest version of the current source code. This usually involves pulling the latest code base state from a version control system (such as Git) or reading the latest source files from the file system. In order to detect updates, the system can compare the current version of the source code with the previous version (if any). This comparison can be achieved by calculating the hash value, timestamp, or directly comparing the file contents. If a difference is detected, it is considered that the source code has been updated.
[0092] Step T20, if there is an update, determine the change position in the updated source code, and update the change node corresponding to the change position in the abstract syntax tree to obtain an updated abstract syntax tree;
[0093] It should be noted that the change location is the location of the code segment or element that has been changed after the source code is updated. These locations can be new lines of code that have been added, lines of code that have been deleted, or lines of code that have been modified. Determining the change location is a key step in understanding and applying these updates. An abstract syntax tree (AST) is a tree structure used to represent the grammatical structure of source code. In the AST, each node represents a construct in the source code (such as an expression, statement, declaration, etc.), and the relationship between the nodes reflects the grammatical relationship between these constructs. AST is an important basis for compilers and code analysis tools to understand, transform, and optimize source code. A change node is a node in the AST that corresponds to the change location in the source code update. When the source code changes, the corresponding nodes in the AST also need to be updated accordingly to reflect the latest status of the source code.
[0094] After detecting source code updates, the system needs to analyze these updates to determine which parts have changed. This usually involves parsing the different lines of code to identify new, deleted, or modified code segments. Based on the location of the change, the system needs to locate the corresponding node in the AST. This may require traversing the AST to find the nodes associated with the location of the change. Once these nodes are found, the system needs to update the properties and child nodes of these nodes based on the source code updates. For example, if a new function definition is added to the source code, a new function node needs to be added to the AST. The update of the AST is a direct reflection of the source code changes. Since the structure of the AST is closely related to the grammatical structure of the source code, any changes to the source code will result in changes to the corresponding nodes in the AST. By dynamically updating the AST, the system can maintain an accurate understanding of the latest state of the source code, thereby providing a basis for subsequent compilation, analysis, or optimization operations.
[0095] Step T30, traverse the updated abstract syntax tree according to the user's intention.
[0096] After obtaining the updated abstract syntax tree, each time the user intent is obtained, it is necessary to traverse the new abstract syntax tree according to the user intent to ensure that the latest suggestions and codes are output to the user.
[0097] This embodiment ensures that the system can always process the latest version of the source code by detecting source code updates and updating the changed nodes in the AST accordingly, and provides an accurate and reliable basis for its subsequent processing.
[0098] Based on the first or second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first or second embodiment can be referred to the above introduction, and will not be described in detail later. Step S10 also includes steps A10 to A20:
[0099] Step A10, determining a matching prompt word that matches the input information, the link node for receiving the input information, and the source code, outputting the matching prompt word, and determining the matching prompt word selected by the developer as the target prompt word, wherein the matching prompt word comes from a prompt word library;
[0100] It should be noted that the matching hint word is a keyword or phrase selected from the hint word library that matches these elements in the context of given input information, the link node receiving the input information, and the source code. It is used to guide developers to pay attention to specific code problems or solutions. The hint word library is a predefined collection of keywords, phrases or short sentences related to the project code base. These elements are used to provide hints or suggestions during the code development process. The target hint word is the one selected by the developer from multiple matching hint words as the benchmark or target for subsequent operations.
[0101] When receiving input information, the system first identifies the link node and related source code to which the information belongs. Then, search the prompt word library for prompt words that match these elements (input information, link nodes, source code). This may involve parsing the input information, understanding the characteristics of the link nodes, and analyzing the content of the source code. Finally, a group of matching prompt words are selected from the prompt word library, which are highly relevant to the current development context. This group of matching prompt words is displayed to the developer for selection. The developer selects one from the displayed matching prompt words as the target prompt word based on his or her needs and judgment. This selection process is usually based on the developer's understanding of the current development task and the evaluation of the relevance of the prompt words.
[0102] Step A20, parsing the code-related issues contained in the target prompt word, and using the parsed code-related issues as the code-related issues in the input information, and reading source code matching the code-related issues in a preset project code library.
[0103] It should be noted that code-related issues are specific problems or concerns related to the source code that are identified during the parsing of the target prompt words, such as potential errors, optimization suggestions, or function implementation methods.
[0104] Perform in-depth analysis on the target prompt words selected by the developer to identify the code-related issues contained therein. This may involve natural language processing technologies such as word segmentation, part-of-speech tagging, and semantic analysis of the prompt words. The analysis result will be a set of specific code-related issues that are directly related to the source code and require the developer's attention or resolution. The parsed code-related issues are regarded as new input information, which will guide the subsequent source code reading and analysis work. In the preset project code library, according to the parsed code-related issues, find the matching source code. This usually involves indexing, searching, and filtering the code library to quickly locate the relevant code snippets. The read source code will serve as the basis for subsequent analysis and processing to help developers solve code problems or implement specific functions.
[0105] This embodiment can intelligently determine the matching prompt words that match the input information, link nodes and source code, and allow developers to select target prompt words from them. This process not only improves the accuracy of problem location, but also effectively reduces the cognitive burden of developers in complex development environments through the guidance of the prompt word library. Subsequently, the target prompt word is deeply parsed to directly extract specific code-related problems, further guiding the precise search and reading in the project code library. This mechanism significantly accelerates the discovery and resolution process of code problems, improves the efficiency and quality of code development, and provides developers with a more efficient and intelligent programming assistant experience.
[0106] Based on Embodiments 1 to 3 of the present application, in Embodiment 4 of the present application, the contents that are the same or similar to any one of Embodiments 1 to 3 above can be referred to the above introduction and will not be repeated later.
[0107] The steps before step S30 include steps B10 to B20:
[0108] Step B10, when the retrieval information related to the user intention and the code context information cannot be found in the code index, the retrieval information related to the user intention and the code context information is retrieved through a preset external knowledge base.
[0109] It should be noted that the project code base is a repository that stores all source code and related files of a specific project, and is the basis of version control, team collaboration and code management in the software development process. Retrieval information is data or results related to user intent and code context information obtained from the project code base or external knowledge base through search algorithms or technologies.
[0110] The process in this embodiment is intended to retrieve relevant retrieval information from an internal project code base or an external knowledge base through a programming assistant framework, based on the user's intent and current code context information. The system will first attempt to retrieve retrieval information related to the user's intent and code context information in the internal project code base. In order to improve search efficiency, this step can generate a data structure after preprocessing the content in the project code base, allowing for rapid location and retrieval of specific information in the code base. By matching index items such as keywords, function names, and class names, potentially relevant code snippets or documents can be quickly located. If retrieval information that highly matches the user's intent and code context information is found in the internal project code base, this information is directly presented to the user.
[0111] Step B20, when the search information related to the user intention and the code context information cannot be found in the project code base, the search information related to the user intention and the code context information is searched through a preset external knowledge base.
[0112] It should be noted that external knowledge bases are other sources of knowledge besides project code bases, such as open source code bases, technical documents, question-and-answer communities on the Internet, etc. These resources can provide programming assistants with more extensive information support.
[0113] If the search information that meets the user's needs cannot be found in the internal project code base, or the match found is not high, the system will turn to the external knowledge base for search. The process of external search is similar to internal search, but the search scope is wider, covering various resources on the Internet. The system will use preset search strategies (such as using specific search engines, visiting specific technical websites or forums, etc.) to build search queries based on user intent and code context information, and submit them to the external knowledge base. After the external knowledge base returns relevant search results, the system will filter and sort these results to improve the match and relevance, and then present the final results to the user.
[0114] For example, refer to Figure 6 , Figure 6It is a flowchart for processing specific problems. When a developer (user) raises a specific question, the system first performs natural language understanding and analysis on the question, identifies the key information and intention of the developer's inquiry, and associates the question with the current development environment and code context to accurately understand the background and scope of the question. This step can be combined with the parsing results of the abstract syntax tree to obtain a deeper understanding of the code structure. The retrieval enhancement module in the system establishes an index of the project code base, including source code files, functions, classes, variables, etc., to quickly retrieve code snippets and documents related to the problem. At the same time, context information (such as the currently edited file, function and its parameters) is used to refine the retrieval results. Integrate external technical documents, open source projects and other knowledge bases, and find technical documents, code examples or solutions related to the developer's problem through intelligent matching algorithms. In the code completion or suggestion generation stage, the retrieval enhancement module uses the parsing results of the abstract syntax tree to deeply understand the grammatical structure and dependencies of the code, and ensure that the generated code suggestions are consistent with the current code environment. Based on the retrieved information and context analysis, the retrieval enhancement module generates specific code suggestions, which may include code snippets, function implementation methods, etc., to help developers quickly solve problems. The generated code suggestions or answers are returned to the developer to support their subsequent development work. If the suggestions do not meet the requirements, the developer can return to the previous stage and re-analyze the problem or retrieve information until a satisfactory solution is found.
[0115] This embodiment combines project code base retrieval and external knowledge base query, and uses RAG technology to perform semantic retrieval in the project. RAG can extract relevant information from the external knowledge base or existing code in the project, and generate code completion or intelligent dialogue suggestions based on the context. Through this technology, the programming assistant is not limited to code completion of a single file, but can also provide more comprehensive support at the project level.
[0116] It should be noted that, under the condition that the technology is feasible and the logic is clear, the above embodiments can be combined in pairs or in multiple combinations.
[0117] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the programming assistance method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0118] The programming assistant device provided by the present application adopts the programming assistance method in the above embodiment, which can solve the technical problem of low overall development efficiency in the development process. Compared with the prior art, the beneficial effects of the programming assistant device provided by the present application are the same as the beneficial effects of the programming assistance method provided by the above embodiment, and other technical features in the programming assistant device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0119] The present application provides a programming assistant device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the programming assistance method in the above-mentioned embodiment one.
[0120] Reference below Figure 7 , which shows a schematic diagram of the structure of a programming assistant device suitable for implementing the embodiment of the present application. The programming assistant device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The programming assistant device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0121] like Figure 7 As shown, the programming assistant device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the programming assistant device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the programming assistant device to communicate wirelessly or wired with other devices to exchange data. Although the programming assistant device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided alternatively.
[0122] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0123] The programming assistant device provided by the present application adopts the programming assistance method in the above embodiment, which can solve the technical problem of low overall development efficiency in the development process. Compared with the prior art, the beneficial effects of the programming assistant device provided by the present application are the same as the beneficial effects of the programming assistance method provided by the above embodiment, and the other technical features in the programming assistant device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0124] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0125] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0126] The present application provides a medium, which is a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the programming assistance method in the above-mentioned embodiment.
[0127] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0128] The computer-readable storage medium may be included in the programming assistant device; or may exist independently without being assembled into the programming assistant device.
[0129] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by a programming assistant device, the programming assistant device can execute the steps in the programming assistance method.
[0130] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0131] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0132] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0133] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned programming assistance method, and can solve the technical problem of low overall development efficiency in the development process. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the programming assistance method provided in the above-mentioned embodiment, and will not be repeated here.
[0134] The present application also provides a product, which is a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the programming assistance method as described above are implemented.
[0135] The computer program product provided by this application can solve the technical problem of low overall development efficiency in the development process. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the programming assistance method provided by the above embodiment, which will not be repeated here.
[0136] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A programming assistant framework, characterized in that: The programming assistant framework includes: The DevOps platform integration module is used to receive input information sent by any link node in each link node for code development and maintenance, and when it is determined that code completion and dialogue operations need to be performed according to the input information, send the input information to the code completion and dialogue function module; The code completion and dialogue function module is used to obtain code-related problems in the input information, read source code matching the code-related problems in a preset project code library, and perform abstract syntax tree analysis on the source code to obtain an abstract syntax tree; The RAG retrieval enhancement generation module is used to perform semantic recognition on the code-related issues, obtain user intent, traverse the abstract syntax tree according to the user intent, determine code context information, perform retrieval according to the user intent and the code context information, obtain retrieval information, generate code suggestions according to the retrieval information, and output code suggestions.
2. The programming assistant framework according to claim 1, characterized in that: The programming assistant framework also includes a prompt word library module. The prompt word library module is used to determine a matching prompt word in a preset prompt word library that matches the input information, the link node that sends the input information, and the source code; The code completion and dialogue function module is used to output the matching prompt word, determine the matching prompt word selected by the developer as the target prompt word, parse the code-related problems contained in the target prompt word, and use the parsed code-related problems as the code-related problems in the input information.
3. The programming assistant framework according to claim 1, characterized in that: The programming assistant framework also includes an API forwarding library module. The DevOps platform integration module receives input information sent by any link node through the API forwarding library module; The RAG search enhancement generation module outputs code suggestions through the API forwarding library module.
4. A programming assistance method, characterized in that: Applied to the programming assistant framework according to any one of claims 1 to 3, the programming assistance method comprises: In each link node of code development and maintenance, if input information sent by any link node is received, and when it is determined that code completion and dialogue operations need to be performed based on the input information, code-related issues in the input information are obtained; Reading source code matching the code-related problem in a preset project code library, performing abstract syntax tree parsing on the source code to obtain an abstract syntax tree; Perform semantic recognition on the code-related issues to obtain user intent, traverse the abstract syntax tree according to the user intent, determine code context information, perform retrieval according to the user intent and the code context information to obtain retrieval information, generate code suggestions according to the retrieval information, and output the code suggestions.
5. The programming assistance method according to claim 4, characterized in that: The step of obtaining code-related questions in the input information includes: Determine a matching prompt word in a preset prompt word library that matches the input information, the link node for sending the input information, and the source code; The matching prompt word is output, the matching prompt word selected by the developer is determined as the target prompt word, the code-related problem contained in the target prompt word is parsed, and the code-related problem obtained by the parsing is used as the code-related problem in the input information.
6. The programming assistance method according to claim 4, characterized in that: After the step of performing an abstract syntax tree analysis on the source code to obtain an abstract syntax tree, the method further comprises: Detecting whether the source code is updated; If there is an update, determining a change position in the updated source code, and updating a change node corresponding to the change position in the abstract syntax tree to obtain an updated abstract syntax tree; The step of traversing the abstract syntax tree according to the user intention comprises: The updated abstract syntax tree is traversed according to the user intent.
7. The programming assistance method according to claim 4, characterized in that: The step of performing a search according to the user intention and the code context information to obtain the search information comprises: Retrieving the retrieval information related to the user intention and the code context information in a project code library within the programming assistant framework; When the retrieval information related to the user intention and the code context information cannot be found in the project code base, the retrieval information related to the user intention and the code context information is retrieved through a preset external knowledge base.
8. A programming assistant device, characterized in that: The programming assistant device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the programming assistance method according to any one of claims 4 to 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the programming assistance method according to any one of claims 4 to 7 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the programming assistance method according to any one of claims 4 to 7 are implemented.
Citation Information
Cited By
Construction method and equipment of C + + code knowledge base and medium
CN119918641A
Safety detection method and system based on large language model and retrieval enhancement
CN120105438A
Security Detection Method and System Based on Large Language Model and Retrieval Enhancement
CN120105438B
Code adoption rate determination method and device, medium, electronic equipment and product
CN121050713A