Code editing assisting method and tool
By integrating retrieval enhancement generative model and agent decision model in the code editor, in-depth code logic understanding and real-time optimization suggestions are provided, and the insufficient performance analysis of code editors in the existing technology in multilingual and big data scenarios is solved. , improves programming efficiency and code quality.
Patent Information
- Application Number
- CN202411266324.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-10
AI Technical Summary
Existing code editors have insufficient performance in code logic understanding and real-time optimization suggestions, especially in multilingual and big data processing scenarios, and lack of deep integration with large-scale machine learning models, resulting in programming efficiency and Code quality is limited.
Through integrated search, enhance the generation model and agent decision model, and use preset search databases and intelligent programming editors to provide in-depth code logic understanding and real-time optimization suggestions, including code elements and syntax tree structure analysis, and generate code adjustment suggestions .
It improves programming efficiency, reduces potential errors in the code, and provides more advanced code assistance functions to meet the development needs in big data and high concurrency scenarios.
Smart Images

Figure CN119201074A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer programming, and in particular to a code editing auxiliary method and tool. Background Art
[0002] In the field of code editors, existing technologies cover a variety of online and offline editing tools that support a wide range of programming languages such as JavaScript, Python, SQL, etc. These tools are usually based on open source projects such as Ace and Monaco Editor, and provide basic functions such as code highlighting, syntax checking, and code folding. For example, Visual Studio Code uses Monaco Editor as its core component, which not only provides advanced code editing functions, but also has a powerful plug-in support system that allows users to expand the capabilities of the editor by installing different plug-ins. In addition, some editors integrate simple code auto-completion and prompt functions, which mainly rely on static analysis and predefined code snippet libraries.
[0003] Although existing code editors provide basic code auto-completion and error detection functions, they are insufficient in code logic understanding and real-time optimization suggestions, especially in performance analysis capabilities in multi-language and big data processing scenarios. In addition, code editors in the existing technology lack deep integration with large-scale machine learning models, which limits the editor's potential in providing advanced code suggestions and real-time assistance. Therefore, when faced with complex programming tasks, existing editors lack sufficient intelligent support, resulting in limited programming efficiency and code quality. Especially in big data and high-concurrency application scenarios, the auxiliary functions provided by traditional editors cannot meet the needs of efficient development.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a code editing assistance method and tool to at least solve the technical problem that related code editing assistance tools can only provide static code detection functions and are difficult to meet user needs.
[0006] According to one aspect of an embodiment of the present application, a code editing assistance method is provided, including: obtaining a first code input by a target object in an interactive interface of an intelligent programming editor; retrieving and generating code editing assistance information associated with the first code from a preset retrieval database using a retrieval enhancement generation model; analyzing the code editing assistance information using a pre-trained intelligent agent decision model to generate adjustment suggestions for the first code; and displaying the adjustment suggestions in the interactive interface.
[0007] Optionally, the intelligent programming editor is Monaco-editor, the interactive interface is a human-computer interactive interface customized by the target object, and obtaining a first code entered by the target object in the interactive interface of the intelligent programming editor includes: responding to an access request from the target object to access Monaco-editor, configuring a programming language environment corresponding to the access request, wherein Monaco-editor supports multi-language programming; and receiving the first code entered by the target object in the interactive interface.
[0008] Optionally, after obtaining the first code input by the target object in the interactive interface of the intelligent programming editor, the method also includes: using the intelligent programming editor to perform a grammatical structure analysis on the first code to obtain a code analysis result, wherein the code analysis result includes at least one of the following: code elements and syntax tree structures of the first code; if the code elements hit a preset metadata template, and / or the syntax tree structure hits a preset syntax template, directly displaying the code editing prompt information corresponding to the metadata template and / or the syntax template in the interactive interface; if the code elements do not hit the metadata template, and the syntax tree structure does not hit the syntax template, continuing to use the retrieval enhancement generation model to perform retrieval analysis on the first code.
[0009] Optionally, before using the retrieval enhancement generation model to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database, the method also includes: configuring the retrieval database and indexing the data in the retrieval database, wherein the retrieval database includes: historical codes, historical programming documents; configuring model parameters of the retrieval enhancement generation model, wherein the model parameters include: retrieval range, response time, accuracy and callback function; configuring the retrieval algorithm of the retrieval enhancement generation model to be a retrieval algorithm based on vector space similarity.
[0010] Optionally, a retrieval enhancement generation model is used to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database, including: using an intelligent programming editor to preprocess the first code to obtain a second code, wherein the preprocessing includes at least one of the following: code standardization, redundant code removal, erroneous code correction, and semantic enhancement; using the retrieval enhancement generation model to retrieve historical codes and historical programming documents associated with the second code from the retrieval database as code editing auxiliary information.
[0011] Optionally, the intelligent agent decision model is trained using historical programming data of the target object, and the pre-trained intelligent agent decision model is used to analyze the code editing auxiliary information to generate adjustment suggestions for the first code, including: using the intelligent agent decision model to analyze the code editing auxiliary information to generate adjustment suggestions that match the programming style and habits of the target object, wherein the adjustment suggestions include: error modification suggestions for the first code and structural optimization suggestions for the first code.
[0012] Optionally, after displaying the adjustment suggestion in the interactive interface, the method further includes: obtaining feedback information regarding the adjustment suggestion input by the target object in the interactive interface; and re-training the intelligent agent decision model based on the feedback information.
[0013] According to another aspect of an embodiment of the present application, a code editing assistance tool is also provided, including: an intelligent programming editor, a retrieval enhancement generation model and an intelligent agent decision model, wherein the intelligent programming editor is used to provide an interactive interface; obtain a first code input by a target object in the interactive interface; display adjustment suggestions for the first code generated by the intelligent agent decision model; the retrieval enhancement generation model is used to retrieve and generate code editing assistance information associated with the first code from a preset retrieval database; and the intelligent agent decision model is used to analyze the code editing assistance information and generate adjustment suggestions.
[0014] According to another aspect of an embodiment of the present application, a computer program product is further provided, the computer program product comprising: a computer program, wherein the computer program implements the above-mentioned code editing assistance method when executed by a processor.
[0015] According to another aspect of an embodiment of the present application, an electronic device is further provided, comprising: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the above-mentioned code editing assistance method through the computer program.
[0016] In an embodiment of the present application, a first code input by a target object in an interactive interface of an intelligent programming editor is obtained; a retrieval enhancement generation model is used to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database; a pre-trained agent decision model is used to analyze the code editing auxiliary information to generate adjustment suggestions for the first code; and the adjustment suggestions are displayed in the interactive interface. By integrating a retrieval enhancement generation model, an agent decision model, and an intelligent programming editor, an embodiment of the present application can provide in-depth code logic understanding and real-time optimization suggestions based on the current code context, which not only helps to improve programming efficiency, but also effectively reduces potential errors in the code. The present application solves the technical problem that related code editing auxiliary tools can only provide static code detection functions and are difficult to meet user needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 is a flowchart of an optional code editing auxiliary method according to an embodiment of the present application;
[0019] Figure 2 is a schematic diagram of the structure of an optional code editing auxiliary tool according to an embodiment of the present application;
[0020] Figure 3 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0022] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0023] Example 1
[0024] According to an embodiment of the present application, a code editing assistance method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0025] Figure 1is a flowchart of a code editing assistance method provided according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0026] Step S102, obtaining a first code input by the target object in the interactive interface of the intelligent programming editor;
[0027] Step S104, using the retrieval enhancement generation model to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database;
[0028] Step S106, using the pre-trained intelligent agent decision model to analyze the code editing auxiliary information and generate adjustment suggestions for the first code;
[0029] Step S108, displaying adjustment suggestions in the interactive interface.
[0030] The following describes each step of the code editing assistance method in conjunction with a specific implementation process.
[0031] In order to improve programming efficiency and provide in-depth code logic understanding and real-time optimization suggestions according to the current code context during the programming process, this application proposes a code editing assistance tool based on the code editing assistance method. The code editing assistance tool integrates a retrieval enhanced generation model, an agent decision model and an intelligent programming editor, thereby providing a series of more advanced code assistance functions.
[0032] When choosing the basic platform for an intelligent programming editor, you can choose Monaco Editor. Monaco Editor is a powerful code editor developed by Microsoft, which is derived from the Visual Studio Code project. As a completely open source solution, Monaco Editor can run in a web environment and provides a rich API to support a variety of functions, such as syntax highlighting, code completion, code navigation, and code formatting. It can support multiple programming languages, such as JavaScript, TypeScript, Python, and C++, and can load the corresponding language service according to the required supported language.
[0033] The retrieval-enhanced generative model combines the two technical means of retrieval and generation, and is designed for understanding and generating natural language text. It can retrieve external authoritative knowledge bases before generating content, thereby generating more accurate and comprehensive information. Compared with traditional generative models that only rely on internal training data of the model, the retrieval-enhanced generative model can provide a wider range of information sources and higher accuracy. In the application of the present invention, the retrieval-enhanced generative model is integrated into the intelligent programming editor, which can provide relevant and timely data support according to the real-time changes of the programming environment.
[0034] In the field of computer science and artificial intelligence, an agent refers to an automated entity that can perform tasks and make decisions. In software engineering, an agent is usually based on a large language model, has the ability to plan, remember, use tools, and can complete tasks independently. In the specific implementation of the present invention, the agent decision model is based on the information provided by the retrieval enhancement generation model, can analyze the possible problems in the current programming task, and generate specific code optimization suggestions and error correction solutions accordingly.
[0035] The specific implementation process of code editing using the above-mentioned retrieval enhancement generation model, agent decision model and intelligent programming editor is as follows:
[0036] First, the target object accesses the intelligent programming editor based on Monaco-editor through the Web interface and sets the required programming language environment. The intelligent programming editor is also equipped with a human-computer interaction interface customized for the specific target object. When the target object initiates a request to access Monaco-editor, the system will respond to this request and configure the corresponding programming language environment. Subsequently, the system receives the first code entered by the target object in this customized interaction interface.
[0037] Optionally, after obtaining the first code input by the target object in the interactive interface of the intelligent programming editor, the intelligent programming editor can be used to perform syntax structure analysis on the first code to obtain code analysis results, so as to identify potential errors and optimization points. The code analysis results include at least one of the following: code elements and syntax tree structures of the first code; if the code elements hit a preset metadata template, or the syntax tree structure hits a preset syntax template, the code editing prompt information corresponding to the metadata template or syntax template is directly displayed in the interactive interface; if the code elements do not hit the metadata template, and the syntax tree structure does not hit the syntax template, the search enhancement generation model is continued to be used to perform search analysis on the first code.
[0038] Taking into account the characteristics of programming languages and common types of programming problems, it is necessary to select a suitable retrieval-enhanced generation model framework. In order to process large amounts of text data and optimize to identify key structures and patterns in programming languages, before using the retrieval-enhanced generation model to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database, the retrieval-enhanced generation model can also be configured as follows: configure the retrieval database and index the data in the retrieval database for fast retrieval, wherein the retrieval database includes: historical codes, historical programming documents, to ensure that the data covers multiple programming languages and common programming scenarios; configure the model parameters of the retrieval-enhanced generation model, wherein the model parameters include: retrieval scope, response time, accuracy and callback function, to ensure that programming suggestions are provided quickly and accurately in a real-time environment; configure a retrieval algorithm based on vector space similarity, for example, using embeddings such as TF-ID (FTermFrequency-Inverse Document Frequency) or BERT (BidirectionalEncoder Representations from Transformers) to evaluate the similarity between queries and documents. As another optional implementation, the algorithm may be optimized through machine learning technology, and the algorithm parameters may be adjusted in real time to adapt to the needs of different query types and target objects.
[0039] After completing the above configuration of the retrieval enhancement generation model, the model is used to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database. The following steps can be used: first, the first code is preprocessed using an intelligent programming editor to obtain a second code, wherein the preprocessing includes at least one of the following: code standardization, redundant code removal, erroneous code correction, and semantic enhancement to improve the relevance and accuracy of the retrieval; then the retrieval enhancement generation model is used to retrieve historical codes and historical programming documents associated with the second code from the retrieval database as code editing auxiliary information, which will be used as the basis for providing code editing suggestions.
[0040] Optionally, before using the agent decision model to analyze the above code editing auxiliary information, the agent decision model needs to be trained first. During the training, the historical programming data of the target object needs to be collected first. These data may include previous code snippets, comments, version control history, code review feedback, and any other information related to programming habits and styles, and the collected data is cleaned and preprocessed for use in training the model, which may include removing unnecessary parts, standardizing formats, extracting features, etc.; then defining features that help the model understand programming styles and habits, such as code structure, common design patterns, common class libraries, code comment styles, etc.; after selecting the model architecture, the selected model architecture is trained using the historical programming data. The goal of the training is to enable the model to learn to recognize the programming habits of a specific target object and generate reasonable code adjustment suggestions based on these habits. During the training process, supervised learning methods (for example, if the historical data contains clear improvement suggestions) or reinforcement learning methods (encouraging the generation of suggestions that are more in line with the programming style through a reward mechanism) are used. After the model is trained, it is necessary to evaluate the performance of the model using unseen datasets. This can be done in a variety of ways, such as using cross-validation techniques to ensure that the model can generalize to new data. Evaluation metrics may include accuracy, recall, F1 score, or other metrics applicable to the task. Once the model reaches a satisfactory level of performance, it can be deployed to the intelligent programming editor. The model can also continuously learn and self-improve through the interaction data of the target object during use to adapt to the user's latest habits.
[0041] Optionally, after obtaining the above-mentioned intelligent agent decision model, the code editing auxiliary information is combined with the context of the current user code, analyzed through the model, and adjustment suggestions for the first code are generated, that is, adjustment suggestions that match the programming style and habits of the target object. These suggestions include but are not limited to: error correction suggestions for the first code, structural optimization suggestions for the first code, and the interactive interface of the intelligent programming editor displays the adjustment suggestions for the first code.
[0042] After displaying the adjustment suggestions in the interactive interface, an interactive feedback loop can also be performed. Specifically, feedback information on the adjustment suggestions entered by the target object in the interactive interface is obtained. This feedback can be acceptance, rejection, or further modification opinions on the suggestions. The system collects user feedback information and records it as new training data. The newly collected data is then used to retrain or fine-tune the model so that the model can better adapt to the user's preferences and specific requirements. The above process is repeated to form a closed-loop learning mechanism. After continuous feedback and training, the intelligent agent decision model can respond to the user's specific needs more accurately, thereby improving coding efficiency and code quality.
[0043] In an embodiment of the present application, a first code input by a target object in an interactive interface of an intelligent programming editor is obtained; a retrieval enhancement generation model is used to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database; a pre-trained agent decision model is used to analyze the code editing auxiliary information to generate adjustment suggestions for the first code; and the adjustment suggestions are displayed in the interactive interface. By integrating a retrieval enhancement generation model, an agent decision model, and an intelligent programming editor, an embodiment of the present application can provide in-depth code logic understanding and real-time optimization suggestions based on the current code context, which not only helps to improve programming efficiency, but also effectively reduces potential errors in the code. The present application solves the technical problem that related code editing auxiliary tools can only provide static code detection functions and are difficult to meet user needs.
[0044] Example 2
[0045] According to an embodiment of the present application, a code editing assistance tool for implementing the code editing assistance method in embodiment 1 is also provided. Figure 2 As shown, the code editing auxiliary tool at least includes: an intelligent programming editor 21, a search enhancement generation model 22 and an intelligent agent decision model 23, wherein:
[0046] The intelligent programming editor 21 is used to provide an interactive interface; obtain a first code input by a target object in the interactive interface; and display an adjustment suggestion for the first code generated by the intelligent agent decision model;
[0047] A retrieval enhancement generation model 22, used for retrieving and generating code editing auxiliary information associated with the first code from a preset retrieval database;
[0048] The intelligent agent decision model 23 is used to analyze the code editing auxiliary information and generate adjustment suggestions.
[0049] The functions of each module of the code editing assistance tool are explained below in combination with the specific implementation process.
[0050] First, the target object accesses the intelligent programming editor based on Monaco-editor through the Web interface and sets the required programming language environment. The intelligent programming editor is also equipped with a human-computer interaction interface customized for the specific target object. When the target object initiates a request to access Monaco-editor, the system will respond to this request and configure the corresponding programming language environment. Subsequently, the system receives the first code entered by the target object in this customized interaction interface.
[0051] Optionally, after obtaining the first code input by the target object in the interactive interface of the intelligent programming editor, the intelligent programming editor can use the intelligent programming editor to perform syntax structure analysis on the first code to obtain code analysis results, so as to identify potential errors and optimization points. The code analysis results include at least one of the following: code elements and syntax tree structures of the first code; if the code elements hit a preset metadata template, or the syntax tree structure hits a preset syntax template, the code editing prompt information corresponding to the metadata template or the syntax template is directly displayed in the interactive interface; if the code elements do not hit the metadata template, and the syntax tree structure does not hit the syntax template, the search enhancement generation model is continued to be used to perform search analysis on the first code.
[0052] Considering the characteristics of programming languages and common types of programming problems, it is necessary to select a suitable retrieval enhancement generation model framework. In order to process a large amount of text data and optimize to identify key structures and patterns in programming languages, before using the retrieval enhancement generation model to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database, the retrieval enhancement generation model can also be configured as follows: configure the retrieval database and index the data in the retrieval database for fast retrieval, wherein the retrieval database includes: historical codes, historical programming documents, to ensure that the data covers multiple programming languages and common programming scenarios; configure the model parameters of the retrieval enhancement generation model, wherein the model parameters include: retrieval scope, response time, accuracy and callback function, to ensure that programming suggestions are provided quickly and accurately in a real-time environment; configure a retrieval algorithm based on vector space similarity, for example, using TF-ID or BERT embedding to evaluate the similarity between queries and documents. As another optional implementation, the algorithm can also be optimized through machine learning technology, and the algorithm parameters can be adjusted in real time to adapt to the needs of different query types and target objects.
[0053] After completing the above configuration of the retrieval enhancement generation model, the model is used to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database. The following steps can be used: first, the first code is preprocessed using an intelligent programming editor to obtain a second code, wherein the preprocessing includes at least one of the following: code standardization, redundant code removal, erroneous code correction, and semantic enhancement to improve the relevance and accuracy of the retrieval; then the retrieval enhancement generation model is used to retrieve historical codes and historical programming documents associated with the second code from the retrieval database as code editing auxiliary information, which will be used as the basis for providing code editing suggestions.
[0054] Optionally, before using the agent decision model to analyze the above code editing auxiliary information, the agent decision model needs to be trained first. During the training, the historical programming data of the target object needs to be collected first. These data may include previous code snippets, comments, version control history, code review feedback, and any other information related to programming habits and styles, and the collected data is cleaned and preprocessed for use in training the model, which may include removing unnecessary parts, standardizing formats, extracting features, etc.; then defining features that help the model understand programming styles and habits, such as code structure, common design patterns, common class libraries, code comment styles, etc.; after selecting the model architecture, the selected model architecture is trained using the historical programming data. The goal of the training is to enable the model to learn to recognize the programming habits of a specific target object and generate reasonable code adjustment suggestions based on these habits. During the training process, supervised learning methods (for example, if the historical data contains clear improvement suggestions) or reinforcement learning methods (encouraging the generation of suggestions that are more in line with the programming style through a reward mechanism) are used. After the model is trained, it is necessary to evaluate the performance of the model using unseen datasets. This can be done in a variety of ways, such as using cross-validation techniques to ensure that the model can generalize to new data. Evaluation metrics may include accuracy, recall, F1 score, or other metrics applicable to the task. Once the model reaches a satisfactory level of performance, it can be deployed to the intelligent programming editor. The model can also continuously learn and self-improve through the interaction data of the target object during use to adapt to the user's latest habits.
[0055] Optionally, after obtaining the above-mentioned intelligent agent decision model, the code editing auxiliary information is combined with the context of the current user code, analyzed through the model, and adjustment suggestions for the first code are generated, that is, adjustment suggestions that match the programming style and habits of the target object. These suggestions include but are not limited to: error correction suggestions for the first code, structural optimization suggestions for the first code, and the interactive interface of the intelligent programming editor displays the adjustment suggestions for the first code.
[0056] After the adjustment suggestions are displayed in the interactive interface of the intelligent programming editor, an interactive feedback loop can also be performed. Specifically, feedback information on the adjustment suggestions entered by the target object in the interactive interface is obtained. This feedback can be acceptance, rejection, or further modification opinions on the suggestions. The system collects user feedback information and records it as new training data. The newly collected data is then used to retrain or fine-tune the model so that the model can better adapt to the user's preferences and specific requirements. The above process is repeated to form a closed-loop learning mechanism. After continuous feedback and training, the intelligent agent decision model can respond to the user's specific needs more accurately, thereby improving coding efficiency and code quality.
[0057] It should be noted that each module in the code editing assistance tool in the embodiment of the present application corresponds one by one to each implementation step of the code editing assistance method in Example 1. Since a detailed description has been given in Example 1, some details not reflected in this embodiment can be referred to Example 1 and will not be repeated here.
[0058] Example 3
[0059] According to an embodiment of the present application, a computer program product is also provided. The computer program product includes a computer program, wherein when the computer program is executed by a processor, the code editing assistance method in Embodiment 1 is implemented.
[0060] According to an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the code editing assistance method in Example 1 by running the computer program.
[0061] According to an embodiment of the present application, a processor is also provided, which is used to run a computer program, wherein the code editing assistance method in Example 1 is executed when the computer program is running.
[0062] According to an embodiment of the present application, an electronic device is also provided, which includes: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the code editing assistance method in Example 1 through the computer program.
[0063] Specifically, when the computer program is running, the following steps are executed: obtaining a first code input by a target object in an interactive interface of an intelligent programming editor; using a retrieval enhancement generation model to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database; using a pre-trained intelligent agent decision model to analyze the code editing auxiliary information and generate adjustment suggestions for the first code; and displaying the adjustment suggestions in the interactive interface.
[0064] As an optional implementation, the electronic device may be in the form of a mobile terminal, a computer terminal or a similar computing device. Figure 3 FIG. 1 shows a hardware structure block diagram of an electronic device for implementing a code editing assistance method. Figure 3As shown, the electronic device 30 may include one or more (302a, 302b, ..., 302n are used to illustrate) processors 302 (the processor 302 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 304 for storing data, and a transmission device 306 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 3 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 3 More or fewer components as shown, or with Figure 3 Different configurations are shown.
[0065] It should be noted that the one or more processors 302 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the electronic device 30. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0066] The memory 304 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the code editing auxiliary method in the embodiment of the present application. The processor 302 executes various functional applications and data processing by running the software programs and modules stored in the memory 304, that is, realizing the vulnerability detection method of the above-mentioned application. The memory 304 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 304 may further include a memory remotely arranged relative to the processor 302, and these remote memories may be connected to the electronic device 30 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0067] The transmission device 306 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the electronic device 30. In one example, the transmission device 306 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 306 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0068] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 30 .
[0069] The serial numbers of the above embodiments are only for description and do not represent the advantages or disadvantages of the embodiments.
[0070] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0071] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0072] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0073] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0074] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.
[0075] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A code editing auxiliary method, characterized in that: include: Obtaining a first code input by a target object in an interactive interface of an intelligent programming editor; Retrieving and generating code editing auxiliary information associated with the first code from a preset retrieval database using a retrieval enhancement generation model; Analyzing the code editing auxiliary information using a pre-trained intelligent agent decision model to generate adjustment suggestions for the first code; The adjustment suggestion is displayed in the interactive interface.
2. The method according to claim 1, characterized in that The intelligent programming editor is Monaco-editor, the interactive interface is a human-computer interactive interface customized by the target object, and obtaining a first code input by the target object in the interactive interface of the intelligent programming editor includes: In response to an access request from the target object to access Monaco-editor, configuring a programming language environment corresponding to the access request, wherein Monaco-editor supports multi-language programming; A first code input by the target object in the interactive interface is received.
3. The method according to claim 1, characterized in that After obtaining the first code input by the target object in the interactive interface of the intelligent programming editor, the method further includes: Using the intelligent programming editor to perform syntax structure analysis on the first code to obtain a code analysis result, wherein the code analysis result includes at least one of the following: code elements and syntax tree structure of the first code; If the code element hits a preset metadata template, and / or the syntax tree structure hits a preset syntax template, code editing prompt information corresponding to the metadata template and / or the syntax template is directly displayed in the interactive interface; If the code element does not match the metadata template, and the syntax tree structure does not match the syntax template, continue to use the retrieval enhancement generation model to perform retrieval analysis on the first code.
4. The method according to claim 1, characterized in that Before using the retrieval enhancement generation model to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database, the method further includes: Configuring the search database and indexing the data in the search database, wherein the search database includes: historical codes and historical programming documents; Configuring model parameters of the search enhancement generation model, wherein the model parameters include: search scope, response time, accuracy and callback function; The retrieval algorithm of the retrieval enhancement generation model is configured as a retrieval algorithm based on vector space similarity.
5. The method according to claim 1, characterized in that: Retrieving and generating code editing auxiliary information associated with the first code from a preset retrieval database using a retrieval enhancement generation model, including: Preprocessing the first code using the intelligent programming editor to obtain a second code, wherein the preprocessing includes at least one of the following: code standardization, redundant code removal, error code correction, and semantic enhancement; The retrieval enhancement generation model is used to retrieve historical codes and historical programming documents associated with the second code from the retrieval database as the code editing auxiliary information.
6. The method according to claim 1, characterized in that The intelligent agent decision model is trained using the historical programming data of the target object, and the code editing auxiliary information is analyzed using the pre-trained intelligent agent decision model to generate adjustment suggestions for the first code, including: The code editing auxiliary information is analyzed using the intelligent agent decision model to generate the adjustment suggestions that match the programming style and habits of the target object, wherein the adjustment suggestions include: error correction suggestions for the first code and structural optimization suggestions for the first code.
7. The method according to claim 1, characterized in that After displaying the adjustment suggestion in the interactive interface, the method further includes: Acquiring feedback information input by the target object in the interactive interface regarding the adjustment suggestion; The agent decision model is trained again according to the feedback information.
8. A code editing auxiliary tool, characterized in that: include: Intelligent programming editor, retrieval enhancement generation model and agent decision model, among which, The intelligent programming editor is used to provide an interactive interface; obtain a first code input by a target object in the interactive interface; and display an adjustment suggestion for the first code generated by the intelligent agent decision model; The retrieval enhancement generation model is used to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database; The intelligent agent decision model is used to analyze the code editing auxiliary information and generate the adjustment suggestion.
9. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the code editing assistance method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: A memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the code editing assistance method according to any one of claims 1 to 7 through the computer program.
Citation Information
Patent Citations
Code editing method and device, server, user equipment and storage medium
CN112817583A
LLM-based programming auxiliary method
CN116974541A
Automatic interface code generation method and system based on AI and modular framework
CN117111916A
Program editor for integrating AI into PLC and integration method
CN117724390A
Database code editor processing method and device
CN117724694A
