[go: up one dir, main page]

CN119201074A - Code editing auxiliary methods and tools - Google Patents

Code editing auxiliary methods and tools Download PDF

Info

Publication number
CN119201074A
CN119201074A CN202411266324.XA CN202411266324A CN119201074A CN 119201074 A CN119201074 A CN 119201074A CN 202411266324 A CN202411266324 A CN 202411266324A CN 119201074 A CN119201074 A CN 119201074A
Authority
CN
China
Prior art keywords
code
programming
retrieval
interactive interface
model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202411266324.XA
Other languages
Chinese (zh)
Inventor
刘青松
阮宜龙
张云龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Artificial Intelligence Technology Beijing Co ltd
Original Assignee
China Telecom Artificial Intelligence Technology Beijing Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Artificial Intelligence Technology Beijing Co ltd filed Critical China Telecom Artificial Intelligence Technology Beijing Co ltd
Priority to CN202411266324.XA priority Critical patent/CN119201074A/en
Publication of CN119201074A publication Critical patent/CN119201074A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

本申请公开了一种代码编辑辅助方法及工具。其中,该方法包括:获取目标对象在智能编程编辑器的交互界面中输入的第一代码;利用检索增强生成模型从预设的检索数据库中检索并生成与第一代码关联的代码编辑辅助信息;利用预训练的智能体决策模型对代码编辑辅助信息进行分析,生成针对第一代码的调整建议;在交互界面中展示调整建议。本申请解决了相关代码编辑辅助工具只能提供静态代码检测功能,难以满足用户需求的技术问题。

The present application discloses a code editing assistance method and tool. The method includes: 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 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. 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.

Description

Code editing auxiliary method and tool
Technical Field
The application relates to the technical field of computer programming, in particular to a code editing auxiliary method and a tool.
Background
In the field of code editors, the prior art encompasses a variety of online and offline editing tools, supporting a wide range of programming languages such as JavaScript, python, SQL, and the like. These tools typically provide basic functions such as code highlighting, grammar checking, code folding, etc., based on open source items such as Ace and Monaco Editor. For example, visual Studio Code uses Monaco Editor as its core component, not only providing advanced code editing functionality, but also having a powerful plug-in support system that allows users to extend the capabilities of the editor by installing different plug-ins. Furthermore, the partial editor integrates simple code autocompletion and hinting functions that rely primarily on static analysis and a predefined library of code fragments.
Existing code editors, while providing basic code auto-completion and error detection functionality, suffer from deficiencies in terms of code logic understanding and real-time optimization suggestions, especially in multi-language and large data processing scenarios. Furthermore, prior art code editors lack deep integration with large scale machine learning models, which limits the potential of editors in providing advanced code suggestions and real-time assistance. Therefore, in the face of complex programming tasks, the existing editors lack sufficient intelligent support, so that the programming efficiency and the code quality are limited, and particularly in the application scenarios of big data and high concurrency, the auxiliary functions provided by the traditional editors cannot meet the requirement of efficient development.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the application provides a code editing auxiliary method and a code editing auxiliary tool, which at least solve the technical problem that the related code editing auxiliary tool can only provide a static code detection function and is difficult to meet the requirements of users.
According to one aspect of the embodiment of the application, a code editing auxiliary method is provided, which comprises the steps of 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 by utilizing a retrieval enhancement generation model, analyzing the code editing auxiliary information by utilizing a pre-trained agent decision model to generate an adjustment suggestion for the first code, and displaying the adjustment suggestion in the interactive interface.
Optionally, the intelligent programming editor is Monaco-editor, the interactive interface is a human-computer interactive interface customized by the target object, and the method comprises the steps of responding to an access request of the target object for accessing Monaco-editor, configuring a programming language environment corresponding to the access request, wherein Monaco-editor supports multi-language programming, and receiving the first code input by the target object in the interactive interface.
Optionally, after the first code input by the target object in the interactive interface of the intelligent programming editor is acquired, the method further comprises the steps of carrying out grammar structure analysis on the first code by utilizing the intelligent programming editor to obtain a code analysis result, wherein the code analysis result comprises at least one of code elements and grammar tree structures of the first code, if the code elements hit a preset metadata template and/or the grammar tree structures hit the preset grammar template, code editing prompt information corresponding to the metadata template and/or the grammar template is directly displayed in the interactive interface, and if the code elements miss the metadata template and the grammar tree structures miss the grammar template, the first code is continuously searched and analyzed by utilizing the search enhancement generation model.
Optionally, before the retrieval enhancement generation model is utilized to retrieve and generate the code editing auxiliary information related to the first code from a preset retrieval database, the method further comprises configuring the retrieval database and indexing data in the retrieval database, wherein the retrieval database comprises historical codes and historical programming documents, configuring model parameters of the retrieval enhancement generation model, the model parameters comprise a retrieval range, response time, accuracy and a callback function, and configuring a retrieval algorithm of the retrieval enhancement generation model to be a retrieval algorithm based on vector space similarity.
Optionally, the code editing auxiliary information related to the first code is searched and generated from a preset search database by using a search enhancement generation model, and the method comprises the steps of preprocessing the first code by using an intelligent programming editor to obtain a second code, wherein the preprocessing comprises at least one of code standardization, redundant code removal, error code correction and semantic enhancement, and the history code and history programming document related to the second code are searched from the search database by using the search enhancement generation model as the code editing auxiliary information.
Optionally, the agent decision model is obtained by training historical programming data of the target object, the pre-trained agent decision model is used for analyzing the code editing auxiliary information to generate an adjustment suggestion for the first code, the adjustment suggestion comprises the step of analyzing the code editing auxiliary information by the agent decision model to generate an adjustment suggestion matched with the programming style and habit of the target object, wherein the adjustment suggestion comprises an error modification suggestion for the first code and a structural optimization suggestion for the first code.
Optionally, after the adjustment suggestion is displayed in the interactive interface, the method further comprises the steps of obtaining feedback information aiming at the adjustment suggestion and input by the target object in the interactive interface, and training the agent decision model again according to the feedback information.
According to another aspect of the embodiment of the application, a code editing auxiliary tool is provided, which comprises an intelligent programming editor, a search enhancement generation model and an agent decision model, wherein the intelligent programming editor is used for providing an interactive interface, acquiring a first code input by a target object in the interactive interface, displaying an adjustment suggestion for the first code generated by the agent decision model, the search enhancement generation model is used for searching and generating code editing auxiliary information related to the first code from a preset search database, and the agent decision model is used for analyzing the code editing auxiliary information to generate the adjustment suggestion.
According to another aspect of the embodiments of the present application, there is also provided a computer program product comprising a computer program, wherein the computer program implements the above-mentioned code editing assistance method when executed by a processor.
According to another aspect of the embodiment of the present application, there is also provided an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described code editing assistance method by the computer program.
In the embodiment of the application, a first code input by a target object in an interactive interface of an intelligent programming editor is acquired, code editing auxiliary information related to the first code is searched and generated from a preset search database by utilizing a search enhancement generation model, the code editing auxiliary information is analyzed by utilizing a pre-trained agent decision model to generate an adjustment suggestion for the first code, and the adjustment suggestion is displayed in the interactive interface. By integrating the retrieval enhancement generation model, the agent decision model and the intelligent programming editor, the embodiment of the application can provide deep code logic understanding and real-time optimization suggestions according to the current code context, which is beneficial to improving the programming efficiency and effectively reducing potential errors in the code. The application solves the technical problems that the related code editing auxiliary tool only can provide a static code detection function and is difficult to meet the requirements of users.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a flow chart of an alternative code editing assistance method according to an embodiment of the application;
FIG. 2 is a schematic diagram of the structure of an alternative code editing aid in accordance with an embodiment of the present application;
fig. 3 is a schematic structural view of an alternative electronic device according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims and drawings of the present application are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
According to an embodiment of the present application, there is provided a code editing assistance method, it being noted that the steps shown in the flowcharts of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that herein.
Fig. 1 is a flow chart of a code editing assisting method according to an embodiment of the present application, as shown in fig. 1, the method includes the following steps:
step S102, a first code input by a target object in an interactive interface of an intelligent programming editor is obtained;
Step S104, searching and generating code editing auxiliary information associated with the first code from a preset search database by using a search enhancement generation model;
step S106, analyzing the code editing auxiliary information by using a pre-trained agent decision model to generate an adjustment suggestion for the first code;
step S108, displaying the adjustment suggestion in the interactive interface.
The steps of the code editing assistance method will be described below with reference to specific embodiments.
In order to improve programming efficiency and provide deep code logic understanding and real-time optimization suggestions according to the current code context in the programming process, the application provides a code editing auxiliary tool according to a code editing auxiliary method, and the code editing auxiliary tool integrates a retrieval enhancement generation model, an agent decision model and an intelligent programming editor, thereby providing a series of higher-level code auxiliary functions.
At the time of selecting the base platform of the intelligent programming editor, monaco Editor may be selected. Monaco Editor is a powerful code editor developed by microsoft, which originates from the Visual Studio Code project. As a fully open source solution Monaco Editor can run in a web page environment and provide rich APIs to support a variety of functions such as grammar highlighting, code complementation, code navigation and code formatting, etc. It can support multiple programming languages, such as JavaScript, typeScript, python and c++, etc., and can load corresponding language services according to the language that needs to be supported.
The retrieval enhancement generation model integrates two technical means of retrieval and generation, and is specially used for understanding and generating natural language text design. It can search the external authoritative knowledge base before generating the content, thereby generating more accurate and comprehensive information. The search enhancement generation model can provide a wider source of information and higher accuracy than a conventional generation model that relies solely on training data within the model. In the application of the invention, the retrieval enhancement generation model is integrated into an intelligent programming editor, and can provide relevant and timely data support according to the real-time change of the programming environment.
Agents in the fields of computer science and artificial intelligence refer to automated entities that are capable of performing tasks and making decisions. In software engineering, an agent is usually based on a large language model, has the capabilities of planning, memorizing and using tools, and can independently complete tasks. In a specific implementation of the invention, the agent decision model is able to analyze problems that may exist in the current programming task based on information provided by the search enhancement generation model, and generate specific code optimization suggestions and error correction schemes accordingly.
The specific implementation flow of code editing by using the retrieval enhancement generation model, the agent decision model and the intelligent programming editor is as follows:
First, the target object accesses the Monaco-editor-based intelligent programming editor via the Web interface and sets the desired programming language environment, the intelligent programming editor is further provided with a man-machine interface customized for the specific target object, and when the target object initiates a request for accessing Monaco-editor, the system responds to the request and configures the corresponding programming language environment. The system then receives a first code entered by the target object in this custom interactive interface.
Optionally, after the first code input by the target object in the interactive interface of the intelligent programming editor is acquired, the intelligent programming editor may be utilized to perform syntax structure analysis on the first code, so as to obtain a code analysis result, thereby enabling identification of potential errors and optimization points. The code analysis result comprises at least one of a code element and a grammar tree structure of a first code, wherein if the code element hits a preset metadata template or the grammar tree structure hits the preset grammar template, code editing prompt information corresponding to the metadata template or the grammar template is directly displayed in an interactive interface, and if the code element does not hit the metadata template and the grammar tree structure does not hit the grammar template, the first code is continuously searched and analyzed by using a search enhancement generation model.
In view of the nature of the programming language and the type of common programming problems, a suitable search enhancement generation model framework needs to be selected, in order to be able to handle a large amount of text data and to optimize to identify key structures and patterns in the programming language, the search enhancement generation model may also be configured prior to retrieving and generating code editing assistance information associated with the first code from a pre-set search database using the search enhancement generation model, by configuring the search database and indexing the data in the search database for quick retrieval, wherein the search database comprises historical codes, historical programming documents to ensure that the data covers a plurality of programming languages and common programming scenarios, by configuring model parameters of the search enhancement generation model, wherein the model parameters comprise search range, response time, accuracy and callback functions to ensure quick and accurate provision of programming suggestions in a real-time environment, by configuring a search algorithm based on vector space similarity, e.g. using a search algorithm such as TF-ID (FTerm Frequency-Inverse Document Frequency, frequency-inverse document frequency) or BERT (Bidirectional Encoder Representations from Transformers, bi-directional transform encoder characterization) to assess similarity between queries and documents. As another alternative implementation, the algorithm can be optimized through a machine learning technology, and algorithm parameters can be adjusted in real time to adapt to different query types and requirements of target objects.
After the above configuration of the search enhancement generation model is completed, the model is utilized to search and generate code editing auxiliary information related to the first code from a preset search database, and the steps of firstly preprocessing the first code by using an intelligent programming editor to obtain a second code, wherein the preprocessing comprises at least one of code standardization, redundant code removal, error code correction and semantic enhancement so as to improve the relevance and accuracy of the search, and then the search enhancement generation model is utilized to search historical codes and historical programming documents related to the second code from the search database as code editing auxiliary information, which are used as a basis for providing code editing suggestions.
Optionally, before the analysis of the above-mentioned code editing assistance information with the agent decision model, the agent decision model needs to be trained, and when training, first, historical programming data of the target object needs to be collected, where the data may include previous code segments, comments, version control histories, code review feedback, and any other data related to programming habits and styles, and the collected data is cleaned and preprocessed for training the model, which may include removing unnecessary parts, standardized formats, extracting features, etc., redefining features that help the model understand programming style and habits, such as code structure, common design patterns, common class libraries, code annotation styles, etc., and after selecting the model architecture, the selected model architecture is trained using the historical programming data, the training is aimed at allowing the modeler to recognize the programming habits of the specific target object, and generating reasonable code adjustment suggestions based on those habits. During training, supervised learning methods (e.g., if the historical data contains explicit improvement suggestions) or reinforcement learning methods (encouraging the generation of more programming style-compliant suggestions via a rewards mechanism) may be used. After model training is complete, the performance of the model needs to be assessed using the unseen dataset, which can be done in a number of ways, such as using cross-validation techniques to ensure that the model can be generalized to new data, the assessment metrics may include accuracy, recall, F1 score, or other metrics suitable for the task. Once the model reaches a satisfactory level of performance, it can be deployed into an intelligent programming editor. The model can also continuously learn and self-improve through the interactive data of the target object in the using process so as to adapt to the latest habit of the user.
Optionally, after the agent decision model described above is obtained, the code editing assistance information is combined with the context of the current user code, analyzed by the model, and adjustment suggestions for the first code, i.e. adjustment suggestions matching the programming style and habit of the target object, are generated. These suggestions include, but are not limited to, error modification suggestions for the first code, structural optimization suggestions for the first code, and adjustment suggestions for the first code presented by the interactive interface of the intelligent programming editor.
After the adjustment suggestion is displayed in the interactive interface, an interactive feedback loop may be performed, specifically, feedback information about the adjustment suggestion, which is input by the target object in the interactive interface, is obtained, where the feedback may be acceptance, rejection, or further modification suggestion of the suggestion. The system collects feedback information of the user, records the feedback information as new training data, and retrains or fine-tunes the model by using the new collected data, so that the model can better adapt to the preference and specific requirements of the user, and the process is repeated to form a closed-loop learning mechanism. Through continuous feedback and training, the agent decision model can more accurately respond to the specific requirements of users, thereby improving the coding efficiency and the code quality.
In the embodiment of the application, a first code input by a target object in an interactive interface of an intelligent programming editor is acquired, code editing auxiliary information related to the first code is searched and generated from a preset search database by utilizing a search enhancement generation model, the code editing auxiliary information is analyzed by utilizing a pre-trained agent decision model to generate an adjustment suggestion for the first code, and the adjustment suggestion is displayed in the interactive interface. By integrating the retrieval enhancement generation model, the agent decision model and the intelligent programming editor, the embodiment of the application can provide deep code logic understanding and real-time optimization suggestions according to the current code context, which is beneficial to improving the programming efficiency and effectively reducing potential errors in the code. The application solves the technical problems that the related code editing auxiliary tool only can provide a static code detection function and is difficult to meet the requirements of users.
Example 2
There is also provided a code editing aid for implementing the code editing aid method of embodiment 1 according to an embodiment of the present application, as shown in fig. 2, the code editing aid at least including an intelligent programming editor 21, a retrieval enhancement generation model 22, and an agent decision model 23, wherein:
the intelligent programming editor 21 is used for providing an interactive interface, acquiring a first code input by a target object in the interactive interface, and displaying an adjustment suggestion for the first code generated by an agent decision model;
A search enhancement generation model 22 for searching from a preset search database and generating code editing auxiliary information associated with the first code;
And the agent decision model 23 is used for analyzing the code editing auxiliary information and generating adjustment suggestions.
The functions of each module of the code editing aid will be described below in connection with specific implementation procedures.
First, the target object accesses the Monaco-editor-based intelligent programming editor via the Web interface and sets the desired programming language environment, the intelligent programming editor is further provided with a man-machine interface customized for the specific target object, and when the target object initiates a request for accessing Monaco-editor, the system responds to the request and configures the corresponding programming language environment. The system then receives a first code entered by the target object in this custom interactive interface.
Optionally, after the intelligent programming editor obtains the first code input by the target object in the interactive interface of the intelligent programming editor, the intelligent programming editor may be utilized to perform syntax structure analysis on the first code to obtain a code analysis result, so as to identify potential errors and optimization points. The code analysis result comprises at least one of a code element and a grammar tree structure of a first code, wherein if the code element hits a preset metadata template or the grammar tree structure hits the preset grammar template, code editing prompt information corresponding to the metadata template or the grammar template is directly displayed in an interactive interface, and if the code element does not hit the metadata template and the grammar tree structure does not hit the grammar template, the first code is continuously searched and analyzed by using a search enhancement generation model.
In view of the nature of the programming language and the type of common programming problems, a suitable search enhancement generation model framework needs to be selected, in order to be able to handle a large amount of text data and to optimize to identify key structures and patterns in the programming language, the search enhancement generation model may also be configured prior to retrieving and generating code editing assistance information associated with the first code from a pre-set search database using the search enhancement generation model, by configuring the search database and indexing the data in the search database for quick retrieval, wherein the search database comprises historical codes, historical programming documents to ensure that the data covers a plurality of programming languages and common programming scenarios, by configuring model parameters of the search enhancement generation model, wherein the model parameters comprise search range, response time, accuracy and callback functions to ensure quick and accurate provision of programming suggestions in a real-time environment, by configuring a search algorithm based on vector space similarity, e.g. using a search algorithm such as TF-ID or BERT embedding to evaluate similarity between queries and documents. As another alternative implementation, the algorithm can be optimized through a machine learning technology, and algorithm parameters can be adjusted in real time to adapt to different query types and requirements of target objects.
After the above configuration of the search enhancement generation model is completed, the model is utilized to search and generate code editing auxiliary information related to the first code from a preset search database, and the steps of firstly preprocessing the first code by using an intelligent programming editor to obtain a second code, wherein the preprocessing comprises at least one of code standardization, redundant code removal, error code correction and semantic enhancement so as to improve the relevance and accuracy of the search, and then the search enhancement generation model is utilized to search historical codes and historical programming documents related to the second code from the search database as code editing auxiliary information, which are used as a basis for providing code editing suggestions.
Optionally, before the analysis of the above-mentioned code editing assistance information with the agent decision model, the agent decision model needs to be trained, and when training, first, historical programming data of the target object needs to be collected, where the data may include previous code segments, comments, version control histories, code review feedback, and any other data related to programming habits and styles, and the collected data is cleaned and preprocessed for training the model, which may include removing unnecessary parts, standardized formats, extracting features, etc., redefining features that help the model understand programming style and habits, such as code structure, common design patterns, common class libraries, code annotation styles, etc., and after selecting the model architecture, the selected model architecture is trained using the historical programming data, the training is aimed at allowing the modeler to recognize the programming habits of the specific target object, and generating reasonable code adjustment suggestions based on those habits. During training, supervised learning methods (e.g., if the historical data contains explicit improvement suggestions) or reinforcement learning methods (encouraging the generation of more programming style-compliant suggestions via a rewards mechanism) may be used. After model training is complete, the performance of the model needs to be assessed using the unseen dataset, which can be done in a number of ways, such as using cross-validation techniques to ensure that the model can be generalized to new data, the assessment metrics may include accuracy, recall, F1 score, or other metrics suitable for the task. Once the model reaches a satisfactory level of performance, it can be deployed into an intelligent programming editor. The model can also continuously learn and self-improve through the interactive data of the target object in the using process so as to adapt to the latest habit of the user.
Optionally, after the agent decision model described above is obtained, the code editing assistance information is combined with the context of the current user code, analyzed by the model, and adjustment suggestions for the first code, i.e. adjustment suggestions matching the programming style and habit of the target object, are generated. These suggestions include, but are not limited to, error modification suggestions for the first code, structural optimization suggestions for the first code, and adjustment suggestions for the first code presented by the interactive interface of the intelligent programming editor.
After the adjustment suggestion is displayed in the interactive interface of the intelligent programming editor, an interactive feedback loop may also be performed, specifically, feedback information for the adjustment suggestion, which is input by the target object in the interactive interface, may be obtained, where the feedback may be an acceptance, rejection, or further modification suggestion of the suggestion. The system collects feedback information of the user, records the feedback information as new training data, and retrains or fine-tunes the model by using the new collected data, so that the model can better adapt to the preference and specific requirements of the user, and the process is repeated to form a closed-loop learning mechanism. Through continuous feedback and training, the agent decision model can more accurately respond to the specific requirements of users, thereby improving the coding efficiency and the code quality.
It should be noted that, each module in the code editing auxiliary tool in the embodiment of the present application corresponds to each implementation step of the code editing auxiliary method in embodiment 1 one by one, and since the detailed description has been already made in embodiment 1, some details not shown in the embodiment may refer to embodiment 1, and will not be repeated here.
Example 3
According to an embodiment of the present application, there is also provided a computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the code editing assistance method in embodiment 1.
According to an embodiment of the present application, there is also provided a nonvolatile storage medium including a stored computer program, wherein a device in which the nonvolatile storage medium is located executes the code editing assistance method in embodiment 1 by running the computer program.
According to an embodiment of the present application, there is also provided a processor for running a computer program, wherein the computer program when run performs the code editing assistance method in embodiment 1.
There is also provided, according to an embodiment of the present application, an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the code editing assistance method in embodiment 1 by the computer program.
The method comprises the steps of obtaining a first code input by a target object in an interactive interface of an intelligent programming editor, searching and generating code editing auxiliary information associated with the first code from a preset search database by utilizing a search enhancement generation model, analyzing the code editing auxiliary information by utilizing a pre-trained agent decision model to generate an adjustment suggestion for the first code, and displaying the adjustment suggestion in the interactive interface.
As an alternative embodiment, the electronic device may be in the form of a mobile terminal, a computer terminal or similar computing device. Fig. 3 shows a block diagram of a hardware structure of an electronic device for implementing the code editing assistance method. As shown in fig. 3, the electronic device 30 may include one or more processors 302 (shown in the figures as 302a, 302b, 302 n), a memory 304 for storing data, and a transmission means 306 for communication functions (the processor 302 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA or the like). Among other things, 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 appreciated by those of ordinary skill in the art that the configuration shown in fig. 3 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, electronic device 30 may also include more or fewer components than shown in FIG. 3, or have a different configuration than shown in FIG. 3.
It should be noted that the one or more processors 302 and/or other data processing circuits described above may be referred to generally herein as "data processing circuits. The data processing circuit may be embodied in whole or in part in software, hardware, firmware, or any other combination. Furthermore, the data processing circuitry may be a single stand-alone processing module, or incorporated in whole or in part into any of the other elements in electronic device 30. As referred to in embodiments of the application, the data processing circuit acts as a processor control (e.g., selection of the path of the variable resistor termination connected to the interface).
The memory 304 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the code editing assistance method in the embodiment of the present application, and the processor 302 executes the software programs and modules stored in the memory 304, thereby executing various functional applications and data processing, that is, implementing the vulnerability detection method of the application program. Memory 304 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 304 may further include memory remotely located relative to processor 302, which may be connected to electronic device 30 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 306 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of electronic device 30. In one example, the transmission means 306 comprises a network adapter (Network Interface Controller, NIC) that can be connected to other network devices via a base station to communicate with the internet. In one example, the transmission device 306 may be a Radio Frequency (RF) module for communicating with the internet wirelessly.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the electronic device 30.
The foregoing embodiment numbers are merely for the purpose of description and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of units may be a logic function division, and there may be another division manner in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present application. The storage medium includes a U disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, etc. which can store the program code.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.

Claims (10)

1.一种代码编辑辅助方法,其特征在于,包括:1. A code editing auxiliary method, characterized by comprising: 获取目标对象在智能编程编辑器的交互界面中输入的第一代码;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.根据权利要求1所述的方法,其特征在于,所述智能编程编辑器为Monaco-editor,所述交互界面为所述目标对象自定义的人机交互界面,获取目标对象在智能编程编辑器的交互界面中输入的第一代码,包括:2. The method according to claim 1, wherein the intelligent programming editor is Monaco-editor, the interactive interface is a human-computer interactive interface customized by the target object, and obtaining the first code input by the target object in the interactive interface of the intelligent programming editor comprises: 响应于所述目标对象访问Monaco-editor的访问请求,配置与所述访问请求对应的编程语言环境,其中,Monaco-editor支持多语言编程;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.根据权利要求1所述的方法,其特征在于,在获取目标对象在智能编程编辑器的交互界面中输入的第一代码之后,所述方法还包括: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 comprises: 利用所述智能编程编辑器对所述第一代码进行语法结构分析,得到代码分析结果,其中,所述代码分析结果中包括以下至少之一:所述第一代码的代码元素、语法树结构;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.根据权利要求1所述的方法,其特征在于,在利用检索增强生成模型从预设的检索数据库中检索并生成与所述第一代码关联的代码编辑辅助信息之前,所述方法还包括:4. The method according to claim 1, characterized in that before using the retrieval enhancement generation model to retrieve and generate the code editing auxiliary information associated with the first code from a preset retrieval database, the method further comprises: 配置所述检索数据库,并对所述检索数据库中的数据进行索引化,其中,所述检索数据库中包括:历史代码、历史编程文档;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.根据权利要求1所述的方法,其特征在于,利用检索增强生成模型从预设的检索数据库中检索并生成与所述第一代码关联的代码编辑辅助信息,包括:5. The method according to claim 1, characterized in that the code editing auxiliary information associated with the first code is retrieved and generated from a preset retrieval database using a retrieval enhancement generation model, comprising: 利用所述智能编程编辑器对所述第一代码进行预处理,得到第二代码,其中,所述预处理包括以下至少之一:代码标准化、冗余代码去除、错误代码修正、语义增强;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.根据权利要求1所述的方法,其特征在于,所述智能体决策模型是利用所述目标对象的历史编程数据训练得到,利用预训练的智能体决策模型对所述代码编辑辅助信息进行分析,生成针对所述第一代码的调整建议,包括:6. The method according to claim 1, wherein the agent decision model is trained using historical programming data of the target object, and the code editing auxiliary information is analyzed using the pre-trained agent decision model to generate adjustment suggestions for the first code, comprising: 利用所述智能体决策模型对所述代码编辑辅助信息进行分析,生成与所述目标对象的编程风格和习惯相匹配的所述调整建议,其中,所述调整建议中包括:针对所述第一代码的错误修改建议、针对所述第一代码的结构优化建议。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.根据权利要求1所述的方法,其特征在于,在所述交互界面中展示所述调整建议之后,所述方法还包括:7. The method according to claim 1, characterized in that after displaying the adjustment suggestion in the interactive interface, the method further comprises: 获取所述目标对象在所述交互界面中输入的针对所述调整建议的反馈信息;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.一种代码编辑辅助工具,其特征在于,包括:智能编程编辑器、检索增强生成模型和智能体决策模型,其中,8. A code editing auxiliary tool, characterized by comprising: 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; 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 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.一种计算机程序产品,其特征在于,包括:计算机程序,其中,所述计算机程序被处理器执行时实现权利要求1至7中任意一项所述的代码编辑辅助方法。9. A computer program product, characterized in that it comprises: 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.一种电子设备,其特征在于,包括:存储器和处理器,其中,所述存储器中存储有计算机程序,所述处理器被配置为通过所述计算机程序执行权利要求1至7中任意一项所述的代码编辑辅助方法。10. An electronic device, comprising: 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.
CN202411266324.XA 2024-09-10 2024-09-10 Code editing auxiliary methods and tools Pending CN119201074A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411266324.XA CN119201074A (en) 2024-09-10 2024-09-10 Code editing auxiliary methods and tools

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411266324.XA CN119201074A (en) 2024-09-10 2024-09-10 Code editing auxiliary methods and tools

Publications (1)

Publication Number Publication Date
CN119201074A true CN119201074A (en) 2024-12-27

Family

ID=94051694

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411266324.XA Pending CN119201074A (en) 2024-09-10 2024-09-10 Code editing auxiliary methods and tools

Country Status (1)

Country Link
CN (1) CN119201074A (en)

Similar Documents

Publication Publication Date Title
US11521713B2 (en) System and method for generating clinical trial protocol design document with selection of patient and investigator
US11442932B2 (en) Mapping natural language to queries using a query grammar
US20240281446A1 (en) Enhanced searching using fine-tuned machine learning models
CN110276456B (en) A machine learning model-assisted construction method, system, device and medium
JP2022073981A (en) Get source code
CN108319734A (en) A kind of product feature structure tree method for auto constructing based on linear combiner
CN112347781A (en) Generate or modify ontologies representing relationships within input data
US20140310306A1 (en) System And Method For Pattern Recognition And User Interaction
CN118780398B (en) Large model training method and data query method based on large model
CN119007900A (en) Method, device, equipment and storage medium for generating clinical test questionnaire
US10223086B2 (en) Systems and methods for code parsing and lineage detection
CN119201074A (en) Code editing auxiliary methods and tools
CN117874186A (en) A method and device for intelligent algorithm knowledge extraction based on pre-trained language model
CN113934450B (en) Method, apparatus, computer device and medium for generating annotation information
JP5380874B2 (en) Information retrieval method, program and apparatus
CN117519702B (en) Search page design method and system based on low code collocation
CN119106054B (en) LLM-based data analysis private domain knowledge input auxiliary method
JP5652519B2 (en) Information retrieval method, program and apparatus
US20240303437A1 (en) Systems and methods for implementing an advanced content intelligence platform
CN110929019B (en) Information display method and device, storage medium and electronic device
CN118674032A (en) Knowledge extraction method, device, equipment and medium based on large model intelligent agent
CN119784140A (en) A method for generating risk identification and control measures for nuclear power plants
CN119646125A (en) Man-machine interaction method and device based on large model and man-machine interaction equipment
Niculae The ChatGPT Effect: An Analysis of Topic Modeling and User Interaction on StackOverflow
CN119293299A (en) Medical knowledge base semantic search method, system, medium and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination