Code editing auxiliary methods and tools
By integrating the code editing assistance tool of the retrieval enhancement generation model and the intelligent agent decision model, the problem of insufficient code logic understanding and real-time optimization suggestions of the code editor in the existing technology is solved, and more efficient programming efficiency and code quality are achieved.
Patent Information
- Application Number
- CN202411266324.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-09-10
AI Technical Summary
Existing code editors are inadequate in understanding code logic and providing real-time optimization suggestions. In particular, their performance analysis capabilities are limited in multi-language and big data processing scenarios, and they lack deep integration with large-scale machine learning models, resulting in limited programming efficiency and code quality.
It integrates the retrieval-enhanced generation model and the intelligent agent decision model, provides an interactive interface through the intelligent programming editor, obtains the code and uses the retrieval-enhanced generation model to retrieve code editing auxiliary information from the preset database, and uses the pre-trained intelligent agent decision model to analyze and generate adjustment suggestions, which are displayed in the interactive interface.
It improves programming efficiency, provides in-depth understanding of code logic and real-time optimization suggestions, reduces potential errors in the code, and meets users' efficient development needs in complex programming tasks.
Smart Images

Figure CN119201074B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer programming technology, 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, supporting a wide range of programming languages such as JavaScript, Python, and SQL. These tools are often based on open source projects such as Ace and Monaco Editor, providing basic features 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 features but also has a powerful plug-in support system that allows users to expand the editor's capabilities by installing different plug-ins. In addition, some editors integrate simple code auto-completion and prompt features, which mainly rely on static analysis and a library of predefined code snippets.
[0003] While existing code editors provide basic code completion and error detection capabilities, they fall short in understanding code logic and providing real-time optimization suggestions. This is particularly true for performance analysis in multi-language and big data processing scenarios. Furthermore, existing code editors lack deep integration with large-scale machine learning models, which limits their potential for providing advanced code suggestions and real-time assistance. Consequently, when faced with complex programming tasks, existing editors lack sufficient intelligent support, limiting programming efficiency and code quality. This is particularly true in big data and high-concurrency application scenarios, where the assistance features provided by traditional editors cannot meet the needs of efficient development.
[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. 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 entered 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 assistance information associated with the first code from a preset retrieval database; using a pre-trained intelligent agent decision model to analyze the code editing assistance information and 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, and the interactive interface is a human-computer interaction interface customized by the target object. Obtaining the first code entered by the target object in the interactive interface of the intelligent programming editor includes: responding to the target object's access request 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 entered 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 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; and 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 entered by a target object in the interactive interface; and 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 including: a computer program, wherein when the computer program is executed by a processor, the above-mentioned code editing assistance method is implemented.
[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, the first code entered by the target object in the interactive interface of the intelligent programming editor is obtained; 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 pre-trained intelligent 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 the retrieval enhancement generation model, the intelligent agent decision model and the intelligent programming editor, the 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 assistance 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 assistance method according to an embodiment of the present application;
[0019] Figure 2 is a schematic structural diagram of an optional code editing auxiliary tool according to an embodiment of the present application;
[0020] Figure 3 It is a schematic structural diagram 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 present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this 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 sequential order. 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 variations thereof 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 1FIG. 1 is a flow chart of a code editing auxiliary method provided according to an embodiment of the present application, such as Figure 1 As shown, the method includes 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: Analyze the code editing auxiliary information using the pre-trained intelligent agent decision model to generate adjustment suggestions for the first code;
[0029] Step S108: displaying adjustment suggestions in the interactive interface.
[0030] The following describes the various steps of the code editing assistance method in conjunction with a specific implementation process.
[0031] In order to improve programming efficiency and provide in-depth understanding of code logic and real-time optimization suggestions based on 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 enhancement generation model, an intelligent agent decision model and an intelligent programming editor, thereby providing a series of more advanced code assistance functions.
[0032] When choosing a foundational platform for an intelligent programming editor, consider Monaco Editor. Developed by Microsoft, Monaco Editor is a powerful code editor derived from the Visual Studio Code project. As a fully open-source solution, Monaco Editor runs in a web environment and provides a rich API to support features such as syntax highlighting, code completion, code navigation, and code formatting. It supports multiple programming languages, including JavaScript, TypeScript, Python, and C++, and can load language services based on the desired language.
[0033] The retrieval-enhanced generative model combines retrieval and generation techniques and is specifically designed for understanding and generating natural language text. It can search external authoritative knowledge bases before generating content, thereby generating more accurate and comprehensive information. Compared to traditional generative models that rely solely on internal model training data, the retrieval-enhanced generative model can provide a wider range of information sources and higher accuracy. In the application of this invention, the retrieval-enhanced generative model is integrated into an intelligent programming editor, capable of providing relevant and timely data support based on real-time changes in the programming environment.
[0034] In computer science and artificial intelligence, an agent is an automated entity capable of performing tasks and making decisions. In software engineering, agents are typically based on large language models and possess the ability to plan, memorize, and use tools, all while independently completing tasks. In a specific implementation of the present invention, the agent decision model, based on information provided by a retrieval-enhanced generative model, analyzes potential problems in the current programming task and generates specific code optimization suggestions and error correction solutions.
[0035] The specific implementation process of code editing using the above-mentioned retrieval-enhanced generation model, agent decision model, and intelligent programming editor is as follows:
[0036] First, the target user accesses the Monaco-editor-based intelligent programming editor through a web interface and sets up the desired programming language environment. The intelligent programming editor also features a customized human-computer interaction interface (HUI) for the specific target user. When the target user requests access to the Monaco-editor, the system responds and configures the corresponding programming language environment. The system then receives the first code entered by the target user in this customized interface.
[0037] Optionally, after obtaining the first code entered by the target object in the interactive interface of the intelligent programming editor, the intelligent programming editor can be used to perform a grammatical structure analysis on the first code to obtain a code analysis result, thereby identifying potential errors and optimization points. The code analysis result includes at least one of the following: code elements and syntax tree structure of the first code; if the code elements match a preset metadata template, or the syntax tree structure matches a preset syntax template, 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 match the metadata template, and the syntax tree structure does not match the syntax template, the first code is further searched and analyzed using the retrieval enhancement generation model.
[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 can 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.
[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 adopted: 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, error 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 intelligent agent decision model to analyze the above-mentioned code editing auxiliary information, the intelligent agent decision model needs to be trained first. During training, historical programming data of the target object needs to be collected first. This data may include previous code snippets, comments, version control history, code review feedback, and any other information related to programming habits and styles. 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 historical programming data. The goal of 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 (using a reward mechanism to encourage the generation of suggestions that are more in line with the programming style) are used. After model training is complete, its performance needs to be evaluated using unseen datasets. This can be accomplished in a variety of ways, such as using cross-validation techniques to ensure that the model generalizes to new data. Evaluation metrics may include accuracy, recall, F1 score, or other metrics appropriate to the task. Once the model achieves a satisfactory level of performance, it can be deployed to the intelligent programming editor. The model can also continuously learn and self-improve based on interaction data from the target object during use, adapting to the user's latest habits.
[0041] Optionally, after obtaining the aforementioned agent decision model, the code editing auxiliary information is combined with the context of the current user code, analyzed using the model, and adjustment suggestions for the first code are generated, i.e., adjustment suggestions that match the programming style and habits of the target user. These suggestions include, but are not limited to, error correction suggestions for the first code, structural optimization suggestions for the first code, and display of adjustment suggestions for the first code in the interactive interface of the intelligent programming editor.
[0042] After displaying the suggested adjustments in the interactive interface, an interactive feedback loop can be implemented. Specifically, feedback regarding the suggested adjustments is obtained from the target user in the interactive interface. This feedback can include acceptance, rejection, or further modification suggestions. The system collects user feedback and records it as new training data. This newly collected data is then used to retrain or fine-tune the model to better adapt to user preferences and specific requirements. This process is repeated, forming a closed-loop learning mechanism. Through continuous feedback and training, the intelligent agent decision model can more accurately respond to users' specific needs, thereby improving coding efficiency and code quality.
[0043] In an embodiment of the present application, the first code entered by the target object in the interactive interface of the intelligent programming editor is obtained; 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 pre-trained intelligent 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 the retrieval enhancement generation model, the intelligent agent decision model and the intelligent programming editor, the 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 assistance 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 auxiliary tool for implementing the code editing auxiliary method in embodiment 1 is also provided. Figure 2 As shown, the code editing auxiliary tool includes at least: 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 configured to provide an interactive interface; obtain a first code input by a target object in the interactive interface; and display adjustment suggestions for the first code generated by the intelligent agent decision model;
[0047] a retrieval enhancement generation model 22, configured to retrieve and generate 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 following describes the functions of each module of the code editing assistance tool in combination with the specific implementation process.
[0050] First, the target user accesses the Monaco-editor-based intelligent programming editor through a web interface and sets up the desired programming language environment. The intelligent programming editor also features a customized human-computer interaction interface (HUI) for the specific target user. When the target user requests access to the Monaco-editor, the system responds and configures the corresponding programming language environment. The system then receives the first code entered by the target user in this customized 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 a grammatical structure analysis on the first code to obtain a code analysis result, thereby identifying potential errors and optimization points. The code analysis result includes at least one of the following: code elements and syntax tree structure of the first code; if the code elements hit a preset metadata template, or the syntax tree structure hits a preset syntax template, 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 first code continues to be searched and analyzed using the retrieval enhancement generation model.
[0052] 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 TF-ID or BERT embedding to evaluate the similarity between queries and documents. As another optional implementation method, 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 adopted: 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, error 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 intelligent agent decision model to analyze the above-mentioned code editing auxiliary information, the intelligent agent decision model needs to be trained first. During training, historical programming data of the target object needs to be collected first. This data may include previous code snippets, comments, version control history, code review feedback, and any other information related to programming habits and styles. 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 historical programming data. The goal of 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 (using a reward mechanism to encourage the generation of suggestions that are more in line with the programming style) are used. After model training is complete, its performance needs to be evaluated using unseen datasets. This can be accomplished in a variety of ways, such as using cross-validation techniques to ensure that the model generalizes to new data. Evaluation metrics may include accuracy, recall, F1 score, or other metrics appropriate to the task. Once the model achieves a satisfactory level of performance, it can be deployed to the intelligent programming editor. The model can also continuously learn and self-improve based on interaction data from the target object during use, adapting to the user's latest habits.
[0055] Optionally, after obtaining the aforementioned agent decision model, the code editing auxiliary information is combined with the context of the current user code, analyzed using the model, and adjustment suggestions for the first code are generated, i.e., adjustment suggestions that match the programming style and habits of the target user. These suggestions include, but are not limited to, error correction suggestions for the first code, structural optimization suggestions for the first code, and display of adjustment suggestions for the first code in the interactive interface of the intelligent programming editor.
[0056] After displaying the suggested adjustments in the intelligent programming editor's interactive interface, an interactive feedback loop can be implemented. Specifically, feedback regarding the suggested adjustments is obtained from the target user in the interactive interface. This feedback can include acceptance, rejection, or further modification suggestions. The system collects user feedback and records it as new training data. This newly collected data is then used to retrain or fine-tune the model to better adapt to the user's preferences and specific requirements. This process is repeated, forming a closed-loop learning mechanism. Through continuous feedback and training, the intelligent agent decision model can more accurately respond to the user's specific needs, 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-to-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 elaborated here.
[0058] Example 3
[0059] According to an embodiment of the present application, a computer program product is further provided, which includes a computer program, wherein when the computer program is executed by a processor, the code editing assistance method in Example 1 is implemented.
[0060] According to an embodiment of the present application, a non-volatile storage medium is further 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 further 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 further 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 (illustrated as 302a, 302b, ..., 302n in the figure) 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 will 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 than shown, or with Figure 3 Different configurations 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 circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the electronic device 30. As described in the embodiments of the present application, the data processing circuitry serves 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, implementing 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 located 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. Specific examples of the aforementioned network may include a wireless network provided by the communications provider of the electronic device 30. In one embodiment, the transmission device 306 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one embodiment, the transmission device 306 may 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 for description only 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 focus. 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 exemplary. For example, the division of units can be a logical function division. In actual implementation, there may be other division methods, such as 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] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected to achieve the purpose of the present embodiment according to actual needs.
[0073] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or 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 is essentially 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, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments 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, magnetic disk or optical disk and other media that can store program code.
[0075] The above is only a preferred embodiment 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 the first code entered by the target object in the interactive interface of the intelligent programming editor; Performing a syntax structure analysis on the first code using the intelligent programming editor to obtain a code analysis result, wherein the code analysis result includes at least one of the following: code elements and a syntax tree structure of the first code; If the code element matches a preset metadata template, and / or the syntax tree structure matches a preset syntax template, code editing prompt information corresponding to the metadata template and / or the syntax template is 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, using a retrieval enhancement generation model to retrieve and generate code editing auxiliary information associated with the first code from a preset retrieval database, wherein the retrieval enhancement generation model is integrated into the intelligent programming editor, and the retrieval enhancement generation model provides relevant and timely data support according to real-time changes in the programming environment; Analyzing the code editing auxiliary information using a pre-trained intelligent agent decision model to generate adjustment suggestions for the first code, wherein the intelligent agent decision model analyzes problems existing in the current programming task based on the code editing auxiliary information provided by the retrieval-enhanced generation model and generates specific code optimization suggestions and error correction solutions based on the problems; Displaying the adjustment suggestion in the interactive interface; Wherein, 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 the 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; wherein the machine learning technology optimization algorithm is used to adjust the model parameters in real time to adapt to the needs of different query types and target objects.
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 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.
4. The method according to claim 1, wherein The intelligent agent decision model is trained using historical programming data of the target object. 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.
5. The method according to claim 1, characterized in that 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; The agent decision model is trained again based on the feedback information.
6. 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 configured to provide an interactive interface; obtain a first code input by a target object in the interactive interface; 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: a code element and a grammatical tree structure of the first code; if the code element matches a preset metadata template and / or the grammatical tree structure matches a preset grammatical template, display code editing prompt information corresponding to the metadata template and / or the grammatical template in the interactive interface; and further 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 auxiliary information associated with the first code from a preset retrieval database when the code element does not hit the metadata template and the syntax tree structure does not hit the syntax template, wherein the retrieval enhancement generation model is integrated into the intelligent programming editor, and the retrieval enhancement generation model provides relevant and timely data support according to the real-time changes of the programming environment. Before using the retrieval enhancement generation model to retrieve and generate the code editing auxiliary information associated with the first code from the preset retrieval database, the retrieval database is configured and the data in the retrieval database is indexed, wherein the retrieval database includes: historical codes and historical programming documents; the model parameters of the retrieval enhancement generation model are configured, wherein the model parameters include: retrieval 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; wherein the machine learning technology optimization algorithm is used to adjust the model parameters in real time to adapt to the needs of different query types and target objects; The intelligent agent decision model is used to analyze the code editing auxiliary information and generate the adjustment suggestions, wherein the intelligent agent decision model analyzes the problems existing in the current programming task based on the code editing auxiliary information provided by the retrieval enhancement generation model, and generates specific code optimization suggestions and error correction solutions based on the problems.
7. 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 5 is implemented.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the code editing assistance method according to any one of claims 1 to 5 through the computer program.
Citation Information
Patent Citations
Program editor for integrating AI into PLC and integration method
CN117724390A
Database code editor processing method and device
CN117724694A
Code completion method and device, electronic equipment and medium
CN118227106A
Code prompting method
CN118444895A